SA-MP Forums Archive
how to make:when player spawn a car and when he dissconect to car dissapear ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how to make:when player spawn a car and when he dissconect to car dissapear ? (/showthread.php?tid=462350)



how to make:when player spawn a car and when he dissconect to car dissapear ? - bustern - 06.09.2013

I want when player spawn a car and when he dissconect, his car dissapear


Re: how to make:when player spawn a car and when he dissconect to car dissapear ? - SeniorGamer - 06.09.2013

pawn Код:
public OnPlayerSpawn(playerid)
{
    new veh;
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    veh = CreateVehicle(451, x,y,z,0,1,1,0); //This will spawn turismo
    PutPlayerInVehicle(playerid,veh,0);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new veh;
    veh = GetPlayerVehicleID(playerid);
    DestroyVehicle(veh);
    return 1;
}

This would destroy players vehicle when he disconnects (his current vehicle). Do you want maybe to delete the car that he made?