Spawning all cars as locked - 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: Spawning all cars as locked (
/showthread.php?tid=353525)
Spawning all cars as locked -
Calabresi - 23.06.2012
I'm kinda new to scripting and I'm working on a gamemode right now. I want to get all cars spawned as locked, I've tried that code but it didn't work:
pawn Код:
public OnVehicleSpawn(vehicleid)
{
Engine[vehicleid] = 0;
Lights[vehicleid] = 0;
Doors[vehicleid] = 1;
Alarm[vehicleid] = 0;
Bonnet[vehicleid] = 0;
Boot[vehicleid] = 0;
Objective[vehicleid] = 0;
SetVehicleParamsEx(vehicleid, Engine[vehicleid], Lights[vehicleid], Alarm[vehicleid], Doors[vehicleid], Bonnet[vehicleid], Boot[vehicleid], Objective[vehicleid]);
return 1;
}
Can someone help me about that? No errors, but when I try the script, I see that no cars are locked.
Re: Spawning all cars as locked -
SuperViper - 23.06.2012
OnVehicleSpawn is misleading. It's only called when the vehicle REspawns. If you want the OnVehicleCreate function, you could use the include I made for that and a lot of other functions:
https://sampforum.blast.hk/showthread.php?tid=348044.
Usage:
pawn Код:
public OnVehicleCreate(vehicleid)
{
// your code here
return 1;
}
Also, you shouldn't delete the code in OnVehicleSpawn because that'll make it lock when it respawns aswell.
Re: Spawning all cars as locked -
Calabresi - 24.06.2012
Quote:
Originally Posted by SuperViper
OnVehicleSpawn is misleading. It's only called when the vehicle REspawns. If you want the OnVehicleCreate function, you could use the include I made for that and a lot of other functions: https://sampforum.blast.hk/showthread.php?tid=348044.
Usage:
pawn Код:
public OnVehicleCreate(vehicleid) { // your code here return 1; }
Also, you shouldn't delete the code in OnVehicleSpawn because that'll make it lock when it respawns aswell.
|
Thank you so much, I'll try that.
Edit: It worked! Thanks again!