erewefrfwfrewq

Untitled

Nov 4th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. CMD:creategarage(playerid,params[])
  2. {
  3. if(pInfo[playerid][pAdmin] < 5) return SCM(playerid, -1, "Nu poti vedea comenzile de la acest nivel de admin!");
  4. new buyprice, IDD, tip;
  5. if(GetPlayerVehicleID(playerid) != 0) return SendClientMessage(playerid, -1, "You must be on foot to create a garage.");
  6. for (IDD = 1; IDD < MAX_GARAGES; IDD++)
  7. if (!IsValidDynamicPickup(GarageInfo[IDD][PickupID]))
  8. break;
  9. if (IDD == MAX_GARAGES) return SendClientMessage(playerid, -1, "The maximum amount of garages has been reached.");
  10. if (!IsValidDynamicPickup(GarageInfo[IDD][PickupID]))
  11. {
  12. new Float:x, Float:y, Float:z, Msg[259];
  13. GetPlayerPos(playerid, x, y, z);
  14. //edit By Andu
  15.  
  16. if(sscanf(params, "ii", tip, buyprice)) return SendClientMessage(playerid, 0xFF0000AA, "Foloseste: /creategaraj <modelid> <pret>");
  17.  
  18. if(tip < 1 || tip > 2) return SendClientMessage(playerid, 0xFF0000AA, "Model-ul pot fi de la 1 la 2");
  19.  
  20. if(tip == 1)
  21. {
  22. //GarageInfo[IDD][Intrarex] = x; GarageInfo[IDD][Intrarey] = y; GarageInfo[IDD][Intrarez] = z; GarageInfo[IDD][] = 0;
  23. GarageInfo[IDD][Owned] = 0;
  24. GarageInfo[IDD][Owner][0] = EOS;
  25. GarageInfo[IDD][eX] = x;
  26. GarageInfo[IDD][eY] = y;
  27. GarageInfo[IDD][eZ] = z;
  28. GarageInfo[IDD][Price] = buyprice;
  29. GarageInfo[IDD][GarajVirtual] = IDD;
  30. GarageInfo[IDD][Intrarex] = 2153.9072; //1
  31. GarageInfo[IDD][Intrarey] = 242.1120; //2
  32. GarageInfo[IDD][Intrarez] = 997.3860; //3
  33. OnGarage_Update(IDD);
  34. mysql_format(MySQLCon, Msg, sizeof(Msg), "INSERT INTO `garages` (IDD , eX , eY, eZ , Owner, Price, GarajVirtual, Intrarex, Intrarey, Intrarez) VALUES (%i , %f , %f, %f , '%e', %i , %i, %f , %f, %f)" , IDD, x, y, z , GarageInfo[IDD][Owner], buyprice,GarageInfo[IDD][GarajVirtual] ,GarageInfo[IDD][Intrarex], GarageInfo[IDD][Intrarey],GarageInfo[IDD][Intrarez]);
  35. mysql_tquery(MySQLCon, Msg, "","");
  36. format(Msg, sizeof(Msg), "{00FF00}You've succesfully created a garage with ID: {FFFF00}%i", IDD);
  37. SendClientMessage(playerid, -1, Msg);
  38.  
  39.  
  40. }
  41. else if(tip == 2)// mare
  42. {
  43. //GarageInfo[IDD][Intrarex] = x; GarageInfo[IDD][Intrarey] = y; GarageInfo[IDD][Intrarez] = z; GarageInfo[IDD][] = 0;
  44. GarageInfo[IDD][Owned] = 0;
  45. GarageInfo[IDD][Owner][0] = EOS;
  46. GarageInfo[IDD][eX] = x;
  47. GarageInfo[IDD][eY] = y;
  48. GarageInfo[IDD][eZ] = z;
  49. GarageInfo[IDD][Price] = buyprice;
  50. GarageInfo[IDD][GarajVirtual] = IDD;
  51. GarageInfo[IDD][Intrarex] = 2153.9072; //1
  52. GarageInfo[IDD][Intrarey] = 242.1120; //2
  53. GarageInfo[IDD][Intrarez] = 997.3860; //3
  54. OnGarage_Update(IDD);
  55. mysql_format(MySQLCon, Msg, sizeof(Msg), "INSERT INTO `garages` (IDD , eX , eY, eZ , Owner, Price, GarajVirtual, Intrarex, Intrarey, Intrarez) VALUES (%i , %f , %f, %f , '%e', %i , %i, %f , %f, %f)" , IDD, x, y, z , GarageInfo[IDD][Owner], buyprice,GarageInfo[IDD][GarajVirtual] ,GarageInfo[IDD][Intrarex], GarageInfo[IDD][Intrarey],GarageInfo[IDD][Intrarez]);
  56. mysql_tquery(MySQLCon, Msg, "","");
  57. format(Msg, sizeof(Msg), "{00FF00}You've succesfully created a garage with ID: {FFFF00}%i", IDD);
  58. SendClientMessage(playerid, -1, Msg);
  59.  
  60. }
  61. }
  62. else
  63. SendClientMessage(playerid, -1, "The maximum amount of garages has been reached");
  64.  
  65. return 1;
  66. }
  67. CMD:enter(playerid, params[])
  68. {
  69.  
  70. new vehicleid = GetPlayerVehicleID(playerid);
  71. new GarageID;
  72. for (GarageID = 1; GarageID < MAX_GARAGES; GarageID++)
  73. {
  74. if (IsValidDynamicPickup(GarageInfo[GarageID][PickupID]))
  75. {
  76. if(IsPlayerInRangeOfPoint(playerid, 1.5, GarageInfo[GarageID][eX], GarageInfo[GarageID][eY], GarageInfo[GarageID][eZ]))
  77. {
  78.  
  79. if (OnGarage_PlayerIsOwner(playerid, GarageID) == 0) return SendClientMessage(playerid, -1, "You are not the owner of this garage.");
  80.  
  81. if(IsPlayerInAnyVehicle(playerid))
  82. {
  83. PlayerGarageID[playerid] = GarageInfo[GarageID][GarajVirtual];
  84. SetVehiclePos(vehicleid, GarageInfo[GarageID][Iesirex], GarageInfo[GarageID][Iesirey], GarageInfo[GarageID][Iesirez]);
  85. SetVehicleVirtualWorld(vehicleid, GarageInfo[GarageID][GarajVirtual]); SetPlayerVirtualWorld(playerid, GarageInfo[GarageID][GarajVirtual]);
  86. return 1;
  87. }
  88. else
  89. {
  90. PlayerGarageID[playerid] = GarageInfo[GarageID][GarajVirtual];
  91. SetPlayerPos(playerid, GarageInfo[GarageID][Iesirex], GarageInfo[GarageID][Iesirey], GarageInfo[GarageID][Iesirez]);
  92. SetPlayerVirtualWorld(playerid, GarageInfo[GarageID][GarajVirtual]);
  93. return 1;
  94. }
  95. }
  96. }
  97. }
  98. return 0;
  99. }
Advertisement
Add Comment
Please, Sign In to add comment