Help Whit PlayerSpectateVehicle
#1

Hi, i have a problem whit PlayerSpectateVehicle.

at the time of spec any player in a vehicle, the sistem do not spect outside the vehicle, spec the player in the vehicle, not the vehicle.

Код:
CMD:aspec(playerid,params[])
{
	if(pInfo[playerid][AdminRank] < TRIAL_ADMIN) return SendClientMessage(playerid, COLOR_DARK_RED, "ERROR: No tienes los permisos necesarios para usar este comando.");
	new targetid, str[100];
	if(sscanf(params, "i", targetid)) return SendClientMessage(playerid, COLOR_ORANGE, "USA: /aspec [id]");
	if(targetid == playerid) return SendClientMessage(playerid, COLOR_DARK_RED, "ERROR: No puedes spectearte a ti mismo.");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_DARK_RED, "ERROR: El jugador no estб conectado.");
	TogglePlayerSpectating(playerid, 1);
    SetPlayerInterior(playerid, GetPlayerInterior(targetid));

	if(IsPlayerInAnyVehicle(playerid))
    {
		new vehid = GetPlayerVehicleID(playerid);
		PlayerSpectateVehicle(playerid, vehid);
	}
	else
	{
		PlayerSpectatePlayer(playerid, targetid, SPECTATE_MODE_NORMAL);
	}	
	pInfo[playerid][PlayerSpectating] = true;
	format(str, sizeof(str), "Estas especteando a %s[%d]",pInfo[targetid][Name],targetid);
	SendClientMessage(playerid, COLOR_GREY, str);
	return 1;
}
Reply
#2

You're getting the vehicle ID from the player who typed the command, same for the IsPlayerInAnyVehicle check.
Use targetid for those instead.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)