Advertisement
Guest User

Souvlaki's sHouse Version 1.0.1

a guest
Jan 8th, 2011
1,316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 18.13 KB | None | 0 0
  1. /*       __  __
  2.       /\ \/\ \
  3.   ____\ \ \_\ \    ___   __  __    ____     __
  4.  /',__\\ \  _  \  / __`\/\ \/\ \  /',__\  /'__`\
  5. /\__, `\\ \ \ \ \/\ \ \ \ \ \_\ \/\__, `\/\  __/
  6. \/\____/ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
  7.  \/___/   \/_/\/_/\/___/  \/___/  \/___/  \/____/
  8.  
  9. */
  10. /*
  11. ============[ChangeLog]==========//
  12. 8/01/2011 [1.0.0] - Initial Release
  13. 9/01/2011 [1.0.1] - Fixed 3D Text Labels
  14.                   - Fixed bugged when you destroy a house
  15.                   - Added 3 more interiors
  16.                   - Fixed a bug with Virtual worlds
  17. */
  18. //==========[Includes]==========//
  19. #include <a_samp>//by SA-MP Team
  20. #include <zcmd>//by Zeex
  21. #include <sscanf2>//by Y_Less
  22. #include <mysql>//by StrickenKid
  23. #include <seif_text>//by Seif
  24. #include <streamer>//by Incognito
  25. //==========[Database]==========//
  26. #define SQL_HOST "localhost"// Your MySQL Host
  27. #define SQL_USER "root"// Your MySQL username(usually root)
  28. #define SQL_PASS ""// Your MySQL Password
  29. #define SQL_DB "samp"// Your MySQL database (default samp)
  30. //==========[Shit]==========//
  31. #define function%0(%1) forward%0(%1); public%0(%1)
  32. #define MAX_HOUSES 50
  33. #define SCRIPT_VERSION "1.0.1"
  34. #define SCRIPT_AUTHOR "Souvlaki"
  35. //-------------------------------------------------------------------------------------//
  36. #define GREEN                   0x007C00AA
  37. #define ORANGE                  0xF68B00AA
  38. //-------------------------------------------------------------------------------------//
  39. new Text3D:HouseText[MAX_HOUSES];
  40. new sArray[5];
  41. //-------------------------------------------------------------------------------------//
  42. enum hInfo
  43. {
  44.     hID,
  45.     hOwned,
  46.     hOwner[24],
  47.     Float:hEntranceX,
  48.     Float:hEntranceY,
  49.     Float:hEntranceZ,
  50.     Float:hExitX,
  51.     Float:hExitY,
  52.     Float:hExitZ,
  53.     hInterior,
  54.     hOpen,
  55.     hPickup,
  56.     hPrice
  57. };
  58. new HouseInfo[MAX_HOUSES][hInfo];
  59. //-------------------------------------------------------------------------------------//
  60. public OnFilterScriptInit()
  61. {
  62.     print("--------------------------------------\n");
  63.     print("sHouse version 1.0.1 Loaded");
  64.     print("\n--------------------------------------");
  65.     mysql_init(LOG_ALL, 1);
  66.     mysql_connect(SQL_HOST, SQL_USER, SQL_PASS, SQL_DB);
  67.     LoadSHouses();
  68.     return 1;
  69. }
  70. //-------------------------------------------------------------------------------------//
  71. public OnFilterScriptExit()
  72. {
  73.     print("--------------------------------------\n");
  74.     print("sHouse version 1.0.1 Unloaded");
  75.     print("\n--------------------------------------");
  76.     for(new id; id < MAX_HOUSES; id++)
  77.     {
  78.         SaveSHouse(id);
  79.     }
  80.     return 1;
  81. }
  82. //-------------------------------------------------------------------------------------//
  83. public OnPlayerConnect(playerid)
  84. {
  85.     DisplayTextForPlayer(playerid, "sHouse", 5, 3, 3);
  86.     return 1;
  87. }
  88. //-------------------------------------------------------------------------------------//
  89. function OnPlayerPickUpDynamicPickup(playerid, pickupid)
  90. {
  91.     new string[128];
  92.     for(new id = 0; id < sizeof(HouseInfo); id++)
  93.     {
  94.         if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]))
  95.         {
  96.             if(HouseInfo[id][hOwned] == 0)
  97.             {
  98.             format(string,sizeof(string),"~r~Property~n~~w~For Sale~n~~y~~h~Price:~w~ %d",HouseInfo[id][hPrice]);
  99.             DisplayTextForPlayer(playerid, string, 5, 3, 3);
  100.             }
  101.             else if(HouseInfo[id][hOwned] == 1)
  102.             {
  103.             format(string,sizeof(string),"~r~Property~n~~y~~h~Owner:~w~ %s",HouseInfo[id][hOwner], HouseInfo[id][hPrice]);
  104.             DisplayTextForPlayer(playerid, string, 5, 3, 3);
  105.             }
  106.         }
  107.     }
  108.     return 1;
  109. }
  110. //-------------------------------------------------------------------------------------//
  111. COMMAND:enter(playerid, params[])
  112. {
  113.     #pragma unused params
  114.     for(new id = 0; id < sizeof(HouseInfo); id++)
  115.     {
  116.         if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]))
  117.         {
  118.             if(HouseInfo[id][hOpen] == 0)
  119.             {
  120.                 DisplayTextForPlayer(playerid,"~r~Locked",2, 1, 1);
  121.             }
  122.             else
  123.             {
  124.                 SetPlayerPos(playerid, HouseInfo[id][hExitX], HouseInfo[id][hExitY], HouseInfo[id][hExitZ]);
  125.                 SetPlayerInterior(playerid, HouseInfo[id][hInterior]);
  126.                 SetPlayerVirtualWorld(playerid, id);
  127.             }
  128.         }
  129.     }
  130.     return 1;
  131. }
  132. //-------------------------------------------------------------------------------------//
  133. COMMAND:exit(playerid, params[])
  134. {
  135.     #pragma unused params
  136.     for(new id = 0; id < sizeof(HouseInfo); id++)
  137.     {
  138.         if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[id][hExitX], HouseInfo[id][hExitY], HouseInfo[id][hExitZ]))
  139.         {
  140.             SetPlayerPos(playerid,  HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]);
  141.             SetPlayerInterior(playerid, 0);
  142.             SetPlayerVirtualWorld(playerid, 0);
  143.         }
  144.     }
  145.     return 1;
  146. }
  147. //-------------------------------------------------------------------------------------//
  148. COMMAND:createhouse(playerid, params[])
  149. {
  150.     if(sscanf(params, "ii", sArray[0], sArray[1]))
  151.     {
  152.         SendClientMessage(playerid, GREEN, "[SYNTAX]: /createhouse [Price] [Interior (1-3)]");
  153.         SendClientMessage(playerid, ORANGE, "[Interiors]: Large/2 story/3 bedrooms (1) |    Medium/1 story/1 bedroom  (2) | Small/1 story/1 bedroom  (3)");
  154.         SendClientMessage(playerid, ORANGE, "[Interiors]:   VERY Large/2 story/4 bedrooms  (4) |    Small/1 story/2 bedrooms   (5) | Small/1 story/2 bedrooms  (6)");
  155.         return 1;
  156.     }
  157.     if(IsPlayerAdmin(playerid))
  158.     {
  159.         if(sArray[1] > 3 && sArray[1] < 1) return SendClientMessage(playerid, ORANGE, "[Interiors]: House Large 1 (1) | House Medium (2) | House Small (3)");
  160.         new Float:PlayerPos[3];
  161.         GetPlayerPos(playerid, PlayerPos[0], PlayerPos[1], PlayerPos[2]);
  162.         CreateSHouse(PlayerPos[0], PlayerPos[1], PlayerPos[2], sArray[0], sArray[1]);
  163.     }
  164.     else
  165.     {
  166.         SendClientMessage(playerid, ORANGE, "[ERROR]: You ain't no RCON admin, you piece of shit motherfucker.");
  167.     }
  168.     return 1;
  169. }
  170. //-------------------------------------------------------------------------------------//
  171. COMMAND:movehouse(playerid, params[])
  172. {
  173.     if(sscanf(params, "i", sArray[0])) return SendClientMessage(playerid, GREEN, "[SYNTAX]: /movehouse [HouseID]");
  174.     if(IsPlayerAdmin(playerid))
  175.     {
  176.         new Float:PlayerPos[3];
  177.         GetPlayerPos(playerid, PlayerPos[0], PlayerPos[1], PlayerPos[2]);
  178.         Delete3DTextLabel(HouseText[sArray[0]]);
  179.         DestroyDynamicPickup(HouseInfo[sArray[0]][hPickup]);
  180.         HouseInfo[sArray[0]][hEntranceX] = PlayerPos[0];
  181.         HouseInfo[sArray[0]][hEntranceY] = PlayerPos[1];
  182.         HouseInfo[sArray[0]][hEntranceZ] = PlayerPos[2];
  183.         SaveSHouse(sArray[0]);
  184.         if(HouseInfo[sArray[0]][hOwned] == 0)
  185.             {
  186.                 HouseInfo[sArray[0]][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[sArray[0]][hEntranceX], HouseInfo[sArray[0]][hEntranceY], HouseInfo[sArray[0]][hEntranceZ]);
  187.             }
  188.             else if(HouseInfo[sArray[0]][hOwned] == 1)
  189.             {
  190.                 HouseInfo[sArray[0]][hPickup] = CreateDynamicPickup(1239, 1, HouseInfo[sArray[0]][hEntranceX], HouseInfo[sArray[0]][hEntranceY], HouseInfo[sArray[0]][hEntranceZ]);
  191.             }
  192.     }
  193.     else
  194.     {
  195.         SendClientMessage(playerid, ORANGE, "[ERROR]: You ain't no RCON admin, you piece of shit motherfucker.");
  196.     }
  197.     return 1;
  198. }
  199. //-------------------------------------------------------------------------------------//
  200. COMMAND:destroyhouse(playerid, params[])
  201.  {
  202.     new string[256];
  203.     if(sscanf(params, "i", sArray[0])) return SendClientMessage(playerid, GREEN, "[SYNTAX]: /destroyhouse [id]");
  204.     if(IsPlayerAdmin(playerid))
  205.     {
  206.         format(string, sizeof(string), "DELETE FROM Houses WHERE id = %i", sArray[0]);
  207.         mysql_query(string);
  208.         DestroyDynamic3DTextLabel(HouseText[sArray[0]]);
  209.         DestroyDynamicPickup(HouseInfo[sArray[0]][hPickup]);
  210.         mysql_query("SELECT MAX(id) FROM Houses");
  211.         mysql_store_result();
  212.         new SQL[20];
  213.         mysql_fetch_row(SQL, "|");
  214.         new SQLID = strval(SQL);
  215.         mysql_free_result();
  216.         format(string, sizeof(string), "ALTER TABLE `Houses`  AUTO_INCREMENT =%i", SQLID);
  217.         mysql_query(string);
  218.         //SaveSHouse([sArray[0]]);
  219.     }
  220.     else
  221.     {
  222.         SendClientMessage(playerid, ORANGE, "[ERROR]: You ain't no RCON admin, you piece of shit motherfucker.");
  223.     }
  224.     return 1;
  225. }
  226. //-------------------------------------------------------------------------------------//
  227. COMMAND:shouse(playerid, params[])
  228. {
  229.     if(IsPlayerAdmin(playerid))
  230.     {
  231.     SendClientMessage(playerid, GREEN, "[HELP]: /createhouse [Price] [Interior (1-3)][Will create a house at your position].");
  232.     SendClientMessage(playerid, GREEN, "[HELP]: /movehouse [HouseID] [Will move a house to your position].");
  233.     SendClientMessage(playerid, GREEN, "[HELP]: /destroyhouse [HouseID] [Will move a house with the selected ID].");
  234.     SendClientMessage(playerid, GREEN, "[HELP]: /househelp [Player Commands for houses].");
  235.     }
  236.     else
  237.     {
  238.         SendClientMessage(playerid, ORANGE, "[ERROR]: You ain't no RCON admin, you piece of shit motherfucker.");
  239.     }
  240.     return 1;
  241. }//
  242. //-------------------------------------------------------------------------------------//
  243. COMMAND:househelp(playerid, params[])
  244. {
  245.     SendClientMessage(playerid, GREEN, "[HELP]: /buyhouse [You can buy a house].");
  246.     SendClientMessage(playerid, GREEN, "[HELP]: /sellhouse [You will sell your house].");
  247.     SendClientMessage(playerid, GREEN, "[HELP]: /lock [You will lock/unlock your house].");
  248.     return 1;
  249. }
  250. //-------------------------------------------------------------------------------------//
  251. COMMAND:buyhouse(playerid, params[])
  252. {
  253.             new id = IsPlayerNearByHouse(playerid);
  254.             if(HouseInfo[id][hOwned] == 1) return SendClientMessage(playerid, ORANGE, "[ERROR]This house is already owned!");
  255.             if(GetPlayerMoney(playerid) >= HouseInfo[id][hPrice])
  256.             {
  257.                 GivePlayerMoney(playerid, -HouseInfo[id][hPrice]);
  258.                 HouseInfo[id][hOwned] = 1;
  259.                 strmid(HouseInfo[id][hOwner], GetPlayerNameRP(playerid), 0, strlen(GetPlayerNameRP(playerid)), 255);
  260.                 DestroyDynamicPickup(HouseInfo[id][hPickup]);
  261.                 HouseInfo[id][hPickup] = CreateDynamicPickup(1239, 1, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]);
  262.                 Update3DTextLabels();
  263.                 SaveSHouse(id);
  264.             }
  265.             else return SendClientMessage(playerid, ORANGE, "[ERROR]You don't have enought money to buy this house!");
  266.             return 1;
  267. }
  268. //-------------------------------------------------------------------------------------//
  269. COMMAND:sellhouse(playerid, params[])
  270. {
  271.             new id = IsPlayerNearByHouse(playerid);
  272.             if(HouseInfo[id][hOwned] == 0) return SendClientMessage(playerid, ORANGE, "[ERROR]This house is already for sale!");
  273.             if(!strcmp(GetPlayerNameRP(playerid), HouseInfo[id][hOwner], true))
  274.             {
  275.                 GivePlayerMoney(playerid, HouseInfo[id][hPrice]);
  276.                 HouseInfo[id][hOwned] = 0;
  277.                 strmid(HouseInfo[id][hOwner], "None", 0, strlen("None"), 255);
  278.                 DestroyDynamicPickup(HouseInfo[id][hPickup]);
  279.                 HouseInfo[id][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]);
  280.                 Update3DTextLabels();
  281.                 SaveSHouse(id);
  282.             }
  283.             else return SendClientMessage(playerid, ORANGE, "[ERROR]You don't own this house!");
  284.             return 1;
  285. }
  286. //-------------------------------------------------------------------------------------//
  287. COMMAND:lock(playerid, params[])
  288. {
  289.     new id = IsPlayerNearByHouse(playerid);
  290.     if(id != -1)
  291.     {
  292.         if(!strcmp(GetPlayerNameRP(playerid), HouseInfo[id][hOwner], true))
  293.         {
  294.             if(HouseInfo[id][hOpen] == 0)
  295.             {
  296.                 SendClientMessage(playerid, ORANGE, "[INFO]Door Unlocked!");
  297.                 HouseInfo[id][hOpen] = 1;
  298.                 SaveSHouse(id);
  299.             }
  300.             else
  301.             {
  302.                 HouseInfo[id][hOpen] = 0;
  303.                 SendClientMessage(playerid, ORANGE, "[INFO]Door locked!");
  304.                 SaveSHouse(id);
  305.             }
  306.         }
  307.     }
  308.     return 1;
  309. }
  310. //-------------------------------------------------------------------------------------//
  311. function LoadSHouses()
  312. {
  313.     for(new id; id < MAX_HOUSES; id++)
  314.     {
  315.         new DataString[128], Query[128];
  316.         format( Query, sizeof( Query ), "SELECT * FROM Houses WHERE id= '%d'", id);
  317.         mysql_query(Query);
  318.         mysql_store_result();
  319.         if(mysql_num_rows())
  320.         if(mysql_fetch_row(Query,"|"))
  321.         {
  322.  
  323.         mysql_fetch_field("id", DataString);
  324.         HouseInfo[id][hID] = strval(DataString);
  325.  
  326.         mysql_fetch_field("Owned", DataString);
  327.         HouseInfo[id][hOwned] = strval(DataString);
  328.  
  329.         mysql_fetch_field("Owner", DataString);
  330.         HouseInfo[id][hOwner] = strval(DataString);
  331.  
  332.         mysql_fetch_field("EntranceX", DataString);
  333.         HouseInfo[id][hEntranceX] = floatstr(DataString);
  334.  
  335.         mysql_fetch_field("EntranceY", DataString);
  336.         HouseInfo[id][hEntranceY] = floatstr(DataString);
  337.  
  338.         mysql_fetch_field("EntranceZ", DataString);
  339.         HouseInfo[id][hEntranceZ] = floatstr(DataString);
  340.  
  341.         mysql_fetch_field("ExitX", DataString);
  342.         HouseInfo[id][hExitX] = floatstr(DataString);
  343.  
  344.         mysql_fetch_field("ExitY", DataString);
  345.         HouseInfo[id][hExitY] = floatstr(DataString);
  346.  
  347.         mysql_fetch_field("ExitZ", DataString);
  348.         HouseInfo[id][hExitZ] = floatstr(DataString);
  349.  
  350.         mysql_fetch_field("Interior", DataString);
  351.         HouseInfo[id][hInterior] = strval(DataString);
  352.  
  353.         mysql_fetch_field("Open", DataString);
  354.         HouseInfo[id][hOpen] = strval(DataString);
  355.  
  356.         mysql_fetch_field("Pickup", DataString);
  357.         HouseInfo[id][hPickup] = strval(DataString);
  358.  
  359.  
  360.         mysql_fetch_field("Price", DataString);
  361.         HouseInfo[id][hPrice] = strval(DataString);
  362.         mysql_free_result();
  363.         if(HouseInfo[id][hOwned] == 0)
  364.             {
  365.                 HouseText[id] = CreateDynamic3DTextLabel("[HOUSE FOR SALE]", GREEN, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]+0.75, 75.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 75.0);
  366.                 HouseInfo[id][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]);
  367.             }
  368.             else if(HouseInfo[id][hOwned] == 1)
  369.             {
  370.                 HouseText[id] = CreateDynamic3DTextLabel("[HOUSE]", GREEN, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]+0.75, 75.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 75.0);
  371.                 HouseInfo[id][hPickup] = CreateDynamicPickup(1239, 1, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]);
  372.             }
  373.         }
  374.     }
  375.     return 1;
  376. }
  377. //-------------------------------------------------------------------------------------//
  378. function Update3DTextLabels()
  379. {
  380.     new string[64];
  381.     for(new id = 0; id < sizeof(HouseInfo); id++)
  382.     {
  383.         if(HouseInfo[id][hOwned] == 0)
  384.         {
  385.             format(string,sizeof(string), "[HOUSE FOR SALE]");
  386.         }
  387.         else if(HouseInfo[id][hOwned] == 1)
  388.         {
  389.         format(string,sizeof(string), "[HOUSE]");
  390.         }
  391.         UpdateDynamic3DTextLabelText(HouseText[id], GREEN,string);
  392.     }
  393.     return 1;
  394. }
  395. //-------------------------------------------------------------------------------------//
  396. function CreateSHouse(Float:X, Float:Y, Float:Z, price, interior)
  397. {
  398.     new string[256];
  399.     format(string, sizeof(string), "INSERT INTO Houses (EntranceX, EntranceY, EntranceZ, Price, Owner) VALUES('%f', '%f', '%f',  %i , 'None')",
  400.     X, Y, Z, price);
  401.     mysql_query(string);
  402.     mysql_query("SELECT MAX(id) FROM Houses");
  403.     mysql_store_result();
  404.     new SQL[20];
  405.     mysql_fetch_row(SQL, "|");
  406.     new id = strval(SQL);
  407.     HouseInfo[id][hPrice] = price;
  408.     HouseInfo[id][hEntranceX] = X;
  409.     HouseInfo[id][hEntranceY] = Y;
  410.     HouseInfo[id][hEntranceZ] = Z;
  411.     strmid(HouseInfo[id][hOwner], "None", 0, strlen("None"), 255);
  412.     switch(interior)
  413.     {
  414.         case 1:
  415.         {   //Large/2 story/3 bedrooms/
  416.             SetHouseDetails(id, 3    ,235.508994, 1189.169897 ,1080.339966);
  417.         }
  418.         case 2:
  419.         { //Medium/1 story/1 bedroom
  420.             SetHouseDetails(id,2,    225.756989, 1240.000000, 1082.149902);
  421.         }
  422.         case 3:
  423.         { //Small/1 story/1 bedroom
  424.             SetHouseDetails(id, 1,   223.043991 , 1289.259888, 1082.199951);
  425.         }
  426.         case 4:
  427.         { //VERY Large/2 story/4 bedrooms
  428.             SetHouseDetails(id, 7,   225.630997, 1022.479980, 1084.069946 );
  429.         }
  430.         case 5:
  431.         { //Small/1 story/2 bedrooms
  432.             SetHouseDetails(id, 15,  295.138977, 1474.469971, 1080.519897);
  433.         }
  434.         case 6:
  435.         { //Small/1 story/2 bedrooms
  436.             SetHouseDetails(id, 15,  328.493988, 1480.589966, 1084.449951 );
  437.         }
  438.     }
  439.     SaveSHouse(id);
  440.     HouseInfo[id][hPickup] = CreateDynamicPickup(1273, 1, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]);
  441.     HouseText[id] = CreateDynamic3DTextLabel("[HOUSE FOR SALE]", GREEN, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]+0.75, 75.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 75.0);
  442.     return 1;
  443. }
  444. //-------------------------------------------------------------------------------------//
  445. function SetHouseDetails(id, interiorid, Float:X, Float:Y, Float:Z)
  446. {
  447.     HouseInfo[id][hInterior] = interiorid;
  448.     HouseInfo[id][hExitX] = X;
  449.     HouseInfo[id][hExitY] = Y;
  450.     HouseInfo[id][hExitZ] = Z;
  451.     SaveSHouse(id);
  452. }
  453. //-------------------------------------------------------------------------------------//
  454. function SaveSHouse(id)
  455. {
  456.     new string[256];
  457.     format(string, sizeof(string), "UPDATE Houses SET EntranceX='%f',EntranceY='%f',EntranceZ='%f', \
  458.     Interior= %i,ExitX='%f',ExitY='%f',ExitZ='%f', Price= %i,Owner='%s',Owned= %i ,Open= %i WHERE id = %i ",
  459.     HouseInfo[id][hEntranceX],HouseInfo[id][hEntranceY],HouseInfo[id][hEntranceZ],
  460.     HouseInfo[id][hInterior],HouseInfo[id][hExitX],HouseInfo[id][hExitY],
  461.     HouseInfo[id][hExitZ],HouseInfo[id][hPrice],HouseInfo[id][hOwner],
  462.     HouseInfo[id][hOwned], HouseInfo[id][hOpen], id);
  463.     mysql_query(string);
  464. }
  465. //-------------------------------------------------------------------------------------//
  466. function IsPlayerNearByHouse(playerid)
  467. {
  468.     for(new id = 0; id < sizeof(HouseInfo); id++)
  469.     {
  470.         if(IsPlayerInRangeOfPoint(playerid, 5.0, HouseInfo[id][hEntranceX], HouseInfo[id][hEntranceY], HouseInfo[id][hEntranceZ]))
  471.         {
  472.             return id;
  473.         }
  474.     }
  475.     return -1;
  476. }
  477. //-------------------------------------------------------------------------------------//
  478. stock GetPlayerNameRP(playerid)
  479. {
  480.     new player[MAX_PLAYER_NAME];
  481.     GetPlayerName(playerid, player, sizeof(player));
  482.     for(new i = 0; i < MAX_PLAYER_NAME; i++)
  483.     {
  484.         if (player[i] == '_') player[i] = ' ';
  485.     }
  486.     return player;
  487. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement