I need help with my train horn - 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: I need help with my train horn (
/showthread.php?tid=579821)
I need help with my train horn -
tboysamp - 30.06.2015
'm trying to get this code working will not work if anybody can get this work I would appreciate help
Код:
if((newkeys & KEY_CROUCH) && !(oldkeys & KEY_CROUCH))
{
TrainAirhornSwitch(playerid);
}
TrainAirhornSwitch(playerid)
{
new vid = GetPlayerVehicleID(playerid);
if( vid == 537|| vid == 538)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(vid, X, Y, Z);
if(IsPlayerInRangeOfPoint(vid, 30, X, Y, Z))
{
PlayerPlaySound(vid, 3201, 0, 0, 0);
}
}
}
return 1;
}
Re: I need help with my train horn -
RoboN1X - 30.06.2015
Use
GetVehicleModel
Код:
TrainAirhornSwitch(playerid)
{
new vid = GetPlayerVehicleID(playerid);
new vmodel = GetVehicleModel(vid);
if(vmodel == 537|| vmodel == 538)
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(vid, X, Y, Z);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i, 30, X, Y, Z))
{
PlayerPlaySound(i, 3201, 0, 0, 0);
}
}
}
return 1;
}
Also it would be the best if the sound plays from the train position than max volume at player's position, maybe?
Код:
PlayerPlaySound(i, 3201, X, Y, Z);
Re: I need help with my train horn -
tboysamp - 30.06.2015
it works thanks you're the best