Vehicle Siren?
#1

Is it true I can make a siren sound on a vehicle? If so, will this command work?

I put the code on this copy and baste bin:
http://pastebin.com/9ZsfYpJA
Reply
#2

You'd also need to make use of this function.

pawn Код:
OnVehicleSirenStateChange(playerid, vehicleid, newstate)
Also, here, a little fix.
pawn Код:
CMD:togglesiren(playerid, params[])
{
new siren = GetVehicleParamsSirenState(vehicleid);
    if(IsACop(playerid) || IsAHitman(playerid) || IsAGovernment(playerid))
    {
        if(siren == 1)
        {
            siren = 0
            SendClientMessageEx(playerid, COLOR_WHITE, "Siren disabled.");
            return 1;
        }
        else
        {
            siren = 1
            SendClientMessageEx(playerid, COLOR_WHITE, "Siren enabled.");
            return 1;
        }
        SendClientMessage(playerid, COLOR_GRAD2, "This vehicle does not support mounted sirens.");
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by Luis-
Посмотреть сообщение
You'd also need to make use of this function.

pawn Код:
OnVehicleSirenStateChange(playerid, vehicleid, newstate)
Also, here, a little fix.
pawn Код:
CMD:togglesiren(playerid, params[])
{
new siren = GetVehicleParamsSirenState(vehicleid);
    if(IsACop(playerid) || IsAHitman(playerid) || IsAGovernment(playerid))
    {
        if(siren == 1)
        {
            siren = 0
            SendClientMessageEx(playerid, COLOR_WHITE, "Siren disabled.");
            return 1;
        }
        else
        {
            siren = 1
            SendClientMessageEx(playerid, COLOR_WHITE, "Siren enabled.");
            return 1;
        }
        SendClientMessage(playerid, COLOR_GRAD2, "This vehicle does not support mounted sirens.");
    }
    return 1;
}
I don't know how to script, do you have team viewer or something you can use to help me?
Reply
#4

You do realise that code isn't actually setting a siren, right? You need to set the last parameter of AddStaticVehicleEx or CreateVehicle to 1 to give vehicles a siren.

https://sampwiki.blast.hk/wiki/CreateVehicle
Reply
#5

Quote:
Originally Posted by MP2
Посмотреть сообщение
You do realise that code isn't actually setting a siren, right? You need to set the last parameter of AddStaticVehicleEx or CreateVehicle to 1 to give vehicles a siren.

https://sampwiki.blast.hk/wiki/CreateVehicle
So I change the 0 beside faction respawn to 1?

LSPDVehicles[25] = AddStaticVehicleEx(560,1562.7063,-1693.5046,5.5956,181.0911,0,0, FACTION_RESPAWN);
Reply
#6

pawn Код:
LSPDVehicles[25] = AddStaticVehicleEx(560,1562.7063,-1693.5046,5.5956,181.0911,0,0, FACTION_RESPAWN, 1);
https://sampwiki.blast.hk/wiki/GetVehicleParamsSirenState
https://sampwiki.blast.hk/wiki/OnVehicleSirenStateChange

It's pretty simple if you think about it.
Reply
#7

Also, if you want to toggle the siren on/off, I think you can use the 'alarm' parameter of SetVehicleParamsEx. Someone told me that but I've yet to test it.
Reply
#8

Quote:
Originally Posted by Luis-
Посмотреть сообщение
pawn Код:
LSPDVehicles[25] = AddStaticVehicleEx(560,1562.7063,-1693.5046,5.5956,181.0911,0,0, FACTION_RESPAWN, 1);
https://sampwiki.blast.hk/wiki/GetVehicleParamsSirenState
https://sampwiki.blast.hk/wiki/OnVehicleSirenStateChange

It's pretty simple if you think about it.
I got that one now, but how do I add it on a mysql database? I'll post you screenshots below.
http://gyazo.com/6b5a615a416aa791888e5440a55f0f09
http://gyazo.com/028fc7bd37c1bd00b67697b4285ef488
http://gyazo.com/4bd6f6a27840f7d81110666f6415ce90
http://gyazo.com/62bc4374b06619b37f68b4ea9ab7b6f2
Reply
#9

Quote:
Originally Posted by cordellpwnz
Посмотреть сообщение
This is something I've did in my script when loading the vehicles. You dont need to define if it has a siren or not in your MySQL database - just check for faction.

pawn Код:
if(cardata[vehicleid][pFaction] == FACTION_POLICE)
    {
        //createvehicle with siren
    }
    else
    {
        // create vehicle no siren.
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)