30.10.2012, 20:41
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."
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); }
if(sscanf(params, "us", pid, score))
if(sscanf(params, "ui", pid, score))