Ok, i need script that will open and close gates for all players!
I do this: + playerplaysound
pawn Код:
forward CheckGate();
public CheckGate()
{
for(new i=0; i<GetMaxPlayers(); i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i, 12.0, 213.8831,1875.3693,13.1470) && OpenGate0 == 0)
{
MoveObject(a51_desna,207.838668,1875.358276,13.885452,1.0);
MoveObject(a51_leva,219.970260,1875.358276,13.885452,1.0);
PlayerPlaySound(i, 1165, 213.8831, 1875.3693, 13.1470);
OpenGate0 = 1; //i cant do without this, because i cant use than sound for close downstairs
}
else if(!IsPlayerInRangeOfPoint(i, 12.0, 213.8831,1875.3693,13.1470) && OpenGate0 == 1)
{
MoveObject(a51_desna,211.854766,1875.358276,13.885452,1.0);
MoveObject(a51_leva,215.952407,1875.358276,13.885452,1.0);
PlayerPlaySound(i, 1165, 213.8831, 1875.3693, 13.1470);
OpenGate0 = 0;
}
}
}
public OnObjectMoved(objectid)
{
new Float:x, Float:y, Float:z;
GetObjectPos(objectid, x, y, z);
for(new i=0; i<GetMaxPlayers(); i++)
{
if(objectid == a51_desna && x==207.838668 && y==1875.358276 && z==13.885452 && OpenGate0 == 1)
{
PlayerPlaySound(playerid, 1166, 213.8831, 1875.3693, 13.1470); //stop sound
}
if(objectid == a51_desna && x==211.854766 && y==1875.358276 && z==13.885452 && OpenGate0 == 0)
{
PlayerPlaySound(playerid, 1166, 213.8831, 1875.3693, 13.1470); //stop sound
}
}
}
I do this. Itworks all included sounds. Sounds are the same like in original gates (transfender)... And i asking... Will that object movements be seen for all players
And how can i do, that this sound will be heared for all players, not only for player who enter in the range of point??
thank you