SA-MP Forums Archive
Spawn cars with lights turned on - 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: Spawn cars with lights turned on (/showthread.php?tid=475374)



Spawn cars with lights turned on - Dripac - 12.11.2013

I have added cars with AddStaticVehicle but how can i make them always spawn and have lights on?

Or better how can i make it so lights turn on and off every second, i need it because of a video


Re: Spawn cars with lights turned on - Marshall32 - 12.11.2013

pawn Код:
OnGameModeInit()
{
    SetTimer("Lights",1000,1);
}
forward Lighs();
public Lights()
{
        new engine,lights,alarm,doors,bonnet,boot,objective;
        for(new i = 0;i<MAX_VEHICLES;i++)
    {
             GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
             if(lights == false)
             {
                  GetVehicleParamsEx(i,engine,true,alarm,doors,bonnet,boot,objective);
             }
             else if(lights == true)
             {
                  GetVehicleParamsEx(i,engine,false,alarm,doors,bonnet,boot,objective);
             }
        }
}



AW: Spawn cars with lights turned on - Dripac - 12.11.2013

Ehm i get these errors, do you know how to fix them?

C:\Users\Stefanche16\Desktop\SMOKE'S SERVER\gamemodes\movie.pwn(61) : warning 235: public function lacks forward declaration (symbol "Lights")
C:\Users\Stefanche16\Desktop\SMOKE'S SERVER\gamemodes\movie.pwn(67) : warning 213: tag mismatch
C:\Users\Stefanche16\Desktop\SMOKE'S SERVER\gamemodes\movie.pwn(69) : error 035: argument type mismatch (argument 3)
C:\Users\Stefanche16\Desktop\SMOKE'S SERVER\gamemodes\movie.pwn(71) : warning 213: tag mismatch
C:\Users\Stefanche16\Desktop\SMOKE'S SERVER\gamemodes\movie.pwn(73) : error 035: argument type mismatch (argument 3)


Re: Spawn cars with lights turned on - erminpr0 - 12.11.2013

pawn Код:
forward Lighs(); // put this at top of your code (below macros)

OnGameModeInit()
{
    SetTimer("Lights",1000,1);
}
public Lights()
{
        new engine,lights,alarm,doors,bonnet,boot,objective;
        for(new i = 0;i<MAX_VEHICLES;i++)
        {
             GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
             if(lights == false)
             {
                  SetVehicleParamsEx(i,engine,true,alarm,doors,bonnet,boot,objective);
             }
             else if(lights == true)
             {
                  SetVehicleParamsEx(i,engine,false,alarm,doors,bonnet,boot,objective);
             }
        }
}



AW: Spawn cars with lights turned on - Dripac - 13.11.2013

Eh now i get 2 warnings and it doesn't work, whats wrong with it?

the lines are

if(lights == false)

and

else if(lights == true)

C:\Users\Stefanche16\Desktop\SMOKE'S SERVER\gamemodes\movie.pwn(74) : warning 213: tag mismatch
C:\Users\Stefanche16\Desktop\SMOKE'S SERVER\gamemodes\movie.pwn(7 : warning 213: tag mismatch


AW: Spawn cars with lights turned on - Dripac - 13.11.2013

Please help i will +rep


Re: Spawn cars with lights turned on - DanishHaq - 13.11.2013

Try use:

pawn Код:
if(lights == 1) // for true
And

pawn Код:
else // for false



AW: Spawn cars with lights turned on - Dripac - 13.11.2013

No Warnings but it doesn't work ;S


Re: Spawn cars with lights turned on - DanishHaq - 13.11.2013

Make sure you have this under OnGameModeInit:

pawn Код:
SetTimer("Lights",1000,1);



AW: Spawn cars with lights turned on - Dripac - 13.11.2013

I already have it.. i really don't know why it doesn't work and i also have ManualVehicleEngineAndLights();