SA-MP Train Airhorn - 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: SA-MP Train Airhorn (
/showthread.php?tid=472060)
SA-MP Train Airhorn -
Sewayne - 26.10.2013
In some sa-mp servers I have realized that an airhorn sound is used (for example: It is used to start a race, or a deathmatch after countdown is finished).
Im wondering if there is a way to make this a train horn.
For Example:
When driving a train, you press a certain key and the airhorn sound is played, and only nearby players can hear it.
Re: SA-MP Train Airhorn -
Mattakil - 26.10.2013
Yes it is possible.
under public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 537 || 538)
{
if((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(vehicleid, X, Y, Z);
if(IsPlayerInRangeOfPoint(i, 40, X, Y, Z);
{
PlayerPlaySound(i, 3201, 0, 0, 0);
}
}
}
return 1;
}
Note: This is untested, and this little chat box makes it hard to see what you're doing. I reccomend making something similar to this and not just copy+paste.
Re: SA-MP Train Airhorn -
Sewayne - 26.10.2013
Thanks, I will try it
Re: SA-MP Train Airhorn -
iFiras - 26.10.2013
You can use PlayerPlaySound to hear any sound you would like to hear
Visit SA-MP Wiki for more info:
https://sampwiki.blast.hk/wiki/PlayerPlaySound
And to know some sound ID's & hear 'em use SA-MP Sound ID Browser from here:
https://sampforum.blast.hk/showthread.php?tid=373017
Re: SA-MP Train Airhorn -
Sewayne - 26.10.2013
It works as I expected MattaKil, I want to give you +reputation but Ive given out MAX reputations today
Re: SA-MP Train Airhorn -
Mattakil - 26.10.2013
Quote:
Originally Posted by Sewayne
It works as I expected MattaKil, I want to give you +reputation but Ive given out MAX reputations today
|
lol no prob man, anyhow you can change the 40 to whatever you want, basically if you are within 40 units of the vehicle you will hear the noise