help plz /givemoney cmd
#2

pawn Код:
if (strcmp("/givemoney", cmdtext, true, 10) == 0)
{
     new tmp[128], tmp2[128], Index;
     tmp = strtok(cmdtext,Index);
     tmp2 = strtok(cmdtext,Index);
     if(!strlen(tmp)) return SendClientMessage(playerid, -1, "Usage: /givemoney {FF0000}[Player ID] [Amount]");
     if(!strlen(tmp2)) return SendClientMessage(playerid, -1, "Usage: /givemoney [Player ID] {FF0000}[Amount]");
     new player1, cash, string[256];
     player1 = strval(tmp);
     cash = strval(tmp2);
     if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
     {
          if(player1 == playerid) return SendClientMessage(playerid, -1, "ERROR: You can't give money to yourself!");
          if(cash > GetPlayerMoney(playerid)) return SendClientMessage(playerid, -1, "ERROR: Insufficent funds!");
          if(cash < 1) return SendClientMessage(playerid, -1, "ERROR: Invalid amount (Negative or zero)");
          new name[MAX_PLAYER_NAME], name1[MAX_PLAYER_NAME], string[256];
          GetPlayerName(playerid, name, sizeof(name)); GetPlayerName(player1, name1, sizeof(name1));
          format(string, sizeof(string), "You have given %s (%d) $%d.", name1, player1, cash);
          SendClientMessage(playerid, -1, string);
          format(string, sizeof(string), "%s (%d) has given you $%d.", name, playerid, cash);
          SendClientMessage(playerid, -1, string);
          GivePlayerMoney(playerid, -cash);
          GivePlayerMoney(player1, cash);
     }
     else return SendClientMessage(playerid, -1, "ERROR: This player is not connected!");
}
Reply


Messages In This Thread
help plz /givemoney cmd - by GGW - 21.08.2013, 13:46
Re: help plz /givemoney cmd - by Dragonsaurus - 21.08.2013, 14:11
Re: help plz /givemoney cmd - by GGW - 21.08.2013, 14:26
Re: help plz /givemoney cmd - by GGW - 21.08.2013, 14:45
Re: help plz /givemoney cmd - by Dragonsaurus - 21.08.2013, 15:02

Forum Jump:


Users browsing this thread: 3 Guest(s)