Guest User

Untitled

a guest
Sep 5th, 2010
718
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. #define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #define TAX_TIME 5000
  7. #define TAX_AMMOUNT 6 // 6 is 1/6th of the players money
  8.  
  9. forward TaxTimer(playerid);
  10. #if defined FILTERSCRIPT
  11.  
  12. public OnFilterScriptInit()
  13. {
  14. print("\n--------------------------------------");
  15. print(" Tax System by MRCOOLBALLS");
  16. print("--------------------------------------\n");
  17. SetTimer("TaxTimer",TAX_TIME,true);
  18. return 1;
  19. }
  20.  
  21. public OnFilterScriptExit()
  22. {
  23. return 1;
  24. }
  25.  
  26. #else
  27.  
  28. main()
  29. {
  30. print("\n----------------------------------");
  31. print(" Blank Gamemode by your name here");
  32. print("----------------------------------\n");
  33. }
  34.  
  35. #endif
  36. public OnPlayerCommandText(playerid, cmdtext[])
  37. {
  38. new cmd[256];
  39. new idx;
  40. cmd = strtok(cmdtext, idx);
  41. if(strcmp(cmd,"/settax",true) == 0)
  42. {
  43. if(IsPlayerAdmin(playerid))
  44. {
  45. new tmp[256];
  46. tmp = strtok(cmdtext, idx);
  47. if(!strlen(tmp)) return SendClientMessage(playerid,0x33CCFFAA,"USAGE: /settax [AMMOUNT] (example: 8 will be 1/8th of the players cash");
  48. new ammount;
  49. ammount = strval(tmp);
  50. SetPVarInt(playerid,"Ammount",ammount);
  51. }
  52. else
  53. {
  54. SendClientMessage(playerid,0x33CCFFAA,"You cannot use this command!");
  55. return 1;
  56. }
  57.  
  58. }
  59. return 0;
  60. }
  61. public TaxTimer(playerid)
  62. {
  63. if(GetPlayerMoney(playerid) <= 100) return 0;
  64. new ammount = GetPlayerMoney(playerid)/GetPVarInt(playerid,"ammount");// put here _TAX_AMMOUNT instead of ammount if you dont want to set it in-game
  65. GivePlayerMoney(playerid,-ammount);
  66. new str[128];
  67. format(str,sizeof(str),"You have just paid $%d in tax",ammount); SendClientMessage(playerid,0x33CCFFAA,str);
  68. return 1;
  69. }
  70. strtok(const string[], &index)
  71. {
  72. new length = strlen(string);
  73. while ((index < length) && (string[index] <= ' '))
  74. {
  75. index++;
  76. }
  77. new offset = index;
  78. new result[20];
  79. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  80. {
  81. result[index - offset] = string[index];
  82. index++;
  83. }
  84. result[index - offset] = EOS;
  85. return result;
  86. }
Advertisement
Add Comment
Please, Sign In to add comment