SetPlayerScore
#1

Hi Everyone,

I need a command to set players score.
I'm using DCMD.
If someone can help me it will be great .
Reply
#2

just use SetPlayerScore
Reply
#3

It's simple to say.
I want that when I write /setscore it's will show me for example: Usage: /setscore [PlayerID] [Score].
and when I write the ID and the score i want it will change it.
Maybe if it's possible, will be better if it's will be in dialog.
Reply
#4

Someone?
Reply
#5

Do you use/know sscanf plugin? Then I can make one for you.
Reply
#6

Yes I'm using sscanf plugin.
Reply
#7

Can you make it for me?
Reply
#8

pawn Код:
new Player, Score;
if(IsPlayerConnected(playerid) && IsPlayerConnected(Player))
{
    if(sscanf(cmdtext, "ui", Player, Score))
    {
        SendClientMessage(playerid, CHANGECOLOR, "Usage: /setscore [playerid/playername] [score]");
    }
    else if(Score < 0)
    {
        SendClientMessage(playerid, CHANGECOLOR, "Usage: Invalid score");
    }
    else if(Player == INVALID_PLAYER_ID)
    {
        SendClientMessage(playerid, CHANGECOLOR, "Usage: Invalid playerid");
    }
    else
    {
        SetPlayerScore(Player, Score);
    }
    return 1;
}
Just put in the dcmd and also change cmdtext to whatever dcmd uses, change the colors too...
Reply
#9

pawn Код:
dcmd_setplayerscore(playerid, params[])
{
        //If you use enums, then use this line or else just keep IsPlayerAdmin.
        if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
        {
            new toplayerid, score;
            if(!sscanf(params,"ii",toplayerid,score))
            {
                if(IsPlayerConnected(toplayerid))
                {
                    new names[MAX_PLAYER_NAME], msg[64];
                    GetPlayerName(playerid, names, sizeof(names));
                    format(msg,sizeof(msg),"Administrator %s set your score to %i.",names,score);
                    SetPlayerScore(toplayerid, score);
                    SendClientMessage(toplayerid, 0xCCFFCCFF, msg);
                    PlayerPlaySound(toplayerid, 1057,0,0,0);

                    GetPlayerName(toplayerid, names, sizeof(names));
                    format(msg,sizeof(msg),"You have set %s's score to %i.",names,score);
                    SendClientMessage(playerid, 0x00FF00FF, msg);
                   
                } else return SendClientMessage(playerid, 0xFF0000FF, "Error: Player is offline.");
            } else return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /SETPLAYERSCORE [Player ID] [Score]");
        } else return SendClientMessage(playerid, 0xFF0000FF, "You are not authorized to use this command.");
        return true;
}
Untested.
Reply
#10

Thanks a lot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)