Author Topic: Tax Command  (Read 2766 times)

0 Members and 1 Guest are viewing this topic.

Offline kitt85711

  • Wiseguy
  • **
  • Posts: 72
    • View Profile
Tax Command
« on: July 23, 2011, 01:05:10 pm »
I wanted to make a tax command but theirs some problems with it, I dont know what to add in the script or delete. I want to make it so when I or any other admin taxes someone it takes peoples money and sends it to us. This is what I done so far.

Quote
}
   else if (strcmp(cmd, "tax", true) == 0) {
      new szMsg[256], plr;
      tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else if(!IsPlayerCommandLevel(playerid,"jail")) SendClientMessage(playerid, COLOR_RED, "You don't have access to use this command!");
      else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c tax [Nick/ID]");
        else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
        else {
         format(szMsg,sizeof(szMsg),"%s has taxed %s for $%d dollars",gPlayers[playerid],gPlayers[plr], GetPlayerHandCash(gPlayers[playerid]));
         SendClientMessageToAll(COLOR_YELLOW,szMsg);
            DecPlayerHandCash(playerid,GetPlayerHandCash(gPlayers[playerid]));

      }
      return 1;

And another tax was /c btax so it taxes someone from their bank.

Quote
}
   else if (strcmp(cmd, "btax", true) == 0) {
      new szMsg[256], plr;
      tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else if(!IsPlayerCommandLevel(playerid,"jail")) SendClientMessage(playerid, COLOR_RED, "You don't have access to use this command!");
      else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c btax [Nick/ID]");
        else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
        else {
         format(szMsg,sizeof(szMsg),"%s has bank taxed %s for $%d dollars",gPlayers[playerid],gPlayers[plr], GetPlayerHandCash(gPlayers[playerid]));
         SendClientMessageToAll(COLOR_YELLOW,szMsg);
            DecPlayerBankCash(playerid,GetPlayerBankCash(gPlayers[playerid]));
        }
      return 1;

I need help because when I tax myself it takes all my money. I want it so I can /c tax (Id) (amount)
The bank tax kind of works but it still takes all my money in my bank. Can someone help please?  :D

P.S. I know u have to add something where it says tmp=(what ever) but I dont know what to add because I know tmp is the one where u can make commands like say /c drown the command has to be /c drown (id) (reason) if the tmp is changed it can just make it /c drown (id) without the reason.

Offline heekz.shadow

  • LU testers
  • Made Man
  • *
  • Posts: 249
    • View Profile
Re: Tax Command
« Reply #1 on: August 01, 2011, 12:24:07 pm »

* heekz.shadow triple facepalms.

DecPlayerHandCash(playerid,GetPlayerHandCash(gPlayers[playerid]));

Are you sure?


Did you ever noticed you delete all his cash?

Look at "setgravity" command in gups and you take the value sistem..
Look..

You need to define the value.. /c tax [NICK/ID][VALUE]

There must be something like this in gups and I'm sure there is. Too lazy to check because I'm not at my home :P

« Last Edit: August 01, 2011, 03:44:26 pm by StriKe »
Code: [Select]
[20:23] <habi> later only i heard that lu chatbox is customizable. On my first visit, it appeared ugly.
[20:23] <habi> May be that also be the reason why lu has no players

yazeen

  • Guest
Re: Tax Command
« Reply #2 on: August 01, 2011, 03:54:15 pm »
Lmao Shadow.. Don't Treat newbies like that once all were like that

@Kittrell

Hand cash Tax:
[pawn]}
   else if (strcmp(cmd, "tax", true) == 0) {
      new szMsg[256], plr;
      tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else if ( !IsNumeric( tmp ) ) SendClientMessage( playerid, COLOR_YELLOW, "Error: Amount Should be Number!" );
      else if(!IsPlayerCommandLevel(playerid,"tax")) SendClientMessage(playerid, COLOR_RED, "You don't have access to use this command!");
      else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c tax [Nick/ID] [Amount]");
        else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
        else {
         format(szMsg,sizeof(szMsg),"%s has taxed %s for $%d dollars",gPlayers[playerid],gPlayers[plr], tmp);
         SendClientMessageToAll(COLOR_YELLOW,szMsg);
            DecPlayerHandCash(playerid,tmp);

      }
      return 1;

}[/pawn]

Bank Tax Command

 [pawn]  else if (strcmp(cmd, "btax", true) == 0) {
      new szMsg[256], plr;
      tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
      if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
      else if ( !IsNumeric( tmp ) ) SendClientMessage( playerid, COLOR_YELLOW, "Error: Amount Should be Number!" );
      else if(!IsPlayerCommandLevel(playerid,"tax")) SendClientMessage(playerid, COLOR_RED, "You don't have access to use this command!");
      else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c btax [Nick/ID] [Amount]");
        else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
        else {
         format(szMsg,sizeof(szMsg),"%s has taxed %s for $%d dollars",gPlayers[playerid],gPlayers[plr], tmp);
         SendClientMessageToAll(COLOR_YELLOW,szMsg);
            DecPlayerBankCash(playerid,tmp);

      }
      return 1;
}[/pawn]

Havent Tested but im pretty sure it works.. so, be sure you backup your scripts before your add it to your script
Hope it helps and enjoy  8)

Offline heekz.shadow

  • LU testers
  • Made Man
  • *
  • Posts: 249
    • View Profile
Re: Tax Command
« Reply #3 on: August 02, 2011, 09:52:32 am »
Err.. ?? How did I made him feel bad? Facepalming myself?
Code: [Select]
[20:23] <habi> later only i heard that lu chatbox is customizable. On my first visit, it appeared ugly.
[20:23] <habi> May be that also be the reason why lu has no players

Offline kitt85711

  • Wiseguy
  • **
  • Posts: 72
    • View Profile
Re: Tax Command
« Reply #4 on: August 04, 2011, 08:56:49 am »
Thanks yazeen, shadow lol you may think I failed but at lease I tried on my own I knew it couldn't be a "plr"