gov.pwn 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. /*
  2. /$$ /$$ /$$$$$$ /$$$$$$$ /$$$$$$$
  3. | $$$ | $$ /$$__ $$ | $$__ $$| $$__ $$
  4. | $$$$| $$| $$ \__/ | $$ \ $$| $$ \ $$
  5. | $$ $$ $$| $$ /$$$$ /$$$$$$| $$$$$$$/| $$$$$$$/
  6. | $$ $$$$| $$|_ $$|______/| $$__ $$| $$____/
  7. | $$\ $$$| $$ \ $$ | $$ \ $$| $$
  8. | $$ \ $$| $$$$$$/ | $$ | $$| $$
  9. |__/ \__/ \______/ |__/ |__/|__/
  10. Government Group Type
  11. Next Generation Gaming, LLC
  12. (created by Next Generation Gaming Development Team)
  13. * Copyright (c) 2016, Next Generation Gaming, LLC
  14. *
  15. * All rights reserved.
  16. *
  17. * Redistribution and use in source and binary forms, with or without modification,
  18. * are not permitted in any case.
  19. *
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  25. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  28. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  29. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  30. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  31. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. */
  33. CMD:settax(playerid, params[])
  34. {
  35. if(!(0 <= PlayerInfo[playerid][pLeader] < MAX_GROUPS && arrGroupData[PlayerInfo[playerid][pLeader]][g_iGroupType] == GROUP_TYPE_GOV)) {
  36. SendClientMessageEx(playerid, COLOR_GREY, "You're not a Government Leader.");
  37. return 1;
  38. }
  39. new string[128], tax;
  40. if(sscanf(params, "d", tax)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /settax [percentage]");
  41. if (tax < 1 || tax > 29)
  42. {
  43. SendClientMessageEx(playerid, COLOR_GRAD2, "Percentage must be greater than 0 and below 30.");
  44. return 1;
  45. }
  46. if(arrGroupData[PlayerInfo[playerid][pLeader]][g_iAllegiance] == 1)
  47. {
  48. TaxValue = tax;
  49. Misc_Save();
  50. format(string, sizeof(string), "The SA income tax has been set to %d percent (of each paycheck).", TaxValue);
  51. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  52. }
  53. if(arrGroupData[PlayerInfo[playerid][pLeader]][g_iAllegiance] == 2)
  54. {
  55. TRTaxValue = tax;
  56. Misc_Save();
  57. format(string, sizeof(string), "The NE income tax has been set to %d percent (of each paycheck).", TRTaxValue);
  58. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  59. }
  60. return 1;
  61. }
  62. CMD:taxwithdraw(playerid, params[])
  63. {
  64. if(!(0 <= PlayerInfo[playerid][pLeader] < MAX_GROUPS && arrGroupData[PlayerInfo[playerid][pLeader]][g_iGroupType] == GROUP_TYPE_GOV))
  65. {
  66. SendClientMessageEx(playerid, COLOR_GREY, "You're not a Government Leader.");
  67. return 1;
  68. }
  69. new string[128], amount, reason[64], str[128];
  70. if(arrGroupData[PlayerInfo[playerid][pLeader]][g_iAllegiance] == 1)
  71. {
  72. if(sscanf(params, "ds[64]", amount, reason))
  73. {
  74. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /taxwithdraw [amount] [reason]");
  75. format(string, sizeof(string), "* VAULT BALANCE: $%s.", number_format(Tax));
  76. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  77. return 1;
  78. }
  79. if(amount < 0)
  80. {
  81. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Invalid amount specified.");
  82. return 1;
  83. }
  84. if( Tax > amount )
  85. {
  86. Tax -= amount;
  87. Misc_Save();
  88. GivePlayerCash( playerid, amount );
  89. format( string, sizeof( string ), "You have withdrawn $%s from the vault.", number_format(amount) );
  90. SendClientMessageEx( playerid, COLOR_WHITE, string );
  91. format(string,sizeof(string),"{AA3333}AdmWarning{FFFF00}: %s has withdrawn $%s of the SA tax money from the vault, reason: %s.",GetPlayerNameEx(playerid),number_format(amount),reason);
  92. ABroadCast( COLOR_YELLOW, string, 2);
  93. format(string,sizeof(string),"AdmWarning: %s(%d) has withdrawn $%s of the SA tax money from the vault, reason: %s.",GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), number_format(amount),reason);
  94. Log("logs/rpspecial.log", string);
  95. format(string,sizeof(string),"%s has withdrawn $%s of the SA tax money from the vault, reason: %s.",GetPlayerNameEx(playerid), number_format(amount),reason);
  96. GroupPayLog(PlayerInfo[playerid][pLeader], str);
  97. }
  98. else
  99. {
  100. SendClientMessageEx(playerid, COLOR_GREY, "Insufficient funds are available.");
  101. }
  102. }
  103. if(arrGroupData[PlayerInfo[playerid][pLeader]][g_iAllegiance] == 2)
  104. {
  105. if(sscanf(params, "ds[64]", amount, reason))
  106. {
  107. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /taxwithdraw [amount] [reason]");
  108. format(string, sizeof(string), "* VAULT BALANCE: $%s.", number_format(TRTax));
  109. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  110. return 1;
  111. }
  112. if(amount < 0)
  113. {
  114. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Invalid amount specified.");
  115. return 1;
  116. }
  117. if( TRTax > amount )
  118. {
  119. TRTax -= amount;
  120. Misc_Save();
  121. GivePlayerCash( playerid, amount );
  122. format( string, sizeof( string ), "You have withdrawn $%s from the vault.", number_format(amount) );
  123. SendClientMessageEx( playerid, COLOR_WHITE, string );
  124. format(string,sizeof(string),"{AA3333}AdmWarning{FFFF00}: %s has withdrawn $%s of the NE tax money from the vault, reason: %s.",GetPlayerNameEx(playerid),number_format(amount),reason);
  125. ABroadCast( COLOR_YELLOW, string, 2);
  126. format(string,sizeof(string),"AdmWarning: %s(%d) has withdrawn $%s of the NE tax money from the vault, reason: %s.",GetPlayerNameEx(playerid), GetPlayerSQLId(playerid), number_format(amount),reason);
  127. Log("logs/rpspecial.log", string);
  128. }
  129. else
  130. {
  131. SendClientMessageEx(playerid, COLOR_GREY, "Insufficient funds are available.");
  132. }
  133. }
  134. return 1;
  135. }
  136. CMD:taxdeposit(playerid, params[])
  137. {
  138. if(!(0 <= PlayerInfo[playerid][pLeader] < MAX_GROUPS && arrGroupData[PlayerInfo[playerid][pLeader]][g_iGroupType] == GROUP_TYPE_GOV))
  139. {
  140. SendClientMessageEx(playerid, COLOR_GREY, "You're not a Government Leader.");
  141. return 1;
  142. }
  143. new string[128], amount;
  144. if(arrGroupData[PlayerInfo[playerid][pLeader]][g_iAllegiance] == 1)
  145. {
  146. if(sscanf(params, "d", amount))
  147. {
  148. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /taxdeposit [amount]");
  149. format(string, sizeof(string), "* VAULT BALANCE: $%s.", number_format(Tax));
  150. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  151. return 1;
  152. }
  153. if(amount < 0)
  154. {
  155. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Invalid amount specified.");
  156. return 1;
  157. }
  158. if (GetPlayerCash(playerid) < amount)
  159. {
  160. SendClientMessageEx(playerid, COLOR_GREY, "You do not have that much cash on you.");
  161. return 1;
  162. }
  163. Tax += amount;
  164. Misc_Save();
  165. GivePlayerCash(playerid, -amount);
  166. format( string, sizeof( string ), "You have deposited $%s into the SA vault.", number_format(amount) );
  167. SendClientMessageEx( playerid, COLOR_WHITE, string );
  168. format(string,sizeof(string),"%s has deposited $%s into the SA tax vault.",GetPlayerNameEx(playerid), number_format(amount));
  169. GroupPayLog(PlayerInfo[playerid][pLeader], string);
  170. }
  171. if(arrGroupData[PlayerInfo[playerid][pLeader]][g_iAllegiance] == 2)
  172. {
  173. if(sscanf(params, "d", amount))
  174. {
  175. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /taxdeposit [amount]");
  176. format(string, sizeof(string), "* VAULT BALANCE: $%s.", number_format(TRTax));
  177. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  178. return 1;
  179. }
  180. if(amount < 0)
  181. {
  182. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "Invalid amount specified.");
  183. return 1;
  184. }
  185. if (GetPlayerCash(playerid) < amount)
  186. {
  187. SendClientMessageEx(playerid, COLOR_GREY, "You do not have that much cash on you.");
  188. return 1;
  189. }
  190. TRTax += amount;
  191. Misc_Save();
  192. GivePlayerCash(playerid, -amount);
  193. format( string, sizeof( string ), "You have deposited $%s into the NE vault.", number_format(amount) );
  194. SendClientMessageEx( playerid, COLOR_WHITE, string );
  195. format(string,sizeof(string),"%s has deposited $%s into the NE tax vault.",GetPlayerNameEx(playerid), number_format(amount));
  196. GroupPayLog(PlayerInfo[playerid][pLeader], string);
  197. }
  198. return 1;
  199. }
  200. CMD:settaxmoney(playerid, params[])
  201. {
  202. if(PlayerInfo[playerid][pAdmin] < 1337)
  203. {
  204. SendClientMessageEx(playerid, COLOR_GREY, "You're not authorised to use this command.");
  205. return 1;
  206. }
  207. new string[128], country, amount;
  208. if(sscanf(params, "dd", country, amount))
  209. {
  210. SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /settaxmoney [SA(1)/NE(2)] [amount]");
  211. format(string, sizeof(string), "* CURRENT SA VAULT BALANCE: $%s.", number_format(Tax));
  212. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  213. format(string, sizeof(string), "* CURRENT NE VAULT BALANCE: $%s.", number_format(TRTax));
  214. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  215. return 1;
  216. }
  217. switch(country)
  218. {
  219. case 1:
  220. {
  221. Tax = amount;
  222. format( string, sizeof( string ), "You have set the tax money amount to $%s.", number_format(amount));
  223. SendClientMessageEx( playerid, COLOR_WHITE, string );
  224. }
  225. case 2:
  226. {
  227. TRTax = amount;
  228. format( string, sizeof( string ), "You have set the tax money amount to $%s.", number_format(amount));
  229. SendClientMessageEx( playerid, COLOR_WHITE, string );
  230. }
  231. }
  232. return 1;
  233. }
  234. CMD:checktax(playerid, params[])
  235. {
  236. new string[128];
  237. if(!(0 <= PlayerInfo[playerid][pLeader] < MAX_GROUPS && arrGroupData[PlayerInfo[playerid][pLeader]][g_iGroupType] == GROUP_TYPE_GOV))
  238. {
  239. SendClientMessageEx(playerid, COLOR_GREY, "You're not a government official.");
  240. return 1;
  241. }
  242. if(arrGroupData[PlayerInfo[playerid][pLeader]][g_iAllegiance] == 1)
  243. {
  244. format(string, sizeof(string), "* CURRENT SA VAULT BALANCE: $%s.", number_format(Tax));
  245. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  246. }
  247. else if(arrGroupData[PlayerInfo[playerid][pLeader]][g_iAllegiance] == 2)
  248. {
  249. format(string, sizeof(string), "* CURRENT NE VAULT BALANCE: $%s.", number_format(TRTax));
  250. SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
  251. }
  252. return 1;
  253. }