Advertisement
Guest User

Untitled

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