[COMMAND] /spec
#1

Код:
CMD:spec(playerid, params[])
{
	new giveplayerid, Float:x, Float:y, Float:z;
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, -1, "USAGE: /spec [playerid/partofname/off]");
	if(strcmp(params, "off", true) == 0)
	{
		SetPVarInt(playerid, "SpecOff", 1);
		TogglePlayerSpectating(playerid, false);
		SetCameraBehindPlayer(playerid);
		SetPlayerPos(playerid, x, y, z);
		spec[playerid] = -1;
		return 1;
	}
	if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
	if(IsPlayerInAnyVehicle(giveplayerid))
	{
		GetPlayerPos(playerid, x, y, z);
		TogglePlayerSpectating(playerid, true);
		new carid = GetPlayerVehicleID(giveplayerid);
		PlayerSpectateVehicle(playerid, carid);
		SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
		SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
		spec[playerid] = giveplayerid;
	}
		else
	{
	    GetPlayerPos(playerid, x, y, z);
		TogglePlayerSpectating(playerid, true);
		PlayerSpectatePlayer(playerid, giveplayerid);
		SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
		SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
		spec[playerid] = giveplayerid;
	}
	return 1;
}
/spec off telerports the executer to blueberry for some odd reason... No compiling errors...
Reply


Messages In This Thread
[COMMAND] /spec - by BarFix - 31.10.2015, 17:36
Re: [COMMAND] /spec - by MartinSwag - 31.10.2015, 17:55
Re: [COMMAND] /spec - by BarFix - 31.10.2015, 17:58
Re: [COMMAND] /spec - by MartinSwag - 31.10.2015, 18:26

Forum Jump:


Users browsing this thread: 1 Guest(s)