Givecash command not working
#1

Hello everyone, I have this command where it allows other players to give other players cash.

But it doesn't work. You can type /gc in the chat and it will tell you what to do but then after that it just says unknown command.
So if I was to type /gc 2 50000 it will say unknown command.
2 = ID
50000 = amount giving to players.


pawn Код:
if((strcmp("/givecash", cmdtext, true) == 0) || (strcmp("/gc", cmdtext, true) == 0))
        {
            new id, pos, pname[MAX_PLAYER_NAME], string[128];

            if(strlen(cmdtext[10]) == 0) return SendClientMessage(playerid, red, "Use: /givecash [playerid] [ammount]");
            if((pos = strfind(cmdtext, " ", true, 10)) != -1) return SendClientMessage(playerid, red, "Use: /givecash [playerid] [ammount]");

            if(strval(cmdtext[10]) == 0)
            {
            for(new i; i < MAX_PLAYERS; i++)
            {
            GetPlayerName(i, pname, sizeof(pname));

            if(strfind(pname, cmdtext[10], true) != -1)
            {
            id = i;
            goto next;
            }
            }
            return SendClientMessage(playerid, red, "Error: player not connected");
            }
            else
            {
            id = strval(cmdtext[10]);
            }
            next:
            if(IsPlayerConnected(id) == 0) return SendClientMessage(playerid, red, "Error: player not connected");
            if(strval(cmdtext[pos + 1]) < 0 || strval(cmdtext[pos + 1]) > 1000000) return SendClientMessage(playerid, red, "Error: Invalid amount");

            GivePlayerMoney(id, strval(cmdtext[pos + 1]));
            GetPlayerName(id, pname, sizeof(pname));
            format(string, sizeof(string), "You have given %s (%d) $%d", pname, id, strval(cmdtext[pos + 1]));
            SendClientMessage(playerid, yellow, string);

            GivePlayerMoney(playerid, -strval(cmdtext[pos + 1]));
            GetPlayerName(playerid, pname, sizeof(pname));
            format(string, sizeof(string), "%s (%d) has given you $%d", pname, playerid, strval(cmdtext[pos + 1]));
            SendClientMessage(id, yellow, string);
            return 1;
        }
Reply


Messages In This Thread
Givecash command not working - by captainjohn - 10.04.2012, 19:18
Re: Givecash command not working - by Allu - 10.04.2012, 19:37
Re: Givecash command not working - by Bleach79 - 10.04.2012, 19:38
Re: Givecash command not working - by captainjohn - 10.04.2012, 20:02

Forum Jump:


Users browsing this thread: 1 Guest(s)