Is there a way to do this without a string?
#9

Thats because your passing the playerid (the variable id) to "format" instead of the players name.
pawn Код:
CMD:givecash(playerid,params[])
{
    new
        id,
        amount;
    if(sscanf(params, "ud", id, amount)) SendClientMessage(playerid,COLOR_RED,"Usage: /givecash <ID> <Amount>");
    else if(id == INVALID_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Player Not Connected!");
    else
    {
        new
            szPName[MAX_PLAYER_NAME];
        GivePlayerMoney(id,amount);
        new str[40+MAX_PLAYER_NAME];
        GetPlayerName(id, szPName, MAX_PLAYER_NAME);
        format(str, sizeof(str), "You have sent %d to %s",amount,szPName);
        SendClientMessage(playerid, COLOR_GREEN, str);
        GetPlayerName(playerid, szPName, MAX_PLAYER_NAME);
        format(str, sizeof(str), "You have recieved %d from %s",amount,szPName);
        SendClientMessage(id, COLOR_GREEN, str);
    }
    return 1;
}
Its impossible to display a players name without using a string, because a players name IS a string.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)