/sharescore
#1

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."
Reply
#2

Do you have DCMD in your script ? When not i'll script on my screen for you.
Reply
#3

No i use ZCMD and sscanf.
Reply
#4

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);
}
Reply
#5

Replace
pawn Код:
if(sscanf(params, "us", pid, score))
With
pawn Код:
if(sscanf(params, "ui", pid, score))
score is an integer not a string
Reply
#6

Dont need more, i have script it now myself, and it works. But thx all.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)