Spawn cars with lights turned on
#1

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

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);
             }
        }
}
Reply
#3

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)
Reply
#4

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);
             }
        }
}
Reply
#5

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
Reply
#6

Please help i will +rep
Reply
#7

Try use:

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

pawn Код:
else // for false
Reply
#8

No Warnings but it doesn't work ;S
Reply
#9

Make sure you have this under OnGameModeInit:

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)