/refund cmd
#1

pawn Код:
CMD:refund(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4)
    {

        new giveplayerid;
        if(sscanf(params, "udd", giveplayerid))
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /refund [playerid]");
            return 1;
        }

        if(IsPlayerConnected(giveplayerid))
        {
            {
                    PlayerInfo[giveplayerid][pLevel] = 5;
                    SetPlayerScore(giveplayerid, PlayerInfo[giveplayerid][pLevel]);
                    PlayerInfo[giveplayerid][pAccount] = 1000000;
                    PlayerInfo[giveplayerid][pMats] = 10000;
                    PlayerInfo[giveplayerid][pPot] = 100;
                    PlayerInfo[giveplayerid][pCrack] = 100;
            }
            SendClientMessageEx(giveplayerid, COLOR_GRAD1, "You have refunded by Admin %d ", GetPlayerName(playerid));
        }
    }
    return 1;
}
how now?
Reply
#2

How what? It'd be better if you say what fails/what you want... Just saying.

P.S. If it isn't working, replace whole thing with this..

pawn Код:
CMD:refund(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4)
    {

        new giveplayerid;
        if(sscanf(params, "u", giveplayerid))
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /refund [playerid]");
            return 1;
        }

        if(IsPlayerConnected(giveplayerid))
        {
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            PlayerInfo[giveplayerid][pLevel] = 5;
            SetPlayerScore(giveplayerid, PlayerInfo[giveplayerid][pLevel]);
            PlayerInfo[giveplayerid][pAccount] = 1000000;
            PlayerInfo[giveplayerid][pMats] = 10000;
            PlayerInfo[giveplayerid][pPot] = 100;
            PlayerInfo[giveplayerid][pCrack] = 100;
            SendClientMessageEx(giveplayerid, COLOR_GRAD1, "You have been refunded by Administrator %s ", name);
            return 1;
        }
        else return SendClientMessage(playerid, COLOR_WHITE, "Player is not connected.");
    }
    else return SendClientMessage(playerid, COLOR_WHITE, "You're not an administrator.");
}
Now some tips...

For strings like names, use %s and not %d..
Only open new loops if have a statment, not just opening and closing brakets for no reason, and if you remove a statment, remove its brakets and returns.
When using sscanf, "u" is for ID, no need of the "dd" you had there.
To format a name as string, you should define it as for example "new name[MAX_PLAYER_NAME];", than get it, "GetPlayerName(playerid, name, sizeof(Name));", and than you can use it..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)