How to add siren
#1

This is the code for creating my car faction, I want to create wish the car "H" will howls?
For example: I /dvcreate 415 (Cheetah car usually not type LSPD car) [Color1] 1 [color2] 1 And I want to add a [siren type] here, how do you want me to express how I do, please?

Quote:

CMD:dvcreate(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 133
{
new
iVehicle,
iColors[2],
string[128];

if(sscanf(params, "iii", iVehicle, iColors[0], iColors[1])) {
return SendClientMessageEx(playerid, COLOR_GREY, "SU DUNG: /dvcreate [model ID] [color 1] [color 2]");
}
if(!(400 < iVehicle < 612)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid Model ID");
else if(IsATrain(iVehicle)) {
SendClientMessageEx(playerid, COLOR_GREY, "Trains cannot be spawned during runtime.");
}
else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid color specified (IDs start at 0, and end at 255).");
}
mysql_function_query(MainPipeline, "SELECT id from `groupvehs` WHERE vModel = 0 LIMIT 1;", true, "DynVeh_CreateDVQuery", "iiii", playerid, iVehicle, iColors[0], iColors[1]);
format(string, sizeof(string), "%s has created a dynamic vehicle.", GetPlayerNameEx(playerid));
Log("logs/dv.log", string);
}
else return SendClientMessage(playerid, COLOR_GRAD2, "Ban khong the su dung lenh nay.");
return 1;
}

Reply
#2

Check:
https://sampwiki.blast.hk/wiki/CreateVehicle
https://sampwiki.blast.hk/wiki/OnVehicleSirenStateChange
Reply
#3

Can you help me if I can, if I can, thanks in advance?

I do not know much about this ......

Please?
Reply
#4

createvehicle has another parameter at end.

PHP код:
CreateVehicle(modelidFloat:xFloat:yFloat:zFloat:anglecolor1color2respawn_delayaddsiren=0
Using this parameter allows you to add a siren.
Код:
addsiren	Added in 0.3.7; will not work in earlier versions. Has a default value 0. Enables the vehicle to have a siren, providing the vehicle has a horn.
Reply
#5

What other endpoints can you point out to me easily?


Can you write a line that combines with the code I posted above?
Reply
#6

lol oh god...
Reply
#7

yeah, i already understand thanks bro
Reply
#8

I have done it like this you guys have to see if I have any wrong place, if there is any error then you show me how to fix it, thank you.


Quote:

CMD:dvcreate(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 133
{
new vehicleid
iVehicle,
iColors[2],
iaddsiren,
string[128];

if(sscanf(params, "iiiI", iVehicle, iColors[0], iColors[1], iaddsiren)) {
return SendClientMessageEx(playerid, COLOR_GREY, "SU DUNG: /dvcreate [model ID] [color 1] [color 2] [Siren type]");
}
if(!(400 < iVehicle < 612)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid Model ID");
else if(IsATrain(iVehicle)) {
SendClientMessageEx(playerid, COLOR_GREY, "Trains cannot be spawned during runtime.");
}
else if(!(0 <= iColors[0] <= 255 && 0 <= iColors[1] <= 255)) {
SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid color specified (IDs start at 0, and end at 255).");
}
mysql_function_query(MainPipeline, "SELECT id from `groupvehs` WHERE vModel = 0 LIMIT 1;", true, "DynVeh_CreateDVQuery", "iiiI", playerid, iVehicle, iColors[0], iColors[1], iaddsiren);
format(string, sizeof(string), "%s has created a dynamic vehicle.", GetPlayerNameEx(playerid));
Log("logs/dv.log", string);
}
else return SendClientMessage(playerid, COLOR_GRAD2, "Ban khong the su dung lenh nay.");
return 1;
}

This is a bug in the server log, please fix it for me, please

Quote:

/dvcreate 415 1 1 1
[10:52:11] sscanf warning: Format specifier does not match parameter count.

Reply
#9

Pawn is case sensitive.

I think this will solve ur problem.
PHP код:
if(sscanf(params"iiii"iVehicleiColors[0], iColors[1], iaddsiren)) 
also try this:
PHP код:
CMD:dvcreate(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 1337)
    {
        new 
vehicleid
            iVehicle
,
            
iColors[2],
            
iaddsiren,
            
string[128]
        ;
        if(
sscanf(params"iiii"iVehicleiColors[0], iColors[1], iaddsiren)) 
            return 
SendClientMessageEx(playeridCOLOR_GREY"SU DUNG: /dvcreate [model ID] [color 1] [color 2] [Siren type]");
        if(!(
400 iVehicle 612))
            return 
SendClientMessage(playeridCOLOR_GRAD2"Invalid Model ID");
        else if(
IsATrain(iVehicle)) 
            return 
SendClientMessageEx(playeridCOLOR_GREY"Trains cannot be spawned during runtime.");
        else if(!(
<= iColors[0] <= 255 && <= iColors[1] <= 255))
            return 
SendClientMessageEx(playeridCOLOR_GRAD2"Invalid color specified (IDs start at 0, and end at 255).");
        
mysql_function_query(MainPipeline"SELECT id from `groupvehs` WHERE vModel = 0 LIMIT 1;"true"DynVeh_CreateDVQuery""iiiI"playeridiVehicleiColors[0], iColors[1], iaddsiren);
        
format(stringsizeof(string), "%s has created a dynamic vehicle."GetPlayerNameEx(playerid));
        
Log("logs/dv.log"string);
    }
    else return 
SendClientMessage(playeridCOLOR_GRAD2"Ban khong the su dung lenh nay.");
    return 
1;

Reply
#10

I tried your way but I got into the game / dvcreate 415 1 1 1 then it was created car, but when the car hit the horn it does not howl like a police car if you know fix please help me inscribe Get it, please?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)