Actor destroying at wrong player
#2

Your variable new TutorialActor[MAX_PLAYERS][3]; is 0 on start and actors start from 0 so:

if first player connect TutorialActor[playerid][0] = CreateActor(); Actor ID 0 (all ok)
then second player is connect (his variable is 0 TutorialActor[playerid][0]) and actor ID 0 is destroyed DestroyActor(TutorialActor[playerid][0]); in OPC for Player 1 ( now actor is owned by player 2 )

if third player connect actor ID is still 0 and variable TutorialActor[playerid][0] is 0 so again you destroy friend id 2 actor

Solution:

In OnGameModeInit set array to INVALID_ACTOR_ID;
pawn Code:
new tempActorID[sizeof(TutorialActor[])] = {INVALID_ACTOR_ID, ...};
for(new i = 0; i < sizeof(TutorialActor); i++)
    TutorialActor[i] = tempActorID;
and for destroy actors

pawn Code:
if(TutorialActor[playerid][0] != INVALID_ACTOR_ID)
{
    DestroyActor(TutorialActor[playerid][0]);
    TutorialActor[playerid][0] = INVALID_ACTOR_ID;
}
Reply


Messages In This Thread
Actor destroying at wrong player - by JaydenJason - 14.08.2015, 19:13
Re: Actor destroying at wrong player - by Jefff - 14.08.2015, 22:18
Re: Actor destroying at wrong player - by JaydenJason - 15.08.2015, 12:28

Forum Jump:


Users browsing this thread: 1 Guest(s)