03.07.2013, 14:29
Hello i need a code for setting a sound when the gate is opening , thanks
Or instead of a timer
https://sampwiki.blast.hk/wiki/OnObjectMoved |
"instead of a timer" In your post you said to use a timer to detect the end of the movement of the gate and thus stop playing the sound, park4bmx was simply pointing out that that isn't needed.
|
new object;
new gatemoved;
gatemoved = 0;
object = CreateObject(1518, 5, 5, 3, 0, 0, 0); //change this
if (strcmp("/opengate", cmdtext, true, 10) == 0)
{
if(gatemoved == 0)
{
PlayerPlaySound(playerid, 1153, 5, 5, 3.0); //change coordinates here
MoveObject(object, 1, 1, 3, 2); //change coordinates here
gatemoved = 1;
}
else if(gatemoved == 1)
{
PlayerPlaySound(playerid, 1153, 5, 5, 3.0); //change coordinates here
MoveObject(object, 5, 5, 3, 2); //change coordinates here
gatemoved = 0;
}
return 1;
}
public OnObjectMoved(objectid)
{
new playerid;
PlayerPlaySound(playerid, 1154, 5, 5, 3.0); //change coordinates here
}