givescore problem
#1

It's /givescore command i made it for admins only.
when admin use /givescore it give score to id 0 only even if id 0 not the requirement id.

the code:
Код:
CMD:givescore(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 4)
	{
    new giveplayerid,
    amount,
    gscore = GetPlayerScore(playerid);
    if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /givescore [playerid/partname] [amount]");
    else if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not found");
    else if(amount > gscore) return SendClientMessage(playerid, 0xFF0000AA, "ERROE:Unknown Score");
    {
        SetPlayerScore(giveplayerid,GetPlayerScore(giveplayerid) + amount);
        SendClientMessage(playerid, 0x00FF00AA, "Score Sent");
        SendClientMessage(giveplayerid, 0x00FF00AA, "You Recieved Scores From an admin");
    }
	if(PlayerInfo[playerid][Level] <= 4)
	{
	SendClientMessage(playerid, red, "ERROR: You are not a high enough level to use this command");
    }
    }
	return 1;
}
Reply
#2

Код:
CMD:givescore(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 4)
	{
		new giveplayerid,amount,gscore = GetPlayerScore(playerid);
		if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /givescore [playerid/partname] [amount]");
		else if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: Player not found");
		else if(amount > gscore) return SendClientMessage(playerid, 0xFF0000AA, "ERROR:Unknown Score");
		SetPlayerScore(giveplayerid,GetPlayerScore(giveplayerid) + amount);
		SendClientMessage(playerid, 0x00FF00AA, "Score Sent");
		SendClientMessage(giveplayerid, 0x00FF00AA, "You Recieved Scores From an admin");
	}
	else
	{
			// Your msg here if hes lower than 4.
	}
	return 1;
}
You don't need to re-check if the player is lower than 4 then send him the message.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)