14.08.2015, 22:18
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;
and for destroy actors
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;
pawn Code:
if(TutorialActor[playerid][0] != INVALID_ACTOR_ID)
{
DestroyActor(TutorialActor[playerid][0]);
TutorialActor[playerid][0] = INVALID_ACTOR_ID;
}