24.05.2015, 10:19
@danish007 Bad Bad Bad wont work if more than 1 admin is specing.Moreover using timers is bad.You are executing code unnecessarily though the player does not change interior/state.
https://sampwiki.blast.hk/wiki/OnPlayerInteriorChange
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
When the interior changes for a player, the admin who is specing and the player will be in different interiors.Therefore the admin cannot see the player.
Make an array which stores the player id who is being speced for each admin.Loop through the array and check if the spec id matches with playerid(whose interior changed), if there was an admin specing that player then set the admins interior id to the players.Similarly do it in OnPlayerStateChange.You'll have to make an admin spec a vehicle (vehicle of the player who has to be spectated) rather than specing the player directly.
https://sampwiki.blast.hk/wiki/OnPlayerInteriorChange
https://sampwiki.blast.hk/wiki/OnPlayerStateChange
When the interior changes for a player, the admin who is specing and the player will be in different interiors.Therefore the admin cannot see the player.
Make an array which stores the player id who is being speced for each admin.Loop through the array and check if the spec id matches with playerid(whose interior changed), if there was an admin specing that player then set the admins interior id to the players.Similarly do it in OnPlayerStateChange.You'll have to make an admin spec a vehicle (vehicle of the player who has to be spectated) rather than specing the player directly.