Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- #define FILTERSCRIPT
- #include <a_samp>
- #define TAX_TIME 5000
- #define TAX_AMMOUNT 6 // 6 is 1/6th of the players money
- forward TaxTimer(playerid);
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Tax System by MRCOOLBALLS");
- print("--------------------------------------\n");
- SetTimer("TaxTimer",TAX_TIME,true);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- #endif
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new cmd[256];
- new idx;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd,"/settax",true) == 0)
- {
- if(IsPlayerAdmin(playerid))
- {
- new tmp[256];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) return SendClientMessage(playerid,0x33CCFFAA,"USAGE: /settax [AMMOUNT] (example: 8 will be 1/8th of the players cash");
- new ammount;
- ammount = strval(tmp);
- SetPVarInt(playerid,"Ammount",ammount);
- }
- else
- {
- SendClientMessage(playerid,0x33CCFFAA,"You cannot use this command!");
- return 1;
- }
- }
- return 0;
- }
- public TaxTimer(playerid)
- {
- if(GetPlayerMoney(playerid) <= 100) return 0;
- new ammount = GetPlayerMoney(playerid)/GetPVarInt(playerid,"ammount");// put here _TAX_AMMOUNT instead of ammount if you dont want to set it in-game
- GivePlayerMoney(playerid,-ammount);
- new str[128];
- format(str,sizeof(str),"You have just paid $%d in tax",ammount); SendClientMessage(playerid,0x33CCFFAA,str);
- return 1;
- }
- strtok(const string[], &index)
- {
- new length = strlen(string);
- while ((index < length) && (string[index] <= ' '))
- {
- index++;
- }
- new offset = index;
- new result[20];
- while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
- {
- result[index - offset] = string[index];
- index++;
- }
- result[index - offset] = EOS;
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment