Problem with spec
#1

Hi
i have added an admin command spec player
not working
code:

Код:
CMD:spec(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1&& !IsPlayerAdmin(playerid)) return 1;
	new targetid,pName[MAX_PLAYER_NAME];
	if(sscanf(params,"u", targetid)) return SendClientMessage(playerid, -1 , "Correct Usage: /spec[Playerid]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,COLOR_RED,"Player not connected.");
	GetPlayerName(targetid,pName,sizeof(pName));
	TogglePlayerSpectating(targetid, 1);
	new msg[126];
	format(msg,sizeof(msg),"[Spectate]You are spectating player %s",pName);
	SendClientMessage(playerid,COLOR_RED,msg);
	return 1;
}

CMD:specoff(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 1&& !IsPlayerAdmin(playerid)) return 1;
	new pName[MAX_PLAYER_NAME];
	TogglePlayerSpectating(targetid, 0);
	new msg[126];
	format(msg,sizeof(msg),"[Spectate]You are no more spectating player");
	SendClientMessage(playerid,COLOR_RED,msg);
	return 1;
}
Reply
#2

Why do you put Targetid here?
Код:
TogglePlayerSpectating(targetid, 1);
Replace by

Код:
TogglePlayerSpectating(playerid, 1);
in the two commands.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)