Advertisement
Guest User

dasasfasdsa

a guest
Sep 23rd, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.83 KB | None | 0 0
  1. CMD:test(playerid, params[])
  2. {
  3. if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "Nu poti folosi nicio comanda pentru ca nu esti logat.");
  4. if(IsPlayerConnected(playerid))
  5. {
  6. if(IsAMember(playerid))
  7. {
  8. new x = PlayerInfo[playerid][pMember],string[256],cashdeposit;
  9. x = PlayerInfo[playerid][pMember];
  10. new oldbalance = DynamicFactions[x][fBank];
  11. new oldbalance1 = DynamicFactions[x][fBank];
  12. new x_nr[70],drugsam,sendername[30],matsam;
  13. if(IsPlayerInRangeOfPoint(playerid,50.0,DynamicFactions[x][fcX],DynamicFactions[x][fcY],DynamicFactions[x][fcZ]))
  14. {
  15. if(sscanf(params, "s[70]", x_nr))
  16. {
  17. SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
  18. format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  19. SendClientMessage(playerid, COLOR_GREY, string);
  20. return 1;
  21. }
  22. if(strcmp(x_nr,"money",true) == 0)
  23. {
  24. if(sscanf(params, "d", cashdeposit))
  25. {
  26. SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
  27. format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  28. SendClientMessage(playerid, COLOR_GREY, string);
  29. return 1;
  30. }
  31. if(GetPlayerCash(playerid) >= cashdeposit)
  32. {
  33. DynamicFactions[x][fBank] += cashdeposit;
  34. GivePlayerCash(playerid, -cashdeposit);
  35. Update(playerid,pCashx);
  36. new str[184];
  37. mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Bank`='%d' WHERE `ID`='%d'",DynamicFactions[x][fBank],x);
  38. mysql_tquery(SQL,str,"","");
  39. SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
  40. format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  41. SendClientMessage(playerid, COLOR_GREY, string);
  42. format(string, sizeof(string), "%s deposits $%s in their group safe.",PlayerInfo[playerid][pNormalName],FormatNumber(cashdeposit));
  43. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  44. format(string, sizeof(string), "Faction manager %s deposited $%s in group safe.", PlayerInfo[playerid][pNormalName],FormatNumber(cashdeposit));
  45. SendRadioMessage(x, COLOR_LEADER, string);
  46. return 1;
  47. }
  48. else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that amount of money with you.");
  49. }
  50. if(strcmp(x_nr,"materials",true) == 0)
  51. {
  52. if(sscanf(params, "d", matsam))
  53. {
  54. SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
  55. format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  56. SendClientMessage(playerid, COLOR_GREY, string);
  57. return 1;
  58. }
  59. if(matsam <= PlayerInfo[playerid][pMats])
  60. {
  61. PlayerInfo[playerid][pMats] =PlayerInfo[playerid][pMats]-matsam;
  62. DynamicFactions[x][fMats] +=matsam;
  63. PlayerInfo[playerid][pCommands]++;
  64. Update(playerid,pCommandsx);
  65. new str[256];
  66. mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Commands`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pCommands],PlayerInfo[playerid][pNormalName]);
  67. mysql_tquery(SQL,str,"","");
  68. format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  69. SendClientMessage(playerid, COLOR_GREY, string);
  70. format(string, sizeof(string), "You have deposited %d materials in your group safe.", matsam);
  71. SendClientMessage(playerid, COLOR_WHITE, string);
  72. format(string, sizeof(string), "%s deposits %d materials in their group safe.",PlayerInfo[playerid][pNormalName],matsam);
  73. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  74. mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Mats`='%d' WHERE `ID`='%d'",DynamicFactions[x][fMats],x);
  75. mysql_tquery(SQL,str,"","");
  76. mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Materials`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pMats],PlayerInfo[playerid][pNormalName]);
  77. mysql_tquery(SQL,str,"","");
  78. return 1;
  79. }
  80. else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much materials on you.");
  81. }
  82. if(strcmp(x_nr,"drugs",true) == 0)
  83. {
  84. if(sscanf(params, "d", drugsam))
  85. {
  86. SendClientMessage(playerid, COLOR_WHITE, SYNTAX_MESSAGE"/gdeposit [money, materials or drugs] [amount]");
  87. format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  88. SendClientMessage(playerid, COLOR_GREY, string);
  89. return 1;
  90. }
  91. if(drugsam <= PlayerInfo[playerid][pDrugs])
  92. {
  93. PlayerInfo[playerid][pDrugs] =PlayerInfo[playerid][pDrugs]-drugsam;
  94. DynamicFactions[x][fDrugs] +=drugsam;
  95. format(string, sizeof(string), "Safe balance: $%s, %d materials, %d grams of drugs.", FormatNumber(DynamicFactions[x][fBank]), DynamicFactions[x][fMats], DynamicFactions[x][fDrugs]);
  96. SendClientMessage(playerid, COLOR_GREY, string);
  97. format(string, sizeof(string), "You have deposited %d materials in your group safe.", drugsam);
  98. SendClientMessage(playerid, COLOR_WHITE, string);
  99. format(string, sizeof(string), "%s deposits %d grams of drugs in their group safe.",PlayerInfo[playerid][pNormalName],drugsam);
  100. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  101. new str[184];
  102. mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Drugs`='%d' WHERE `ID`='%d'",DynamicFactions[x][fDrugs],x);
  103. mysql_tquery(SQL,str,"","");
  104. mysql_format(SQL,str,sizeof(str),"UPDATE users SET `Drugs`='%d' WHERE `name`='%s'",PlayerInfo[playerid][pDrugs],PlayerInfo[playerid][pNormalName]);
  105. mysql_tquery(SQL,str,"","");
  106. return 1;
  107. }
  108. else return SendClientMessage(playerid, COLOR_WHITE, "You don't have that much grams of drugs on you.");
  109. }
  110. }
  111. else return SendClientMessage(playerid, COLOR_ERROR, "This command can only be used by in your HQ.");
  112. }
  113. }
  114. return 1;
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement