Advertisement
Guest User

Untitled

a guest
Jul 31st, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.99 KB | None | 0 0
  1. CMD:createhouse( playerid, params[] ) {
  2. if( PlayerInfo[playerid][pAdmin] < 6 ) return true;
  3.  
  4. new ivInt, Float:IntPos[3], inter, Float:pX, Float:pY, Float:pZ, string[128], query[500], text, sendername[25];
  5. if( sscanf( params, "i", text ) )
  6. return SCM( playerid, COLOR_GREY, "Syntax: {FFFFFF}/createhouse <Size - 0/1/2> 0 = small, 1 = medium, 2 = big");
  7. if(text >= 3) return SendClientMessage(playerid, COLOR_ERROR, "Unknown Size");
  8. GetPlayerPos(playerid, pX, pY, pZ);
  9. SetPVarFloat(playerid, "pHeX", pX);
  10. SetPVarFloat(playerid, "pHeY", pY);
  11. SetPVarFloat(playerid, "pHeZ", pZ);
  12. if(text == 0)
  13. {
  14. ivInt = random(5);
  15. if(ivInt == 0)IntPos[0] = 223.20, IntPos[1] = 1287.08, IntPos[2] = 1082.14, inter = 1;
  16. else if(ivInt == 1)IntPos[0] = 2283.04, IntPos[1] = -1140.28, IntPos[2] = 1050.90, inter = 11;
  17. else if(ivInt == 2)IntPos[0] = 446.90, IntPos[1] = 506.35, IntPos[2] = 1001.42, inter = 12;
  18. else if(ivInt == 3)IntPos[0] = 328.05, IntPos[1] = 1477.73, IntPos[2] = 1084.44, inter = 15;
  19. else if(ivInt == 4)IntPos[0] = 223.20, IntPos[1] = 1287.08, IntPos[2] = 1082.14, inter = 1;
  20. else if(ivInt == 5)IntPos[0] = -42.59, IntPos[1] = 1405.47, IntPos[2] = 1084.43, inter = 8;
  21. }
  22. else if(text == 1)
  23. {
  24. ivInt = random(5)+6;
  25. if(ivInt == 6)IntPos[0] = 235.34, IntPos[1] = 1186.68, IntPos[2] = 1080.26, inter = 3;
  26. else if(ivInt == 7)IntPos[0] = 24.04, IntPos[1] = 1340.17, IntPos[2] = 1084.38, inter = 10;
  27. else if(ivInt == 8)IntPos[0] = -283.44, IntPos[1] = 1470.93, IntPos[2] = 1084.38, inter = 15;
  28. else if(ivInt == 9)IntPos[0] = -260.49, IntPos[1] = 1456.75, IntPos[2] = 1084.37, inter = 4;
  29. else if(ivInt == 10)IntPos[0] = 377.15, IntPos[1] = 1417.41, IntPos[2] = 1081.33, inter = 15;
  30. }
  31. else if(text == 2)
  32. {
  33. ivInt = random(5)+11;
  34. if(ivInt == 11)IntPos[0] = 2324.53, IntPos[1] = -1149.54, IntPos[2] = 1050.71, inter = 12;
  35. else if(ivInt == 12)IntPos[0] = 1260.64, IntPos[1] = -785.37, IntPos[2] = 1091.91, inter = 5;
  36. else if(ivInt == 13)IntPos[0] = 140.17, IntPos[1] = 1366.07, IntPos[2] = 1083.65, inter = 5;
  37. else if(ivInt == 14)IntPos[0] = 234.19, IntPos[1] = 1063.73, IntPos[2] = 1084.21, inter = 6;
  38. else if(ivInt == 15)IntPos[0] = 225.68, IntPos[1] = 1021.45, IntPos[2] = 1084.02, inter = 7;
  39. else if(ivInt == 16)IntPos[0] = 226.30, IntPos[1] = 1114.24, IntPos[2] = 1080.99, inter = 5;
  40. }
  41.  
  42. new i = housess+1;
  43. mysql_format(SQL, query, sizeof(query), "INSERT INTO houses (Owner, Lockk, Hel, Arm, Level, Rentabil, Rent, Owned, Discription, Value, Takings) VALUES('AdmBot', '0', '0', '0', '10', '1', '500', '0', 'House', '10000000', '0')");
  44. mysql_tquery(SQL, query, "", "");
  45.  
  46. HouseInfo[hID] = i;
  47. HouseInfo[hEntrancex] = GetPVarFloat(playerid, "pHeX");
  48. HouseInfo[hEntrancey] = GetPVarFloat(playerid, "pHeY");
  49. HouseInfo[hEntrancez] = GetPVarFloat(playerid, "pHeZ");
  50. HouseInfo[hExitx] = IntPos[0];
  51. HouseInfo[hExity] = IntPos[1];
  52. HouseInfo[hExitz] = IntPos[2];
  53. format(HouseInfo[hOwner], 64, "AdmBot");
  54. format(HouseInfo[hDiscription], 64, "House");
  55. HouseInfo[hValue] = 5000000;
  56. HouseInfo[hHel] = 0;
  57. HouseInfo[hInterior] = inter;
  58. HouseInfo[hLock] = 0;
  59. HouseInfo[hOwned] = 0;
  60. HouseInfo[hRent] = 10000;
  61. HouseInfo[hRentabil] = 1;
  62. HouseInfo[hTakings] = 0;
  63. HouseInfo[hLevel] = 10;
  64. HouseInfo[hVirtual] = housess+1;
  65.  
  66. mysql_format(SQL, query, sizeof(query), "UPDATE `houses` SET `Entrancex`='%f',`Entrancey`='%f',`Entrancez`='%f',`Exitx`='%f',`Exity`='%f',`Exitz`='%f',`Interior`='%d',`Virtual`='%d',`Value`='%d',`Level`='%d' WHERE `ID`='%d'",HouseInfo[hEntrancex],HouseInfo[hEntrancey],HouseInfo[hEntrancez],HouseInfo[hExitx],HouseInfo[hExity],HouseInfo[hExitz],HouseInfo[hInterior],HouseInfo[hVirtual],HouseInfo[hValue],HouseInfo[hLevel],i);
  67. mysql_tquery(SQL, query, "", "");
  68. mysql_format(SQL, query, sizeof(query), "UPDATE `houses` SET `Entrancex`='%f',`Entrancey`='%f',`Entrancez`='%f',`Exitx`='%f',`Exity`='%f',`Exitz`='%f',`Interior`='%d',`Virtual`='%d' WHERE `ID`='%d'", HouseInfo[hEntrancex], HouseInfo[hEntrancey], HouseInfo[hEntrancez], HouseInfo[hExitx], HouseInfo[hExity], HouseInfo[hExitz], HouseInfo[hInterior], HouseInfo[hVirtual], i);
  69. mysql_tquery(SQL, query, "", "");
  70.  
  71. if(ivInt >= 0 && ivInt <=5)
  72. {
  73. mysql_format(SQL, query, sizeof(query), "UPDATE `houses` SET `InteriorType` = 0 WHERE `ID`='%d'",i);
  74. mysql_tquery(SQL,query,"","");
  75. HouseInfo[hInteriorType] = 0;
  76. }
  77. else if(ivInt >= 6 && ivInt <=10)
  78. {
  79. mysql_format(SQL, query, sizeof(query), "UPDATE `houses` SET `InteriorType` = 1 WHERE `ID`='%d'",i);
  80. mysql_tquery(SQL,query,"","");
  81. HouseInfo[hInteriorType] = 1;
  82. }
  83. else if(ivInt >= 11 && ivInt <=16)
  84. {
  85. mysql_format(SQL, query, sizeof(query), "UPDATE `houses` SET `InteriorType` = 2 WHERE `ID`='%d'",i);
  86. mysql_tquery(SQL,query,"","");
  87. HouseInfo[hInteriorType] = 2;
  88. }
  89. OnPropTextdrawUpdate(1,i);
  90. SetPlayerInterior(playerid, 0);
  91. SetPlayerVirtualWorld(playerid, 0);
  92. SetPlayerPos(playerid, HouseInfo[hEntrancex], HouseInfo[hEntrancey], HouseInfo[hEntrancez]);
  93. housess++;
  94. format(string,sizeof(string),"[Casa] %d a fost creata cu succes.!",i);
  95. SendClientMessage(playerid, COLOR_YELLOW, string);
  96. GetPlayerName(playerid, sendername, sizeof(sendername));
  97. format(string, sizeof(string), "[Admin] %s: a creat o noua casa ID %d", sendername, i);
  98. ABroadCast(COLOR_ADMCHAT, string, 1);
  99. return true;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement