Making a /spec & /specoff command
#4

Код:
stock StartPlayerSpec(playerid, otherid)
{
	TogglePlayerSpectating(playerid, 1);
	PlayerSpectatePlayer(playerid, otherid);
	SetPlayerInterior(playerid,GetPlayerInterior(otherid));
	SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(otherid));
	return 1;
}

stock StopPlayerSpec(playerid)
{
	TogglePlayerSpectating(playerid, 0);
	SetCameraBehindPlayer(playerid);
	return 1;
}

CMD:spec(playerid, params[])
{
	new pid;
	if(sscanf(params,"d",pid)) return SendClientMessage(playerid, "/spec [playerid]");
	if(GetPVarInt(playerid, "Spectating") == 1) return SendClientMessage(playerid, -1, "[SERVER]: You are already spectating. (/specoff)");
	if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, -1, "Invalid player is");
	SetPVarInt(playerid, "Spectating", 1);
	StartPlayerSpec(playerid, pid);
	return 1;
}

CMD:specoff(playerid, params[])
{
	if(GetIntVar(playerid, "Spectating") == 0) return SendClientMessage(playerid, COLOR_YELLOWG, "[SERVER]: You are not spectating.");
	DeletePVar(playerid, "Spectating");
	StopPlayerSpec(playerid);
	return 1;
}
Reply


Messages In This Thread
Making a /spec & /specoff command - by Goldino - 22.02.2013, 11:24
Re: Making a /spec & /specoff command - by JaKe Elite - 22.02.2013, 11:27
Re: Making a /spec & /specoff command - by Goldino - 22.02.2013, 11:35
Re: Making a /spec & /specoff command - by PaulDinam - 22.02.2013, 11:46
Re: Making a /spec & /specoff command - by Goldino - 22.02.2013, 12:17
Re: Making a /spec & /specoff command - by PaulDinam - 22.02.2013, 12:27
Re: Making a /spec & /specoff command - by Goldino - 22.02.2013, 12:29
Re: Making a /spec & /specoff command - by PaulDinam - 22.02.2013, 12:30
Re: Making a /spec & /specoff command - by Goldino - 22.02.2013, 12:34
Re: Making a /spec & /specoff command - by -Shifty- - 22.02.2013, 12:37

Forum Jump:


Users browsing this thread: 1 Guest(s)