Guest User

Untitled

a guest
Feb 27th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.35 KB | None | 0 0
  1. CMD:gdeposit(playerid, params[])
  2. {
  3. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
  4. if(IsPlayerConnected(playerid))
  5. {
  6. new x = PlayerInfo[playerid][pMember], string[128], cashdeposit, item[30], name[30];
  7. if(x <= 0) return 1;
  8. if(sscanf(params, "s[30]d", item, cashdeposit))
  9. {
  10. SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /gdeposit [money, materials or drugs] [amount]");
  11. format(string, sizeof(string), "Safe balance: $%d, %d materials, %d grams of drugs", DynamicFactions[x][fBank], DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  12. SendClientMessage(playerid, COLOR_GREY, string);
  13. return 1;
  14. }
  15. if(cashdeposit < 1 || cashdeposit > 2147483646) return 1;
  16. GetPlayerName(playerid, name, sizeof(name));
  17. if(IsPlayerInRangeOfPoint(playerid, 5.0, DynamicFactions[x][fSafePos][0], DynamicFactions[x][fSafePos][1], DynamicFactions[x][fSafePos][2]))
  18. {
  19. if(strcmp(item, "money", true) == 0)
  20. {
  21. if(GetPlayerCash(playerid) >= cashdeposit)
  22. {
  23. DynamicFactions[x][fBank] += cashdeposit;
  24. GivePlayerCash(playerid, -cashdeposit);
  25. Update(playerid,pCashx);
  26. format(string, sizeof(string), "You've put %s money in safe.", FormatNumber(cashdeposit));
  27. SendClientMessage(playerid, COLOR_GREY, string);
  28. format(string, sizeof(string), "Safe balance: $%d, %d materials, %d grams of drugs", DynamicFactions[x][fBank]+cashdeposit, DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  29. SendClientMessage(playerid, COLOR_GREY, string);
  30. new str[184];
  31. mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Bank`='%d' WHERE `ID`='%d'", DynamicFactions[x][fBank], x);
  32. mysql_tquery(SQL,str,"","");
  33. new varxx[256];
  34. mysql_format(SQL, varxx, sizeof(varxx), "UPDATE users SET `MoneyDeposit`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMoneyDeposit], PlayerInfo[playerid][pNormalName]);
  35. mysql_tquery(SQL,varxx,"","");
  36. return 1;
  37. }
  38. else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of money.");
  39. }
  40. else if(strcmp(item, "materials", true) == 0)
  41. {
  42. if(cashdeposit <= PlayerInfo[playerid][pMats])
  43. {
  44. PlayerInfo[playerid][pMats] = PlayerInfo[playerid][pMats]-cashdeposit;
  45. DynamicFactions[x][fMats] += cashdeposit;
  46. format(string, sizeof(string), "You've put %d materials in safe.", cashdeposit);
  47. SendClientMessage(playerid, COLOR_GREY, string);
  48. format(string, sizeof(string), "Safe balance: $%d, %d materials, %d grams of drugs", DynamicFactions[x][fBank], DynamicFactions[x][fMats]+cashdeposit, DynamicFactions[x][fDrugs]);
  49. SendClientMessage(playerid, COLOR_GREY, string);
  50. format(string, sizeof(string), "Info: {FFFFFF}Total materiale depozitate: %d", PlayerInfo[playerid][pMatsDeposit]+cashdeposit);
  51. SendClientMessage(playerid, COLOR_JMEK, string);
  52. new str[256];
  53. mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Mats`='%d' WHERE `ID`='%d'", DynamicFactions[x][fMats], x);
  54. mysql_tquery(SQL,str,"","");
  55. mysql_format(SQL,str,sizeof(str),"UPDATE `users` SET `Materials`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMats], PlayerInfo[playerid][pNormalName]);
  56. mysql_tquery(SQL,str,"","");
  57. new varxx[256];
  58. mysql_format(SQL, varxx, sizeof(varxx), "UPDATE users SET `MatsDeposit`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pMatsDeposit], PlayerInfo[playerid][pNormalName]);
  59. mysql_tquery(SQL,varxx,"","");
  60. return 1;
  61. }
  62. else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of materials.");
  63. }
  64. else if(strcmp(item, "drugs", true) == 0)
  65. {
  66. if(cashdeposit <= PlayerInfo[playerid][pDrugs])
  67. {
  68. PlayerInfo[playerid][pDrugs] = PlayerInfo[playerid][pDrugs]-cashdeposit;
  69. DynamicFactions[x][fDrugs] += cashdeposit;
  70. format(string, sizeof(string), "You've put %d drugs in safe.", cashdeposit);
  71. SendClientMessage(playerid, COLOR_GREY, string);
  72. format(string, sizeof(string), "Safe balance: $%d, %d materials, %d grams of drugs", DynamicFactions[x][fBank], DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]+cashdeposit);
  73. SendClientMessage(playerid, COLOR_GREY, string);
  74. format(string, sizeof(string), "Info: {FFFFFF}Total droguri depozitate: %d", PlayerInfo[playerid][pDrugsDeposit]+cashdeposit);
  75. SendClientMessage(playerid, COLOR_JMEK, string);
  76. new str[184];
  77. mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Drugs`='%d' WHERE `ID`='%d'", DynamicFactions[x][fDrugs], x);
  78. mysql_tquery(SQL,str,"","");
  79. mysql_format(SQL,str,sizeof(str),"UPDATE `users` SET `Drugs`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pDrugs], PlayerInfo[playerid][pNormalName]);
  80. mysql_tquery(SQL,str,"","");
  81. new varxx[256];
  82. mysql_format(SQL, varxx, sizeof(varxx), "UPDATE users SET `DrugsDeposit`='%d' WHERE `name`='%s'", PlayerInfo[playerid][pDrugsDeposit], PlayerInfo[playerid][pNormalName]);
  83. mysql_tquery(SQL,varxx,"","");
  84. return 1;
  85. }
  86. else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of drugs.");
  87. }
  88. else return SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /gdeposit [money, materials or drugs] [amount]");
  89. }
  90. else return SendClientMessage(playerid, COLOR_WHITE, "You must be at your group safe to do this.");
  91. }
  92. return 1;
  93. }
Add Comment
Please, Sign In to add comment