SA-MP Forums Archive
Siren sound for regular vehicles - 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: Siren sound for regular vehicles (/showthread.php?tid=649086)



Siren sound for regular vehicles - ItzColaBoi - 02.02.2018

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;
}



Re: Siren sound for regular vehicles - Mugala - 02.02.2018

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


Re: Siren sound for regular vehicles - solstice_ - 02.02.2018

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.


Re: Siren sound for regular vehicles - Mugala - 02.02.2018

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.


Re: Siren sound for regular vehicles - solstice_ - 02.02.2018

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


Re: Siren sound for regular vehicles - denNorske - 02.02.2018

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


Re: Siren sound for regular vehicles - Mugala - 02.02.2018

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.


Re: Siren sound for regular vehicles - solstice_ - 02.02.2018

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


Re: Siren sound for regular vehicles - PepsiCola23 - 02.02.2018

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 



Re: Siren sound for regular vehicles - Mugala - 02.02.2018

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.