giveplayerid help [HELP ME] -
ChristianIvann09 - 31.03.2014
At this CMD. When i tried to /makegangmod and when that player is already gang mod. It return 1;
But, It doesnt. Even if player is not gang mod its showing "That player is already a gang mod" return 1;
But he/she not gang mod.
I found out the bugged and its on
. It didnt givetoid. It referring to myself like [playerid] . So when im gang mod and i made player gang it will return 1; and showns the message.
So, i want it if player is already a gang mod it will return 1; or return SendClientMessage
Код:
CMD:makegangmod(playerid, params[])
{
if(CheckGMX(playerid)) return 1;
new givetoid, name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], astring[256];
if(PlayerInfo[playerid][pAdmin] < 5 ) return SendClientMessage(playerid, COLOR_WHITE, "Your admin level is not high enough.");
if(PlayerInfo[givetoid][pGangMod] == 1 ) return SendClientMessage(playerid, COLOR_REALRED, "ERROR: That player is already an gang moderator!");
if(sscanf(params, "i", givetoid))
{
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makegangmod [playerid]");
}
GetPlayerName(givetoid, name, MAX_PLAYER_NAME);
GetPlayerName(playerid, name2, MAX_PLAYER_NAME);
format(astring, sizeof(astring), "You made %s a gangmod", name);
if(!IsPlayerNPC(playerid) && IsPlayerConnected(playerid))
{
PlayerInfo[givetoid][pGangMod] = 1;
SendClientMessage(playerid, COLOR_LIGHTBLUE, astring);
format(astring, sizeof(astring), "You have been made Gang Moderator by an Admin", name);
SendClientMessage(givetoid, COLOR_LIGHTBLUE, astring);
format(astring, sizeof(astring), "ADMCMD: Admin %s has made %s as Gang Moderator", name, name2);
ABroadCast(COLOR_LIGHTRED, astring, 1);
}
return 1;
}
Same in removegangmod
Код:
CMD:removegangmod(playerid, params[])
{
if(CheckGMX(playerid)) return 1;
new givetoid, name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], astring[256];
if(PlayerInfo[playerid][pAdmin] < 5 ) return SendClientMessage(playerid, COLOR_WHITE, "Your admin level is not high enough.");
if(PlayerInfo[givetoid][pGangMod] == 0 ) return SendClientMessage(playerid, COLOR_REALRED, "ERROR: That player is not an gang Moderator");
if(sscanf(params, "i", givetoid))
{
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /removegangmod [playerid]");
}
GetPlayerName(givetoid, name, MAX_PLAYER_NAME);
GetPlayerName(playerid, name2, MAX_PLAYER_NAME);
format(astring, sizeof(astring), "You remove %s a gangmod", name);
if(!IsPlayerNPC(playerid) && IsPlayerConnected(playerid))
{
PlayerInfo[givetoid][pGangMod] = 0;
SendClientMessage(playerid, COLOR_LIGHTBLUE, astring);
format(astring, sizeof(astring), "You have been Remove from Gang Moderator", name);
SendClientMessage(givetoid, COLOR_LIGHTBLUE, astring);
format(astring, sizeof(astring), "ADMCMD: Admin %s has remove %s as Gang Moderator", name, name2);
ABroadCast(COLOR_LIGHTRED, astring, 1);
}
return 1;
}
THANK YOU VERY MUCH FOR HELPING!
Re: giveplayerid help [HELP ME] -
BroZeus - 31.03.2014
place the if statement of sscanf above the if statement where it checks the mod like this
pawn Код:
if(sscanf(params, "u", givetoid))return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makegangmod [playerid]");
if(PlayerInfo[givetoid][pGangMod] == 0 ) return SendClientMessage(playerid, COLOR_REALRED, "ERROR: That player is not an gang Moderator");