14.12.2012, 00:21
pawn Код:
CMD:eventprize(playerid, params[])
{
new string[128], playerb, event; //Prize is not needed, event is.
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "ui", playerb, event))
{
SendClientMessage(playerid, COLOR_WHITE, "/setstat [playerid] [prizeid]");
SendClientMessage(playerid, COLOR_GREY, "Prizes: 1 | 2");
return 1;
}
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
switch(event) //Switching on Event, not "Stat", as there is no such thing as "Stat" defined.
{
case 1:
{
GiveZaiatMoney(playerb, 50000); //This
SetPlayerHealth(playerb, 100); //This
SetPlayerArmour(playerb, 100); //And this were wrong, you're giving the prize to playerb, not the player who types in the command.
format(string, sizeof(string), "%s has givin %s $50,000 and full health and armor", RPN(playerid), RPN(playerb));
SendClientMessageToAll(COLOR_LIGHTRED, string);
}//Where's case 2?
}
Log("logs/eventprize.log", string);
return 1;
}