Spawning all cars as locked
#1

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.
Reply
#2

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.
Reply
#3

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)