I need help with my train horn
#1

'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;
}
Reply
#2

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);
Reply
#3

it works thanks you're the best
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)