Help Whit PlayerSpectateVehicle - 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)
+--- Thread: Help Whit PlayerSpectateVehicle (
/showthread.php?tid=662900)
Help Whit PlayerSpectateVehicle -
neropic - 14.01.2019
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;
}
Re: Help Whit PlayerSpectateVehicle -
NaS - 15.01.2019
You're getting the vehicle ID from the player who typed the command, same for the IsPlayerInAnyVehicle check.
Use targetid for those instead.