SA-MP Forums Archive
Car spawns unlocked - 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: Car spawns unlocked (/showthread.php?tid=310267)



Car spawns unlocked - Outcast - 11.01.2012

I have a problem. I want the car to spawn locked, but instead every time it spawns unlocked. I don't see what's causing it.

This is my OnFilterScriptInit()
pawn Код:
// Create additional police cars
car[0] = CreateVehicle(528,-1632.5520,693.4023,-5.1991,178.7214,0,0, 1200);
SetVehicleParamsForAll(car[0], 0, 1);
car[1] = CreateVehicle(525,-1612.3098,732.4475,-5.3565,0.8844,17,20, 1200);
SetVehicleParamsForAll(car[1], 0, 1);
// Continue...
pawn Код:
public SetVehicleParamsForAll(carid,objective,doorslocked)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        SetVehicleParamsForPlayer(carid,i,objective,doorslocked);
    }
    return 1;
}



Re: Car spawns unlocked - Norck - 11.01.2012

You also need to apply SetVehicleParamsForPlayer inside OnVehicleStreamIn callback.


Re: Car spawns unlocked - Outcast - 11.01.2012

Well, I have this in OnVehicleStreamIn()
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
        new engine,lights,alarm,doors,bonnet,boot,objective
   
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        SetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);

        return 1;
}
Isn't it the same?

EDIT: Still not working

pawn Код:
for(new i=0; i<2;i++)
{
     if(vehicleid == car[i]){
     SetVehicleParamsForPlayer(car[i], forplayerid, 0, doors);
     } 
}