givecash cmd not working
#3

Add this stock where all the other stocks or publics are:

pawn Код:
stock PlayerName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    for(new i = 0; i < MAX_PLAYER_NAME; i++)
    {
        if(name[i] == '_') name[i] = ' ';
    }
    return name;
}
Then replace your code with this:

pawn Код:
dcmd_givecash(playerid, params[])
{
    new pID, value, string[128];
    if(sscanf(params, "ui", pID, value)) return SendClientMessage(playerid, COLOR_CMDUSAGE, "USAGE : /givecash [playerid/Part of name] [amount]");
    if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Error : Invalid ID");
    if(value > GetPlayerMoney(playerid)) return SendClientMessage(playerid, -1, "You Dont Have That Much Cash");
    if(pID == playerid) return SendClientMessage(playerid, -1, "That's You, You IDIOT");
    if(value<0) return 0;
    if(GetPlayerScore(playerid) == 0 && value >0) return SendClientMessage(playerid, -1, "You Need Atleast level 1 to givecash");
    format(string, sizeof(string), "You transfered $%i to %s (%i)", value, PlayerName(pID), pID);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "You got $%i by %s (%i)", value, PlayerName(playerid), playerid);
    SendClientMessage(pID, COLOR_YELLOW, string);
    GivePlayerMoney(pID, value);
    GivePlayerMoney(playerid, -value);
    return 1;
}
Post me line 5 of your game mode and I'll fix that warning too.
Reply


Messages In This Thread
givecash cmd not working - by Strapz - 14.09.2013, 20:00
Re: givecash cmd not working - by zrelly - 14.09.2013, 20:09
Re: givecash cmd not working - by AphexCCFC - 15.09.2013, 04:10

Forum Jump:


Users browsing this thread: 1 Guest(s)