09.02.2011, 03:57
you need to make a global variable for every player like
then onplyerconnect go
then find the players free slot
do this at the top of OnDialogResponse(
then you need to store the vehicle id to these values when a player creates a car like
also go ondisconect
hope that helps untested pm me if you have any questions
pawn Код:
new SpawnedCars[MAX_PLAYERS][3];
pawn Код:
SpawnedCars[playerid][0] = -1;
SpawnedCars[playerid][1] = -1;
SpawnedCars[playerid][2] = -1;
do this at the top of OnDialogResponse(
pawn Код:
new scid = -1;
for(new i=0;i<3;i++){
if(i == -1) {
scid = i;
break;
}
}
if(scid == -1){ //if all slots are full delete the cars from the server
DestroyVehicle(SpawnedCars[playerid][0]);
DestroyVehicle(SpawnedCars[playerid][1]);
DestroyVehicle(SpawnedCars[playerid][2]);
SpawnedCars[playerid][0] = -1;
SpawnedCars[playerid][1] = -1;
SpawnedCars[playerid][2] = -1;
scid = 0;
}
pawn Код:
SpawnedCars[playerid][scid] = CreateVehicle(.........
pawn Код:
DestroyVehicle(SpawnedCars[playerid][0]);
DestroyVehicle(SpawnedCars[playerid][1]);
DestroyVehicle(SpawnedCars[playerid][2]);