Siren sound for regular vehicles
#1

So i've had some requests from my players to add an ability for regular vehicles to have sirens.I've tried it this way but couldn't work.I got a cmd which adds the organization vehicles so i'll put it here too.

What i tried:
Код:
if (IsALaw(playerid) orgvid[orgid-1][giveplayerid-1] = CreateVehicle2(model, x, y, z, a, 900, addsiren=1);
CMD that adds the organization vehicles:
Код:
CMD:addorgv(playerid, params[])
{
	new orgid, col1, col2, moneys1, tmp[256], tmp2[256], string[256], giveplayer[25], giveplayerid;
	if (adlvl[playerid] < 6) return 0;
	if (!IsPlayerInAnyVehicle(playerid)) return SendClientMessage2(playerid, COLOR_RED, "Error: You must be in a vehicle.");
	if (sscanf(params, "ddd", orgid, col1, col2)) return SendClientMessage2(playerid, COLOR_WHITE, "Usage: /addorgv [orgid] [color1] [color2]");
	format(string, 10, "org%d", orgid);
	if (!dini_Exists(AddDirFile(dir_orgfiles, string))) return SendClientMessage2(playerid, COLOR_RED, "Error: Invalid organization id.");
	if (col1 < -1 || col1 > 255 || col2 < -1 || col2 > 255) return SendClientMessage2(playerid, COLOR_RED, "Error: Invalid color id! (-1 - 255)");
	for (new ovs = MAX_ORG_VEHICLES; ovs > 0; ovs--)
	{
		format(giveplayer, 12, "ocmodel_%d", ovs);
		if (dini_Int(AddDirFile(dir_orgfiles, string), giveplayer) == 0) giveplayerid = ovs;
		else moneys1 ++;
	}
	if (moneys1 == MAX_ORG_VEHICLES)
	{
		format(tmp2, sizeof(tmp2), "This organization has reached the max of %d vehicles.", MAX_ORG_VEHICLES);
		SendClientMessage2(playerid, COLOR_RED, tmp2);
		return 1;
	}
	new pvid = GetPlayerVehicleID(playerid);
	if (vorgo[pvid] != 0) return SendClientMessage2(playerid, COLOR_RED, "This vehicle already belongs to an organization.");
	new Float:x, Float:y, Float:z, Float:a;
	GetVehiclePos(pvid, x, y, z);
	GetVehicleZAngle(pvid, a);
	new model = GetVehicleModel(pvid);
	format(giveplayer, 12, "ocmodel_%d", giveplayerid);
	dini_IntSet(AddDirFile(dir_orgfiles, string), giveplayer, model);
	format(giveplayer, 12, "ocx_%d", giveplayerid);
	dini_FloatSet(AddDirFile(dir_orgfiles, string), giveplayer, x);
	format(giveplayer, 12, "ocy_%d", giveplayerid);
	dini_FloatSet(AddDirFile(dir_orgfiles, string), giveplayer, y);
	format(giveplayer, 12, "ocz_%d", giveplayerid);
	dini_FloatSet(AddDirFile(dir_orgfiles, string), giveplayer, z);
	format(giveplayer, 12, "oca_%d", giveplayerid);
	dini_FloatSet(AddDirFile(dir_orgfiles, string), giveplayer, a);
	format(giveplayer, 12, "occ1_%d", giveplayerid);
	dini_IntSet(AddDirFile(dir_orgfiles, string), giveplayer, col1);
	format(giveplayer, 12, "occ2_%d", giveplayerid);
	dini_IntSet(AddDirFile(dir_orgfiles, string), giveplayer, col2);
	SetVehicleToRespawn(pvid);
	if (col1 == -1 || col2 == -1) orgvid[orgid-1][giveplayerid-1] = CreateVehicle2(model, x, y, z, a, 900);
	else
	{
		orgvid[orgid-1][giveplayerid-1] = CreateVehicle(model, x, y, z, a, col1, col2, 900);
		vmodelused[model-400] ++;
		if (vmodelused[model-400] == 1) vehiclemodels ++;
	}
	if (dini_Isset(AddDirFile(dir_orgfiles, string), "lplate"))
	{
		format(tmp, 24, "%s %d", dini_Get(AddDirFile(dir_orgfiles, string), "lplate"), giveplayerid);
		SetVehicleNumberPlate2(orgvid[orgid-1][giveplayerid-1], tmp);
		SetVehicleToRespawn(orgvid[orgid-1][giveplayerid-1]);
	}
	vorgo[orgvid[orgid-1][giveplayerid-1]] = orgid;
	vorgid[orgvid[orgid-1][giveplayerid-1]] = giveplayerid;
	SendPlayerFormattedText(playerid, COLOR_SILVER, "Vehicle '%s' has been added to '%s'.", vehName[model-400], dini_Get(AddDirFile(dir_orgfiles, string), "name"));
	return 1;
}
Reply
#2

there's no such a function for add a siren, u can only create a vehicle with siren imported.
Reply
#3

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
there's no such a function for add a siren, u can only create a vehicle with siren imported.
There's a function to add sirens into a vehicle, stop fucking talking when you don't know shit. I have a command on my gamemode will check it later and paste it here.
Reply
#4

Quote:
Originally Posted by willbedie
Посмотреть сообщение
There's a function to add sirens into a vehicle, stop fucking talking when you don't know shit. I have a command on my gamemode will check it later and paste it here.
yeah again trashtalk, U CANNT F&&CKING ATTACH A SOUND SIREN TO A VEHICLE.
P.S. waiting for you to give us this knowledge.
Reply
#5

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
yeah again trashtalk, U CANNT F&&CKING ATTACH A SOUND SIREN TO A VEHICLE.
P.S. waiting for you to give us this knowledge.
He said siren dude learn how to read, stop posting shit when you don't even know what you're talking about. I will post the code here later
Reply
#6

It should work that way.

Is CreateVehicle2 configured to support that extra parameter?
Are you consistently using the same method on all the occurrences of the function?

Mugalito, what is this? : https://www.youtube.com/watch?v=AFQUTIMDM9s
Reply
#7

Quote:
Originally Posted by denNorske
Посмотреть сообщение
I already said that u can ONLY IMPORT and cannot ATTACH a sound siren into a created vehicle.

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
there's no such a function for add a siren, u can only create a vehicle with siren imported.
if u know a function to add a siren into a created vehicle, than tell me.
Reply
#8

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
I already said that u can ONLY IMPORT and cannot ATTACH a sound siren into a created vehicle.



if u know a function to add a siren into a created vehicle, than tell me.
There's a function, if you're not sure about something then don't say it. Wait until i post the code here as i'm not home right now
Reply
#9

create and attach the object to the vehicle,then use proxdetector and
PHP код:
PlayerPlaySound 
to play the siren sound to nearby players.


PHP код:
http://wiki.sa-mp.com/wiki/SoundID
http://wiki.sa-mp.com/wiki/PlayerPlaySound 
Reply
#10

Quote:
Originally Posted by willbedie
Посмотреть сообщение
There's a function, if you're not sure about something then don't say it. Wait until i post the code here as i'm not home right now
yeah I'm waiting for u, no need to sleep the whole night.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)