Guest User

Untitled

a guest
Oct 23rd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. //=====================
  2. //**********************Posa/prendi Soldi system by olliver fred************************
  3. //************************CMDS: /posasoldi, /prendisoldi*************************
  4. //**********************************;P*********************************************
  5. //=====================
  6. #include <a_samp>
  7. #include <zcmd>
  8. #include <sscanf2>
  9. //=====================
  10. #define COLOR_WHITE 0xFFFFFFAA
  11. #define COLOR_GREY 0xAFAFAFAA
  12. #define COLOR_LIGHTRED 0xFF6347AA
  13. #define COLOR_LIGHTBLUE 0x006FDD96
  14. //=====================
  15. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  16. //=====================
  17. new
  18. MoneyObject[150];
  19. //=====================
  20. enum mInfo
  21. {
  22. dType,
  23. dAmount[2],
  24. Float:dx,
  25. Float:dy,
  26. Float:dz,
  27. dWorld,
  28. };
  29. new MoneyInfo[150][mInfo];
  30. //=====================
  31. COMMAND:prendisoldi(playerid, params[])
  32. {
  33. new string[64];
  34. for(new i = 0; i < sizeof(MoneyInfo); i++)
  35. {
  36. if (PlayerToPoint(3.0,playerid,MoneyInfo[i][dx],MoneyInfo[i][dy],MoneyInfo[i][dz]))
  37. {
  38. if(MoneyInfo[i][dType] == 1)
  39. {
  40. format(string, sizeof(string), "INFO: Hai preso $%d da terra.", MoneyInfo[i][dAmount][0]);
  41. SendClientMessage(playerid,COLOR_GREY, string);
  42. GivePlayerMoney(playerid, MoneyInfo[i][dAmount][0]);
  43. MoneyInfo[i][dAmount][0] = 0;
  44. MoneyInfo[i][dType] = 0;
  45. DestroyObject(MoneyObject[i]);
  46. MoneyInfo[i][dx] = 0.0;
  47. MoneyInfo[i][dy] = 0.0;
  48. MoneyInfo[i][dz] = 0.0;
  49. return 1;
  50. }
  51. }
  52. }
  53. return 1;
  54. }
  55. //=====================
  56. COMMAND:posasoldi(playerid, params[])
  57. {
  58. new string[64],ammount;
  59. if(sscanf(params, "i", ammount)) SendClientMessage(playerid, COLOR_GREY, "USA: /posasoldi [soldi]");
  60. else
  61. {
  62. if(GetPlayerMoney(playerid) >= ammount)
  63. {
  64. for(new i = 0; i < sizeof(MoneyInfo); i++)
  65. {
  66. if(MoneyInfo[i][dx] == 0.0 && MoneyInfo[i][dy] == 0.0 && MoneyInfo[i][dz] == 0.0)
  67. {
  68. new Float:X,Float:Y,Float:Z;
  69. GetPlayerPos(playerid, X, Y, Z);
  70. MoneyInfo[i][dType] = 1;
  71. MoneyInfo[i][dAmount][0] = ammount;
  72. MoneyInfo[i][dx] = X;
  73. MoneyInfo[i][dy] = Y;
  74. MoneyInfo[i][dz] = Z;
  75. MoneyInfo[i][dWorld] = GetPlayerVirtualWorld(playerid);
  76. MoneyObject[i] = CreateObject(1550, X, Y, Z-1, 0, 0, 0);
  77. GivePlayerMoney(playerid, -ammount);
  78. format(string, sizeof(string), "INFO: Hai posato $%d in terra.", ammount);
  79. SendClientMessage(playerid,COLOR_WHITE, string);
  80. return 1;
  81. }
  82. }
  83. }
  84. else
  85. {
  86. format(string, sizeof(string), "INFO: Non hai $%d per posarli.", ammount);
  87. SendClientMessage(playerid,COLOR_LIGHTRED, string);
  88. }
  89. }
  90. return 1;
  91. }
  92. //=====================
  93. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  94. {
  95. if(IsPlayerInRangeOfPoint(playerid, radi, x, y, z))
  96. {
  97. return 1;
  98. }
  99. return 0;
  100. }
  101. //=====================FINE ù_ù=============================================
Add Comment
Please, Sign In to add comment