givecash command not working
#6

First of all you dont have [MAX_PLAYERS] or [24] behind giveplayer id.
Need to look like this

pawn Код:
new giveplayerid[24],
new ammount,
Then you need
pawn Код:
tmp = strtok(cmdtext, idx);

oke.. here is my code.
pawn Код:
dcmd_givemoney(playerid,params[])
{
    new pName[24], str[128], string[128], string2[128];
    GetPlayerName(playerid, pName, sizeof(pName));
    format(str, sizeof(str),PlayerFile,pName);

    if(!(dini_Int(str, "AdminLevel") >= 1))
    {
        SendClientMessage(playerid, COLOR_RED, "Admins Only!");
        return 1;
    }
    new player, money, tmp[256];
    money = strval(tmp);
    if(sscanf(params,"ui",player,money))
    {
            SendClientMessage(playerid, COLOR_4, "USAGE: /givemoney [PlayerID] [Ammount]");
            return 1;
    }
    if(!IsPlayerConnected(player))
    {
                SendClientMessage(playerid, COLOR_RED, "Invalid Player ID.");
                return 1;
    }
    else    {
    new name[24];
    GetPlayerName(player, name, sizeof(name));
    GivePlayerMoney(player, money);
    format(string,sizeof(string),"You gave %d$ to %s!",money, name);
    format(string2,sizeof(string2),"Admin %s gave %d$ to you!",pName,money);
    SendClientMessage(playerid,COLOR_1,string);
    SendClientMessage(player,COLOR_1,string2);
    }
    return 1;
}
Reply


Messages In This Thread
givecash command not working - by _Vortex - 08.07.2010, 00:19
Re: givecash command not working - by KJ1 - 08.07.2010, 01:04
Re: givecash command not working - by PotH3Ad - 08.07.2010, 01:17
Re: givecash command not working - by [L3th4l] - 08.07.2010, 01:23
Re: givecash command not working - by selten98 - 08.07.2010, 08:14
Re: givecash command not working - by GaGlets(R) - 08.07.2010, 13:19

Forum Jump:


Users browsing this thread: 1 Guest(s)