jeudi 31 juillet 2014

Play Sound for Nearby Players

Sorry, if i might not get some things or terms. I am fairly new to scripting and have only used scripting for mapping.



So I am trying to play a sound when people enter a command to open a garage. I am trying to make it so that all near by players will have the sounds played, but I have not figured out how to do it. If someone could please help me, it would really appreciated.





Command for Opening/Closing garage:


Code:



CMD:garage(playerid, params[])

{

new Float: x, Float: y, Float: z;

GetDynamicObjectPos(H148Gate, x, y, z);

if(IsPlayerInRangeOfPoint(playerid, 30, x, y, z))

{

switch(H148GarageOpen)

{

case 0:

{

H148GarageOpen = 1;

new string[128];

format(string, sizeof(string), "* %s uses their remote to open the garage.", GetName(playerid));

NearByMessage(playerid, 0x9A2EFEFF, string);

MoveDynamicObject(H148Garage, 1656.53455, 2575.88188, 12.24580, 0.5, 0.00000, -90.00000, 90.00000);

MoveDynamicObject(H148GarageCol1, 1657.35132, 2576.01870, 12.25530, 0.5, 0.00000, -90.00000, 90.00000);

MoveDynamicObject(H148GarageCol2, 1655.71033, 2576.01870, 12.25530, 0.5, 0.00000, -90.00000, 90.00000);

}

case 1:

{

H148GarageOpen = 0;

new string[128];

format(string, sizeof(string), "* %s uses their remote to close the garage.", GetName(playerid));

NearByMessage(playerid, 0x9A2EFEFF, string);

MoveDynamicObject(H148Garage, 1656.53455, 2576.24587, 11.12580, 0.5, 0.00000, 0.00000, 90.00000);

MoveDynamicObject(H148GarageCol1, 1657.35132, 2576.29858, 11.61530, 0.5, 0.00000, 0.00000, 90.00000);

MoveDynamicObject(H148GarageCol2, 1655.71033, 2576.29858, 11.61530, 0.5, 0.00000, 0.00000, 90.00000);

}

}

}

return 1;

}



Code for the sound that needs to be played and then another sound that needs to be played 3 seconds after the first sound has been played.

First Sound:


Code:



PlayerPlaySound(playerid, 1153, 1656.4711, 2576.2517, 10.8535);


Second Sound 2 secs later:


Code:



PlayerPlaySound(playerid, 1154, 1656.4711, 2576.2517, 10.8535);


Thanks and sorry, if I'm just asking you to do all the work. I've tried to the best of my knowledge of scripting but have not been able to do it.




Aucun commentaire:

Enregistrer un commentaire