14.01.2011, 20:58
Well, I suggest you using a global variable for this case. This i assume is a Temporary Vehicle, created only for one player, So i don't think you should respawn it. Example of what i mean
In the Leave command:
And on the top of your script
And What else we need is to reset that variable and remove the vehicle if the player leaves the server:
(OnPlayerDisconnect)
Now, this is a bit of a Simpler, but slower and a way i Do not Suggest , Professionally i would use an if Statement to check if PlVeh[playerid] is a valid vehicle.
pawn Код:
if(dialogid == 5)
{
if(response)
{
if(listitem == 0)
{
SetPlayerVirtualWorld(playerid, 2);
SetPlayerPos(playerid,-2421.2092,-610.8815,132.2896);
PlVeh[playerid] = CreateVehicle(562,-2421.2092,-610.8815,132.2896,0.0,0,0,100);
}
else if(listitem == 1)
{
SetPlayerHealth(playerid,0);
}
}
pawn Код:
DestroyVehicle(PlVeh[playerid]);
PlVeh[playerid] = 0; // Reseting The Variable
pawn Код:
new PlVeh[MAX_PLAYERS];
(OnPlayerDisconnect)
pawn Код:
DestroyVehicle(PlVeh[playerid]);
PlVeh[playerid] = 0;