Audio Stream How do i complete this?
#1

Hello, i'm very new to sa-mp and im in the making of a Roleplay gamemode. i've got a car engine command ect. but i would like to play an audo in a 5 meter range of when the player types /engine they will hear the vehicle engine from 3 meters!

My Vehicle code
Код:
{
		new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
		vehicleid = GetPlayerVehicleID(playerid);
		if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
		GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
		if(engine == VEHICLE_PARAMS_ON)
		{   new string[128];
			format(string, sizeof(string), "* %s twists the key in the ignition, turning the engine off.", GetPlayerNameEx(playerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			SetVehicleEngine(vehicleid, playerid);
		}
		else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
		{   new string[128];
			SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
			SetTimerEx("SetVehicleEngine", 1000, 0, "dd",  vehicleid, playerid);
			format(string, sizeof(string), "* %s twists the key in the ignition, turning the engine on.", GetPlayerNameEx(playerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
		}
	}

I know how to add audio streams ect in but i would like to make it so like if the player is near other players they hear it to. within a 5 meter range.
Reply
#2

PHP код:
CMD:engine(playeridparams[])
{
    if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new 
vehicleidstring[128];
        
vehicleid GetPlayerVehicleID(playerid);
        if(
GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
        
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(
engine == VEHICLE_PARAMS_ON)
        {
            
SetVehicleEngine(vehicleidplayerid);
        }
        else if((
engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
        {
            
SetTimerEx("SetVehicleEngine"20000"dd",  vehicleidplayerid);
            if(
PlayerInfo[playerid][pMask] == 1) { format(stringsizeof(string), "Stranger has successfully started their Vehicle engine"); }
            else { 
format(stringsizeof(string), "* %s has successfully started their Vehicle engine",  GetPlayerNameEx(playerid)); }
              
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)