Advertisement
Gireada

House System

Feb 13th, 2013
1,275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 27.39 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <sscanf2>
  4. #include <zcmd>
  5.  
  6. new hpickup[100];
  7. new maxbuyhouse = 1;
  8. new Text3D:dtextlabel[100];
  9. new houseid2[MAX_PLAYERS];
  10. forward LoadHouses();
  11. forward SaveHouse();
  12. forward SaveThisHouse(houseid);
  13. forward SendAdminMesaj(color,const string[]);
  14.  
  15. enum PlayerData
  16. {
  17.     pPropietati,
  18.  
  19. }
  20. new PlayerInfo[MAX_PLAYERS][PlayerData];
  21.  
  22. enum HouseData
  23. {
  24.     Float:Intrarex,
  25.     Float:Intrarey,
  26.     Float:Intrarez,
  27.     Float:Iesirex,
  28.     Float:Iesirey,
  29.     Float:Iesirez,
  30.     Valoare,
  31.     Propietar[MAX_PLAYER_NAME],
  32.     Camere,
  33.     Seif,
  34.     Cumparata,
  35.     Inchisa,
  36.     Interior,
  37.     Virtual,
  38. }
  39. new HouseInfo[MAX_PLAYERS][HouseData];
  40.  
  41. public OnFilterScriptInit()
  42. {
  43.     print("\n--------------------------------------");
  44.     print(" House System by Gireada");
  45.     print("--------------------------------------\n");
  46.     LoadHouses();
  47.     new string2[700];
  48.     for(new idx = 1; idx<sizeof(HouseInfo); idx++)
  49.     {
  50.         if(HouseInfo[idx][Cumparata] == 1)
  51.         {
  52.             hpickup[idx] = CreatePickup(1272, 1, HouseInfo[idx][Intrarex], HouseInfo[idx][Intrarey], HouseInfo[idx][Intrarez], -1);
  53.             format(string2, sizeof(string2), " Propietar: %s \n Valoare: %d \n Interior: %d \n Virtual: %d \n Camere: %d",HouseInfo[idx][Propietar], HouseInfo[idx][Valoare],HouseInfo[idx][Interior],HouseInfo[idx][Virtual], HouseInfo[idx][Camere]);
  54.             dtextlabel[idx] = Create3DTextLabel(string2, 0x7FFF00FF, HouseInfo[idx][Intrarex], HouseInfo[idx][Intrarey], HouseInfo[idx][Intrarez], 20.0, 0, 0);
  55.         }
  56.         else if(HouseInfo[idx][Cumparata] == 0)
  57.         {
  58.             hpickup[idx] = CreatePickup(1273, 1, HouseInfo[idx][Intrarex], HouseInfo[idx][Intrarey], HouseInfo[idx][Intrarez], -1);
  59.             format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\nInterior: %d\n Virtual: %d \n Camere: %d",HouseInfo[idx][Propietar], HouseInfo[idx][Valoare],HouseInfo[idx][Interior],HouseInfo[idx][Virtual], HouseInfo[idx][Camere]);
  60.             dtextlabel[idx] = Create3DTextLabel(string2, 0xFF4500FF, HouseInfo[idx][Intrarex], HouseInfo[idx][Intrarey], HouseInfo[idx][Intrarez], 20.0, 0, 0);
  61.         }
  62.     }
  63.     return 1;
  64. }
  65.  
  66. public OnFilterScriptExit()
  67. {
  68.     return 1;
  69. }
  70.  
  71. main()
  72. {
  73.     print("\n----------------------------------");
  74.     print(" House System by Gireada");
  75.     print("----------------------------------\n");
  76. }
  77.  
  78.  
  79.  
  80. public OnPlayerConnect(playerid)
  81. {
  82.     new file[80];
  83.     format(file, sizeof(file),"JucatoriCase/%s.ini", pName(playerid));
  84.     if(dini_Exists(file))
  85.     {
  86.         PlayerInfo[playerid][pPropietati] = dini_Int(file,"Propietati");
  87.     }
  88.     else if(!dini_Exists(file))
  89.     {
  90.         dini_Create(file);
  91.         dini_IntSet(file,"Propietati",PlayerInfo[playerid][pPropietati] = 0);
  92.     }
  93.     houseid2[playerid] = 0;
  94.     return 1;
  95. }
  96.  
  97. public OnPlayerDisconnect(playerid, reason)
  98. {
  99.     return 1;
  100. }
  101.  
  102. public OnPlayerSpawn(playerid)
  103. {
  104.     return 1;
  105. }
  106.  
  107. public OnPlayerDeath(playerid, killerid, reason)
  108. {
  109.     return 1;
  110. }
  111.  
  112. public OnVehicleSpawn(vehicleid)
  113. {
  114.     return 1;
  115. }
  116.  
  117. public OnVehicleDeath(vehicleid, killerid)
  118. {
  119.     return 1;
  120. }
  121.  
  122. public OnPlayerText(playerid, text[])
  123. {
  124.     return 1;
  125. }
  126.  
  127. public OnPlayerCommandText(playerid, cmdtext[])
  128. {
  129.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  130.     {
  131.         // Do something here
  132.         return 1;
  133.     }
  134.     return 0;
  135. }
  136.  
  137. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  138. {
  139.     return 1;
  140. }
  141.  
  142. public OnPlayerExitVehicle(playerid, vehicleid)
  143. {
  144.     return 1;
  145. }
  146.  
  147. public OnPlayerStateChange(playerid, newstate, oldstate)
  148. {
  149.     return 1;
  150. }
  151.  
  152. public OnPlayerEnterCheckpoint(playerid)
  153. {
  154.     return 1;
  155. }
  156.  
  157. public OnPlayerLeaveCheckpoint(playerid)
  158. {
  159.     return 1;
  160. }
  161.  
  162. public OnPlayerEnterRaceCheckpoint(playerid)
  163. {
  164.     return 1;
  165. }
  166.  
  167. public OnPlayerLeaveRaceCheckpoint(playerid)
  168. {
  169.     return 1;
  170. }
  171.  
  172. public OnRconCommand(cmd[])
  173. {
  174.     return 1;
  175. }
  176.  
  177. public OnPlayerRequestSpawn(playerid)
  178. {
  179.     return 1;
  180. }
  181.  
  182. public OnObjectMoved(objectid)
  183. {
  184.     return 1;
  185. }
  186.  
  187. public OnPlayerObjectMoved(playerid, objectid)
  188. {
  189.     return 1;
  190. }
  191.  
  192. public OnPlayerPickUpPickup(playerid, pickupid)
  193. {
  194.     return 1;
  195. }
  196.  
  197. public OnVehicleMod(playerid, vehicleid, componentid)
  198. {
  199.     return 1;
  200. }
  201.  
  202. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  203. {
  204.     return 1;
  205. }
  206.  
  207. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  208. {
  209.     return 1;
  210. }
  211.  
  212. public OnPlayerSelectedMenuRow(playerid, row)
  213. {
  214.     return 1;
  215. }
  216.  
  217. public OnPlayerExitedMenu(playerid)
  218. {
  219.     return 1;
  220. }
  221.  
  222. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  223. {
  224.     return 1;
  225. }
  226.  
  227. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  228. {
  229.     return 1;
  230. }
  231.  
  232. public OnRconLoginAttempt(ip[], password[], success)
  233. {
  234.     return 1;
  235. }
  236.  
  237. public OnPlayerUpdate(playerid)
  238. {
  239.     return 1;
  240. }
  241.  
  242. public OnPlayerStreamIn(playerid, forplayerid)
  243. {
  244.     return 1;
  245. }
  246.  
  247. public OnPlayerStreamOut(playerid, forplayerid)
  248. {
  249.     return 1;
  250. }
  251.  
  252. public OnVehicleStreamIn(vehicleid, forplayerid)
  253. {
  254.     return 1;
  255. }
  256.  
  257. public OnVehicleStreamOut(vehicleid, forplayerid)
  258. {
  259.     return 1;
  260. }
  261.  
  262. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  263. {
  264.     return 1;
  265. }
  266.  
  267. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  268. {
  269.     return 1;
  270. }
  271.  
  272. CMD:acreatehouse(playerid, params[])
  273. {
  274.     new string[256],string2[700], model, valoare, virtual;
  275.     new name[35];
  276.     GetPlayerName(playerid, name, sizeof(name));
  277.     new Float:x, Float:y, Float:z;
  278.     GetPlayerPos(playerid, x, y, z);
  279.     new stat[MAX_PLAYERS];
  280.     format(stat, sizeof(stat), "Stat");
  281.     if(unformat(params, "iii", model,valoare,virtual))
  282.     {
  283.             SendClientMessage(playerid, 0xFFFFFFFF, "Foloseste: /acreatehouse <model> <valoare> <virtual>");
  284.             return 1;
  285.     }
  286.     if(!(model > 0 && model < 8))
  287.     {
  288.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Modelul trebuie cuprins intre 1 si 7");
  289.         return 1;
  290.     }
  291.     if(!(valoare > 0 && valoare < 5000000))
  292.     {
  293.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Valoarea trebuie cuprins intre 0 si 5000000$");
  294.         return 1;
  295.     }
  296.     for(new h=1;h<sizeof(HouseInfo);h++)
  297.     {
  298.         if(IsPlayerAdmin(playerid))
  299.         {
  300.             if(IsPlayerConnected(playerid))
  301.             {
  302.                 if(HouseInfo[h][Intrarex] == 0 && HouseInfo[h][Intrarey] == 0 && HouseInfo[h][Intrarez] == 0)
  303.                 {
  304.                     if(model == 1)
  305.                     {
  306.                         strmid(HouseInfo[h][Propietar], "Stat", 0, strlen("Stat"), 999);
  307.                         HouseInfo[h][Intrarex] = x;  HouseInfo[h][Intrarey] = y; HouseInfo[h][Intrarez] = z; HouseInfo[h][Camere] = 6;
  308.                         HouseInfo[h][Iesirex] = 235.508994;  HouseInfo[h][Iesirey] = 1189.169897; HouseInfo[h][Iesirez] = 1080.339966;
  309.                         HouseInfo[h][Interior] = 3; HouseInfo[h][Virtual] = virtual; HouseInfo[h][Cumparata] = 0; HouseInfo[h][Inchisa] = 0; HouseInfo[h][Valoare] = valoare;
  310.                         hpickup[h] = CreatePickup(1273, 1, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], -1);
  311.                         format(string, sizeof(string), " %s a creiat propietatea %d.",name, h);
  312.                         SendAdminMesaj(0xFFFFFFFF,string);
  313.                         format(string2, sizeof(string2), " Propietar: %s\n Valoare: %d\n Interior: %d\n Virtual: %d \n Camere: %d",HouseInfo[h][Propietar], HouseInfo[h][Valoare],HouseInfo[h][Interior],HouseInfo[h][Virtual], HouseInfo[h][Camere]);
  314.                         dtextlabel[h] = Create3DTextLabel(string2, 0x7FFF00FF, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], 20.0, 0, 0);
  315.                         printf("%s a creiat casa %d.",name, h); SaveThisHouse(h);break;
  316.                     }
  317.                     else if(model == 2)
  318.                     {
  319.                         strmid(HouseInfo[h][Propietar], "Stat", 0, strlen("Stat"), 999);
  320.                         HouseInfo[h][Intrarex] = x;  HouseInfo[h][Intrarey] = y; HouseInfo[h][Intrarez] = z;
  321.                         HouseInfo[h][Iesirex] = 225.756989;  HouseInfo[h][Iesirey] = 1240.000000; HouseInfo[h][Iesirez] = 1082.149902; HouseInfo[h][Camere] = 2;
  322.                         HouseInfo[h][Interior] = 2; HouseInfo[h][Virtual] = virtual; HouseInfo[h][Cumparata] = 0; HouseInfo[h][Inchisa] = 0; HouseInfo[h][Valoare] = valoare;
  323.                         hpickup[h] = CreatePickup(1273, 1, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], -1);
  324.                         SendClientMessage(playerid, 0xFFFFFFFF, string);
  325.                         format(string, sizeof(string), " %s a creiat propietatea %d.",name, h);
  326.                         SendAdminMesaj(0xFFFFFFFF,string);
  327.                         format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\nInterior: %d\n Virtual: %d \n Camere: %d",HouseInfo[h][Propietar], HouseInfo[h][Valoare],HouseInfo[h][Interior],HouseInfo[h][Virtual], HouseInfo[h][Camere]);
  328.                         dtextlabel[h] = Create3DTextLabel(string2, 0x7FFF00FF, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], 20.0, 0, 0);
  329.                         printf("%s a creiat casa %d.",name, h); SaveThisHouse(h);break;
  330.                     }
  331.                     else if(model == 3)
  332.                     {
  333.                         strmid(HouseInfo[h][Propietar], "Stat", 0, strlen("Stat"), 999);
  334.                         HouseInfo[h][Intrarex] = x;  HouseInfo[h][Intrarey] = y; HouseInfo[h][Intrarez] = z; HouseInfo[h][Camere] = 3;
  335.                         HouseInfo[h][Iesirex] = 223.043991;  HouseInfo[h][Iesirey] = 1289.259888; HouseInfo[h][Iesirez] = 1082.199951;
  336.                         HouseInfo[h][Interior] = 1; HouseInfo[h][Virtual] = virtual; HouseInfo[h][Cumparata] = 0; HouseInfo[h][Inchisa] = 0; HouseInfo[h][Valoare] = valoare;
  337.                         hpickup[h] = CreatePickup(1273, 1, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], -1);
  338.                         SendClientMessage(playerid, 0xFFFFFFFF, string);
  339.                         format(string, sizeof(string), " %s a creiat propietatea %d.",name, h);
  340.                         SendAdminMesaj(0xFFFFFFFF,string);
  341.                         format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\nInterior: %d\n Virtual: %d \n Camere: %d",HouseInfo[h][Propietar], HouseInfo[h][Valoare],HouseInfo[h][Interior],HouseInfo[h][Virtual], HouseInfo[h][Camere]);
  342.                         dtextlabel[h] = Create3DTextLabel(string2, 0x7FFF00FF, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], 20.0, 0, 0);
  343.                         printf("%s a creiat casa %d.",name, h); SaveThisHouse(h);break;
  344.                     }
  345.                     else if(model == 4)
  346.                     {
  347.                         strmid(HouseInfo[h][Propietar], "Stat", 0, strlen("Stat"), 999);
  348.                         HouseInfo[h][Intrarex] = x;  HouseInfo[h][Intrarey] = y; HouseInfo[h][Intrarez] = z;
  349.                         HouseInfo[h][Iesirex] = 225.630997;  HouseInfo[h][Iesirey] = 1022.479980; HouseInfo[h][Iesirez] = 1084.069946; HouseInfo[h][Camere] = 7;
  350.                         HouseInfo[h][Interior] = 7; HouseInfo[h][Virtual] = virtual; HouseInfo[h][Cumparata] = 0; HouseInfo[h][Inchisa] = 0; HouseInfo[h][Valoare] = valoare;
  351.                         hpickup[h] = CreatePickup(1273, 1, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], -1);
  352.                         SendClientMessage(playerid, 0xFFFFFFFF, string);
  353.                         format(string, sizeof(string), " %s a creiat propietatea %d.",name, h);
  354.                         SendAdminMesaj(0xFFFFFFFF,string);
  355.                         format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\nInterior: %d\n Virtual: %d \n Camere: %d",HouseInfo[h][Propietar], HouseInfo[h][Valoare],HouseInfo[h][Interior],HouseInfo[h][Virtual], HouseInfo[h][Camere]);
  356.                         dtextlabel[h] = Create3DTextLabel(string2, 0x7FFF00FF, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], 20.0, 0, 0);
  357.                         printf("%s a creiat casa %d.",name, h); SaveThisHouse(h);break;
  358.                     }
  359.                     else if(model == 5)
  360.                     {
  361.                         strmid(HouseInfo[h][Propietar], "Stat", 0, strlen("Stat"), 999);
  362.                         HouseInfo[h][Intrarex] = x;  HouseInfo[h][Intrarey] = y; HouseInfo[h][Intrarez] = z; HouseInfo[h][Camere] = 5;
  363.                         HouseInfo[h][Iesirex] = 295.138977;  HouseInfo[h][Iesirey] = 1474.469971; HouseInfo[h][Iesirez] = 1080.519897;
  364.                         HouseInfo[h][Interior] = 15; HouseInfo[h][Virtual] = virtual; HouseInfo[h][Cumparata] = 0; HouseInfo[h][Inchisa] = 0; HouseInfo[h][Valoare] = valoare;
  365.                         hpickup[h] = CreatePickup(1273, 1, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], -1);
  366.                         SendClientMessage(playerid, 0xFFFFFFFF, string);
  367.                         format(string, sizeof(string), " %s a creiat propietatea %d.",name, h);
  368.                         SendAdminMesaj(0xFFFFFFFF,string);
  369.                         format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\nInterior: %d\n Virtual: %d \n Camere: %d",HouseInfo[h][Propietar], HouseInfo[h][Valoare],HouseInfo[h][Interior],HouseInfo[h][Virtual], HouseInfo[h][Camere]);
  370.                         dtextlabel[h] = Create3DTextLabel(string2, 0x7FFF00FF, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], 20.0, 0, 0);
  371.                         printf("%s a creiat casa %d.",name, h); SaveThisHouse(h);break;
  372.                     }
  373.                     else if(model == 6)
  374.                     {
  375.                         strmid(HouseInfo[h][Propietar], "Stat", 0, strlen("Stat"), 999);
  376.                         HouseInfo[h][Intrarex] = x;  HouseInfo[h][Intrarey] = y; HouseInfo[h][Intrarez] = z;
  377.                         HouseInfo[h][Iesirex] = 328.493988;  HouseInfo[h][Iesirey] = 1480.589966; HouseInfo[h][Iesirez] = 1084.449951; HouseInfo[h][Camere] = 5;
  378.                         HouseInfo[h][Interior] = 15; HouseInfo[h][Virtual] = virtual; HouseInfo[h][Cumparata] = 0; HouseInfo[h][Inchisa] = 0; HouseInfo[h][Valoare] = valoare;
  379.                         hpickup[h] = CreatePickup(1273, 1, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], -1);
  380.                         SendClientMessage(playerid, 0xFFFFFFFF, string);
  381.                         format(string, sizeof(string), " %s a creiat propietatea %d.",name, h);
  382.                         SendAdminMesaj(0xFFFFFFFF,string);
  383.                         format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\nInterior: %d\n Virtual: %d \n Camere: %d",HouseInfo[h][Propietar], HouseInfo[h][Valoare],HouseInfo[h][Interior],HouseInfo[h][Virtual], HouseInfo[h][Camere]);
  384.                         dtextlabel[h] = Create3DTextLabel(string2, 0x7FFF00FF, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], 20.0, 0, 0);
  385.                         printf("%s a creiat casa %d.",name, h); SaveThisHouse(h);break;
  386.                     }
  387.                     else if(model == 7)
  388.                     {
  389.                         strmid(HouseInfo[h][Propietar], "Stat", 0, strlen("Stat"), 999);
  390.                         HouseInfo[h][Intrarex] = x;  HouseInfo[h][Intrarey] = y; HouseInfo[h][Intrarez] = z;
  391.                         HouseInfo[h][Iesirex] = 385.803986;  HouseInfo[h][Iesirey] = 1471.769897; HouseInfo[h][Iesirez] = 1080.209961; HouseInfo[h][Camere] = 3;
  392.                         HouseInfo[h][Interior] = 15; HouseInfo[h][Virtual] = virtual; HouseInfo[h][Cumparata] = 0; HouseInfo[h][Inchisa] = 0; HouseInfo[h][Valoare] = valoare;
  393.                         hpickup[h] = CreatePickup(1273, 1, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], -1);
  394.                         SendClientMessage(playerid, 0xFFFFFFFF, string);
  395.                         format(string, sizeof(string), " %s a creiat propietatea %d.",name, h);
  396.                         SendAdminMesaj(0xFFFFFFFF,string);
  397.                         format(string2, sizeof(string2), " Propietar: %s\nValoare: %d\nInterior: %d\n Virtual: %d \n Camere: %d",HouseInfo[h][Propietar], HouseInfo[h][Valoare],HouseInfo[h][Interior],HouseInfo[h][Virtual], HouseInfo[h][Camere]);
  398.                         dtextlabel[h] = Create3DTextLabel(string2, 0x7FFF00FF, HouseInfo[h][Intrarex], HouseInfo[h][Intrarey], HouseInfo[h][Intrarez], 20.0, 0, 0);
  399.                         printf("%s a creiat casa %d.",name, h); SaveThisHouse(h);break;
  400.                     }
  401.                 }
  402.             }
  403.             else
  404.             {
  405.                 SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Trebuie sa fii conectat.");
  406.                 return 1;
  407.             }
  408.         }
  409.         else
  410.         {
  411.             SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Trebuie sa ai admin mai mare de 6");
  412.             return 1;
  413.         }
  414.     }
  415.     return 1;
  416. }
  417.  
  418. CMD:intra(playerid, params[])
  419. {
  420.     new name[MAX_PLAYER_NAME];
  421.     GetPlayerName(playerid, name, sizeof(name));
  422.     for(new house=1; house<sizeof(HouseInfo); house++)
  423.     {
  424.         if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[house][Intrarex], HouseInfo[house][Intrarey], HouseInfo[house][Intrarez]))
  425.         {
  426.             if(HouseInfo[house][Inchisa] == 0 || HouseInfo[house][Propietar] == name[playerid])
  427.             {
  428.                 houseid2[playerid] = house;
  429.                 SetPlayerPos(playerid,HouseInfo[house][Iesirex], HouseInfo[house][Iesirey], HouseInfo[house][Iesirez]);
  430.                 SetPlayerInterior(playerid, HouseInfo[house][Interior]);
  431.                 SetPlayerVirtualWorld(playerid, HouseInfo[house][Virtual]);break;
  432.             }
  433.             else if(HouseInfo[house][Inchisa] == 1)
  434.             {
  435.                  SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Aceasta casa este incuiata!");break;
  436.             }
  437.         }
  438.     }
  439.     return 1;
  440. }
  441.  
  442. CMD:iesi(playerid, params[])
  443. {
  444.     new house = houseid2[playerid];
  445.     if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[house][Iesirex], HouseInfo[house][Iesirey], HouseInfo[house][Iesirez]))
  446.     {
  447.         SetPlayerPos(playerid,HouseInfo[house][Intrarex], HouseInfo[house][Intrarey], HouseInfo[house][Intrarez]);
  448.         SetPlayerInterior(playerid, 0);
  449.         SetPlayerVirtualWorld(playerid, 0);
  450.     }
  451.     return 1;
  452. }
  453.  
  454. CMD:hcumpara(playerid, params[])
  455. {
  456.     new name[35],string2[700];
  457.     GetPlayerName(playerid, name, sizeof(name));
  458.     if(PlayerInfo[playerid][pPropietati] > maxbuyhouse)
  459.     {
  460.         SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Ai ajuns la limitate de propietati!");
  461.     }
  462.     for(new house=1; house<sizeof(HouseInfo); house++)
  463.     {
  464.         if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[house][Intrarex], HouseInfo[house][Intrarey], HouseInfo[house][Intrarez]))
  465.         {
  466.             if(HouseInfo[house][Cumparata] == 0)
  467.             {
  468.                 if(GetPlayerMoney(playerid) >= HouseInfo[house][Valoare])
  469.                 {
  470.                     HouseInfo[house][Cumparata] = 1; PlayerInfo[house][pPropietati] += 1;
  471.                     strmid(HouseInfo[house][Propietar], name, 0, strlen(name), 255);SaveThisHouse(house);
  472.                     DestroyPickup(hpickup[house]);
  473.                     hpickup[house] = CreatePickup(1272, 1, HouseInfo[house][Intrarex], HouseInfo[house][Intrarey], HouseInfo[house][Intrarez], -1);
  474.                     format(string2, sizeof(string2), " Propietar: %s\n Valoare: %d\n Interior: %d\n Virtual: %d \n Camere: %d",HouseInfo[house][Propietar], HouseInfo[house][Valoare],HouseInfo[house][Interior],HouseInfo[house][Virtual], HouseInfo[house][Camere]);
  475.                     Update3DTextLabelText(dtextlabel[house], 0xFF4500FF, string2);
  476.                     break;
  477.                 }
  478.                 else
  479.                 {
  480.                     SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Nu ai destui bani la tine!");
  481.                     break;
  482.                 }
  483.             }
  484.             else
  485.             {
  486.                 SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Aceasta casa are deja un propietar!");
  487.                 break;
  488.             }
  489.         }
  490.     }
  491.     return 1;
  492. }
  493.  
  494. CMD:hvinde(playerid, params[])
  495. {
  496.     new name[35], string2[700];
  497.     GetPlayerName(playerid, name, sizeof(name));
  498.     for(new house=1; house<sizeof(HouseInfo); house++)
  499.     {
  500.         if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[house][Intrarex], HouseInfo[house][Intrarey], HouseInfo[house][Intrarez]))
  501.         {
  502.             if(HouseInfo[house][Propietar] == name[playerid])
  503.             {
  504.                 HouseInfo[house][Cumparata] = 0; strmid(HouseInfo[house][Propietar], "Stat", 0, strlen("Stat"), 999);
  505.                 GivePlayerMoney(playerid, HouseInfo[house][Seif]);
  506.                 GivePlayerMoney(playerid, HouseInfo[house][Valoare] / 2);
  507.                 HouseInfo[house][Seif] = 0;PlayerInfo[house][pPropietati] += 1;SaveThisHouse(house);
  508.                 DestroyPickup(hpickup[house]);
  509.                 hpickup[house] = CreatePickup(1273, 1, HouseInfo[house][Intrarex], HouseInfo[house][Intrarey], HouseInfo[house][Intrarez], -1);
  510.                 format(string2, sizeof(string2), "Propietar: %s\nValoare: %d\nInterior: %d\n Virtual: %d \n Camere: %d",HouseInfo[house][Propietar], HouseInfo[house][Valoare],HouseInfo[house][Interior],HouseInfo[house][Virtual], HouseInfo[house][Camere]);
  511.                 Update3DTextLabelText(dtextlabel[house], 0x7FFF00FF, string2);
  512.                 break;
  513.             }
  514.             else
  515.             {
  516.                 SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Aceasta nu este propietatea ta!");
  517.                 break;
  518.             }
  519.         }
  520.     }
  521.     return 1;
  522. }
  523.  
  524. CMD:hlock(playerid, params[])
  525. {
  526.     new name[35];
  527.     GetPlayerName(playerid, name, sizeof(name));
  528.     for(new house=1; house<sizeof(HouseInfo); house++)
  529.     {
  530.         if(IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[house][Intrarex], HouseInfo[house][Intrarey], HouseInfo[house][Intrarez]))
  531.         {
  532.             if(HouseInfo[house][Propietar] == name[playerid])
  533.             {
  534.                 if(HouseInfo[house][Inchisa] == 1)
  535.                 {
  536.                     HouseInfo[house][Inchisa] = 0;
  537.                 }
  538.                 else if(HouseInfo[house][Inchisa] == 0)
  539.                 {
  540.                     HouseInfo[house][Inchisa] = 1;
  541.                 }
  542.                 break;
  543.             }
  544.             else
  545.             {
  546.                 SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Aceasta nu este propietatea ta!");
  547.                 break;
  548.             }
  549.         }
  550.     }
  551.     return 1;
  552. }
  553.  
  554. CMD:hdepune(playerid, params[])
  555. {
  556.     new name[MAX_PLAYER_NAME], bani;
  557.     GetPlayerName(playerid, name, sizeof(name));
  558.     new stat[MAX_PLAYERS];
  559.     format(stat, sizeof(stat), "Stat");
  560.     if(unformat(params, "i", bani))
  561.     {
  562.             SendClientMessage(playerid, 0xFFFFFFFF, "Foloseste: /hdepune <suma> ");
  563.             return 1;
  564.     }
  565.     for(new house=1; house<sizeof(HouseInfo); house++)
  566.     {
  567.         if(IsPlayerInRangeOfPoint(playerid, 10.0, HouseInfo[house][Iesirex], HouseInfo[house][Iesirey], HouseInfo[house][Iesirez]))
  568.         {
  569.             if(HouseInfo[house][Propietar] == name[playerid])
  570.             {
  571.                 HouseInfo[house][Seif] += bani;SaveThisHouse(house);break;
  572.             }
  573.             else
  574.             {
  575.                 SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Aceasta nu este propietatea ta!");
  576.                 break;
  577.             }
  578.         }
  579.     }
  580.  
  581.     return 1;
  582. }
  583.  
  584. CMD:hscoate(playerid, params[])
  585. {
  586.     new name[MAX_PLAYER_NAME], bani;
  587.     GetPlayerName(playerid, name, sizeof(name));
  588.     new stat[MAX_PLAYERS];
  589.     format(stat, sizeof(stat), "Stat");
  590.     if(unformat(params, "i", bani))
  591.     {
  592.             SendClientMessage(playerid, 0xFFFFFFFF, "Foloseste: /hscoate <suma> ");
  593.             return 1;
  594.     }
  595.     for(new house=1; house<sizeof(HouseInfo); house++)
  596.     {
  597.         if(bani > HouseInfo[house][Seif])
  598.         {
  599.             SendClientMessage(playerid, 0xFFFFFFFF, "Nu ai destui bani in seiful casei"); break;
  600.         }
  601.         if(IsPlayerInRangeOfPoint(playerid, 10.0, HouseInfo[house][Iesirex], HouseInfo[house][Iesirey], HouseInfo[house][Iesirez]))
  602.         {
  603.             if(HouseInfo[house][Propietar] == name[playerid])
  604.             {
  605.                 HouseInfo[house][Seif] -= bani;SaveThisHouse(house);break;
  606.             }
  607.             else
  608.             {
  609.                 SendClientMessage(playerid, 0xFFFFFFFF, "[Server-Info] Aceasta nu este propietatea ta!");
  610.                 break;
  611.             }
  612.         }
  613.     }
  614.  
  615.     return 1;
  616. }
  617.  
  618. public SaveHouse()
  619. {
  620.     new file2[254];
  621.     new idx = 1;
  622.     while(idx<sizeof(HouseInfo))
  623.     {
  624.         format(file2, sizeof(file2),"Case/%d.ini", idx);
  625.         if(dini_Exists(file2))
  626.         {
  627.             dini_FloatSet(file2,"Intrarex",HouseInfo[idx][Intrarex]);
  628.             dini_FloatSet(file2,"Intrarey",HouseInfo[idx][Intrarey]);
  629.             dini_FloatSet(file2,"Intrarez",HouseInfo[idx][Intrarez]);
  630.             dini_FloatSet(file2,"Iesirex",HouseInfo[idx][Iesirex]);
  631.             dini_FloatSet(file2,"Iesirey",HouseInfo[idx][Iesirey]);
  632.             dini_FloatSet(file2,"Iesirez",HouseInfo[idx][Iesirez]);
  633.             dini_IntSet(file2,"Valoare",HouseInfo[idx][Valoare]);
  634.             dini_Set(file2,"Propietar",HouseInfo[idx][Propietar]);
  635.             dini_IntSet(file2,"Camere",HouseInfo[idx][Camere]);
  636.             dini_IntSet(file2,"Seif",HouseInfo[idx][Seif]);
  637.             dini_IntSet(file2,"Cumparata",HouseInfo[idx][Cumparata]);
  638.             dini_IntSet(file2,"Inchisa",HouseInfo[idx][Inchisa]);
  639.             dini_IntSet(file2,"Interior",HouseInfo[idx][Interior]);
  640.             dini_IntSet(file2,"Virtual",HouseInfo[idx][Virtual]);
  641.             idx++;
  642.             return 1;
  643.         }
  644.         else if(!dini_Exists(file2))
  645.         {
  646.             dini_Create(file2);
  647.             dini_FloatSet(file2,"Intrarex",HouseInfo[idx][Intrarex]);
  648.             dini_FloatSet(file2,"Intrarey",HouseInfo[idx][Intrarey]);
  649.             dini_FloatSet(file2,"Intrarez",HouseInfo[idx][Intrarez]);
  650.             dini_FloatSet(file2,"Iesirex",HouseInfo[idx][Iesirex]);
  651.             dini_FloatSet(file2,"Iesirey",HouseInfo[idx][Iesirey]);
  652.             dini_FloatSet(file2,"Iesirez",HouseInfo[idx][Iesirez]);
  653.             dini_IntSet(file2,"Valoare",HouseInfo[idx][Valoare]);
  654.             dini_Set(file2,"Propietar",HouseInfo[idx][Propietar]);
  655.             dini_IntSet(file2,"Camere",HouseInfo[idx][Camere]);
  656.             dini_IntSet(file2,"Seif",HouseInfo[idx][Seif]);
  657.             dini_IntSet(file2,"Cumparata",HouseInfo[idx][Cumparata]);
  658.             dini_IntSet(file2,"Inchisa",HouseInfo[idx][Inchisa]);
  659.             dini_IntSet(file2,"Interior",HouseInfo[idx][Interior]);
  660.             dini_IntSet(file2,"Virtual",HouseInfo[idx][Virtual]);
  661.             idx++;
  662.             return 1;
  663.         }
  664.     }
  665.     return 1;
  666. }
  667.  
  668. public SaveThisHouse(houseid)
  669. {
  670.     new file2[254];
  671.     format(file2, sizeof(file2),"Case/%d.ini", houseid);
  672.     if(dini_Exists(file2))
  673.     {
  674.         dini_FloatSet(file2,"Intrarex",HouseInfo[houseid][Intrarex]);
  675.         dini_FloatSet(file2,"Intrarey",HouseInfo[houseid][Intrarey]);
  676.         dini_FloatSet(file2,"Intrarez",HouseInfo[houseid][Intrarez]);
  677.         dini_FloatSet(file2,"Iesirex",HouseInfo[houseid][Iesirex]);
  678.         dini_FloatSet(file2,"Iesirey",HouseInfo[houseid][Iesirey]);
  679.         dini_FloatSet(file2,"Iesirez",HouseInfo[houseid][Iesirez]);
  680.         dini_IntSet(file2,"Valoare",HouseInfo[houseid][Valoare]);
  681.         dini_Set(file2,"Propietar",HouseInfo[houseid][Propietar]);
  682.         dini_IntSet(file2,"Camere",HouseInfo[houseid][Camere]);
  683.         dini_IntSet(file2,"Seif",HouseInfo[houseid][Seif]);
  684.         dini_IntSet(file2,"Cumparata",HouseInfo[houseid][Cumparata]);
  685.         dini_IntSet(file2,"Inchisa",HouseInfo[houseid][Inchisa]);
  686.         dini_IntSet(file2,"Interior",HouseInfo[houseid][Interior]);
  687.         dini_IntSet(file2,"Virtual",HouseInfo[houseid][Virtual]);
  688.         return 1;
  689.     }
  690.     else if(!dini_Exists(file2))
  691.     {
  692.         dini_Create(file2);
  693.         dini_FloatSet(file2,"Intrarex",HouseInfo[houseid][Intrarex]);
  694.         dini_FloatSet(file2,"Intrarey",HouseInfo[houseid][Intrarey]);
  695.         dini_FloatSet(file2,"Intrarez",HouseInfo[houseid][Intrarez]);
  696.         dini_FloatSet(file2,"Iesirex",HouseInfo[houseid][Iesirex]);
  697.         dini_FloatSet(file2,"Iesirey",HouseInfo[houseid][Iesirey]);
  698.         dini_FloatSet(file2,"Iesirez",HouseInfo[houseid][Iesirez]);
  699.         dini_IntSet(file2,"Valoare",HouseInfo[houseid][Valoare]);
  700.         dini_Set(file2,"Propietar",HouseInfo[houseid][Propietar]);
  701.         dini_IntSet(file2,"Camere",HouseInfo[houseid][Camere]);
  702.         dini_IntSet(file2,"Seif",HouseInfo[houseid][Seif]);
  703.         dini_IntSet(file2,"Cumparata",HouseInfo[houseid][Cumparata]);
  704.         dini_IntSet(file2,"Inchisa",HouseInfo[houseid][Inchisa]);
  705.         dini_IntSet(file2,"Interior",HouseInfo[houseid][Interior]);
  706.         dini_IntSet(file2,"Virtual",HouseInfo[houseid][Virtual]);
  707.         return 1;
  708.     }
  709.     return 1;
  710. }
  711.  
  712. public LoadHouses()
  713. {
  714.     new file[254];
  715.     new idx = 1;
  716.     while(idx < sizeof(HouseInfo))
  717.     {
  718.         format(file, sizeof(file),"Case/%d.ini", idx);
  719.         if(dini_Exists(file))
  720.         {
  721.             HouseInfo[idx][Intrarex] = dini_Float(file,"Intrarex");
  722.             HouseInfo[idx][Intrarey] = dini_Float(file,"Intrarey");
  723.             HouseInfo[idx][Intrarez] = dini_Float(file,"Intrarez");
  724.             HouseInfo[idx][Iesirex] = dini_Float(file,"Iesirex");
  725.             HouseInfo[idx][Iesirey] = dini_Float(file,"Iesirey");
  726.             HouseInfo[idx][Iesirez] = dini_Float(file,"Iesirez");
  727.             HouseInfo[idx][Valoare] = dini_Int(file,"Valoare");
  728.             strmid(HouseInfo[idx][Propietar], dini_Get(file,"Propietar"), 0, strlen(dini_Get(file,"Propietar")), 255);
  729.             HouseInfo[idx][Camere] = dini_Int(file,"Camere");
  730.             HouseInfo[idx][Inchisa] = dini_Int(file,"Inchisa");
  731.             HouseInfo[idx][Seif] = dini_Int(file,"Seif");
  732.             HouseInfo[idx][Cumparata] = dini_Int(file,"Cumparata");
  733.             HouseInfo[idx][Inchisa] = dini_Int(file,"Inchisa");
  734.             HouseInfo[idx][Interior] = dini_Int(file,"Interior");
  735.             HouseInfo[idx][Virtual] = dini_Int(file,"Virtual");
  736.             idx++;
  737.         }
  738.         else if(!dini_Exists(file))
  739.         {
  740.             idx++;
  741.         }
  742.     }
  743.     return 1;
  744. }
  745.  
  746. public SendAdminMesaj(color,const string[])
  747. {
  748.     for(new i = 0; i < MAX_PLAYERS; i++)
  749.     {
  750.         if(IsPlayerConnected(i))
  751.         {
  752.             if(IsPlayerAdmin(i))
  753.             {
  754.                 SendClientMessage(i, color, string);
  755.                 printf("%s", string);
  756.             }
  757.         }
  758.     }
  759.     return 1;
  760. }
  761.  
  762. stock pName(playerid)
  763. {
  764.     new name[MAX_PLAYER_NAME];
  765.     GetPlayerName(playerid,name,sizeof(name));
  766.     return name;
  767. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement