command buggy,again
#1

Hello,wanted to make /promote,but its bugged,if i write anything,/safasfa,it will promote me to principal,(idk,if it was for id 0,cuz i was lonley in server).


Код:
	if(strcmp(cmd, "/promote", true) == 0)
	{
	if(IsPlayerConnected(playerid))
	{
	new giveplayer[MAX_PLAYER_NAME];
	new tmp[256];
	new idx;
	tmp = strtok(cmdtext, idx);
	if(!strlen(tmp))
	{
	SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /promote [playerid/PartOfName]");
	return 1;
	}
	new para1;
	para1 = strval(tmp);
	if(para1 != INVALID_PLAYER_ID)
	{
	if(IsPlayerConnected(para1))
	{
	if(IsPlayerAdmin(playerid))
	{
  new sendername[MAX_PLAYER_NAME];
	GetPlayerName(para1, giveplayer, sizeof(giveplayer));
	GetPlayerName(playerid, sendername, sizeof(sendername));
	new string[256];
	format(string, sizeof(string), " You have promoted %s to Principal.", giveplayer);
	SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
	PlayerInfo[playerid][fLeader] = 1;
	SetPlayerSkin(playerid,295);
	}
	else
	{
	SendClientMessage(para1, COLOR_YELLOW, "Error: Your not in the same gang!");
	}
	}
	else
	{
	SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command(leaders only)!");
	}
	}
	}
	return 1;
	}
Reply
#2

BUMP!
EDIT:i fixed the thing if i write anything /Safsafa,that it will promote,now just the ID prob.
Reply
#3

Код:
PlayerInfo[playerid][fLeader] = 1;
Should be

Код:
PlayerInfo[para1][fLeader] = 1;
because now you're promoting the player who uses the command.
Reply
#4

tested,wont work,still puts player 0 to principal,or ur self
Reply
#5

BUMP!
Reply
#6

Don't edit the godfather and maybe you will succeed.
Reply
#7

Try indenting.
Reply
#8

actually,its not Godfather edit.
Reply
#9

BUMP!
Reply
#10

Also add:

pawn Код:
if(IsPlayerConnected(para1))
{
//Code here
}
This checks is the "para1" connected, and this fixes this problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)