08.05.2013, 10:37
brawrr, thank you, but I already did the part with not allowing to start spectating if an admin is already there using public function IsAdminInVehicle.
What do I need now is to make spectating stop when an admin is entering vehicle...
The wrong code is:
I need something like OnPlayerSpectatingVehicle, but I have no idea how to make it.
I also thought about creating some variable for the vehicle being spectated and then turning it to zero when an admin enters the vehicle, but I have no idea how to make it do something with the player spectating.
I mean... Variables can prevent something from happening, but not interrupt it when it's already going.
So I need some public function which can send a command to spectating player when an admin enters spectated vehicle.
What do I need now is to make spectating stop when an admin is entering vehicle...
The wrong code is:
pawn Код:
for(new i=0; i<MAXPLAYERS; i++)
{
if(IsPlayerInVehicle(i, specvehicleid)&&((tmpAdmin[i]==1&&admin[i]==1))||IsPlayerAdmin(i))
{
TogglePlayerSpectating(playerid, 0);
gSpectateID[playerid] = INVALID_PLAYER_ID;
gSpectateType[playerid] = ADMIN_SPEC_TYPE_NONE;
SetPlayerVirtualWorld(playerid,0);
camer[playerid]=0;
ShowDialog(playerid,43,DIALOG_STYLE_MSGBOX,"Info","{FCAC00}Another administrator has entered the vehicle you're spectating,\nso spectating is stopped.","OK","");
return 1;
}
}
I need something like OnPlayerSpectatingVehicle, but I have no idea how to make it.
I also thought about creating some variable for the vehicle being spectated and then turning it to zero when an admin enters the vehicle, but I have no idea how to make it do something with the player spectating.
I mean... Variables can prevent something from happening, but not interrupt it when it's already going.
So I need some public function which can send a command to spectating player when an admin enters spectated vehicle.