SA-MP Forums Archive
onplayerdissconnect problem - 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: onplayerdissconnect problem (/showthread.php?tid=371599)



onplayerdissconnect problem - UnknownGamer - 23.08.2012

Hey guys,

How would I make it so when people disconnect there cars unload?

On server load, public LoadCar()

How would I make it so when they log-off, there car disconnects.


Re: onplayerdissconnect problem - Shetch - 23.08.2012

Save the ID of the vehicle when it's created.
Код:
new veh[MAX_PLAYERS];
veh[playerid] = CreateVehicle()

Then under OnPlayerDisconnect do:
DestroyVehicle(veh[playerid]);



Re : onplayerdissconnect problem - Eony - 23.08.2012

Quote:
Originally Posted by UnknownGamer
Посмотреть сообщение
Hey guys,

How would I make it so when people disconnect there cars unload?

On server load, public LoadCar()

How would I make it so when they log-off, there car disconnects.
You can use DestroyVehicle() in OnPlayerDisconnect, it takes a vehicle ID as parameter, so you'll have to store the player's personal vehicle ID and provide it to that function.


Re: onplayerdissconnect problem - UnknownGamer - 23.08.2012

new currentveh;
currentveh = GetPlayerVehicleID(playerid);
DestroyVehicle(currentveh);

Would that work with Ravens Roleplay? so there car unloads when they log out and re-load when they log back in?


Re : Re: onplayerdissconnect problem - Eony - 24.08.2012

Quote:
Originally Posted by UnknownGamer
Посмотреть сообщение
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
DestroyVehicle(currentveh);

Would that work with Ravens Roleplay? so there car unloads when they log out and re-load when they log back in?
Never saw Ravens Roleplay code, but I guess it should work fine.