/sharescore - 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)
+--- Thread: /sharescore (
/showthread.php?tid=388865)
/sharescore -
Blackazur - 30.10.2012
HOw can i make a /sharescore Command that players can share xp with other players like /sharexp id amount and that then in chat come a message like: "Player X has shared X XP to Player X."
AW: /sharescore -
Skimmer - 30.10.2012
Do you have DCMD in your script ? When not i'll script on my screen for you.
AW: /sharescore -
Blackazur - 30.10.2012
No i use ZCMD and sscanf.
AW: /sharescore -
Skimmer - 30.10.2012
You mean this ?
Код:
COMMAND:sharescore(playerid, params[])
{
new pid, score;
if(sscanf(params, "us", pid, score)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /sharescore <playerid> <score>");
// if(IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "This command is only for admins.");
new string[128], pName[MAX_PLAYER_NAME], sName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(pID, sName, sizeof(sName));
format(string, sizeof(string), "Player %s has shared %d XP to Player %s", pName, score, sName);
SendClientMessageToAll(/*your color*/ -1, string);
SetPVarInt(pID, "XP", GetPVarInt(pID, "XP") + score);
}
Re: /sharescore -
RedFusion - 30.10.2012
Replace
pawn Код:
if(sscanf(params, "us", pid, score))
With
pawn Код:
if(sscanf(params, "ui", pid, score))
score is an integer not a string
AW: /sharescore -
Blackazur - 31.10.2012
Dont need more, i have script it now myself, and it works. But thx all.