SetPlayerScore - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetPlayerScore (
/showthread.php?tid=272291)
SetPlayerScore -
zxc1 - 27.07.2011
Hi Everyone,
I need a command to set players score.
I'm using DCMD.
If someone can help me it will be great
.
Re: SetPlayerScore -
System64 - 27.07.2011
just use SetPlayerScore
Re: SetPlayerScore -
zxc1 - 27.07.2011
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.
Re: SetPlayerScore -
zxc1 - 27.07.2011
Someone?
Re: SetPlayerScore -
iPLEOMAX - 27.07.2011
Do you use/know sscanf plugin? Then I can make one for you.
Re: SetPlayerScore -
zxc1 - 28.07.2011
Yes I'm using sscanf plugin.
Re: SetPlayerScore -
zxc1 - 28.07.2011
Can you make it for me?
Re: SetPlayerScore -
Dr - 28.07.2011
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...
Re: SetPlayerScore -
iPLEOMAX - 28.07.2011
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.
Re: SetPlayerScore -
zxc1 - 28.07.2011
Thanks a lot.