SA-MP Forums Archive
command buggy,again - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: command buggy,again (/showthread.php?tid=139659)



command buggy,again - WardenCS - 05.04.2010

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;
	}



Re: command buggy,again - WardenCS - 06.04.2010

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


Re: command buggy,again - Hiddos - 06.04.2010

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

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


Re: command buggy,again - WardenCS - 06.04.2010

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


Re: command buggy,again - WardenCS - 06.04.2010

BUMP!


Re: command buggy,again - Norn - 06.04.2010

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


Re: command buggy,again - Mikep. - 06.04.2010

Try indenting.


Re: command buggy,again - WardenCS - 06.04.2010

actually,its not Godfather edit.


Re: command buggy,again - WardenCS - 07.04.2010

BUMP!


Re: command buggy,again - Jakku - 07.04.2010

Also add:

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