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; }
PlayerPlaySound(playerid, 1153, 1656.4711, 2576.2517, 10.8535);
PlayerPlaySound(playerid, 1154, 1656.4711, 2576.2517, 10.8535);
for(new i = 0 < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoiint(i, 5.5, Gate_X, Gate_Y, Gate_Z))
{
PlayerPlaySound(i, 1153, 1656.4711, 2576.2517, 10.8535);
}
}
Loop through all the players. Then check if the player is in range of at least 5.5 from the gate object, then play the sound. It should be something like:
pawn Код:
|
House.pwn(1167) : error 001: expected token: ";", but found ")"
for(new i = 0; i < MAX_PLAYERS; i++)
for(new i = 0 < MAX_PLAYERS; i++)
When I added this, this comes up:
Код:
House.pwn(1167) : error 001: expected token: ";", but found ")" |
for(new i = 0; i < MAX_PLAYERS; i++)
It should be:
Код:
for(new i = 0; i < MAX_PLAYERS; i++) Код:
for(new i = 0 < MAX_PLAYERS; i++) |
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); H148GarageSound1(playerid); } 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); H148GarageSound1(playerid); } } } return 1; } forward H148GarageSound1(playerid); public H148GarageSound1(playerid) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInRangeOfPoint(i, 30, 1656.4711, 2576.2517, 10.8535)) { PlayerPlaySound(i, 1153, 1656.4711, 2576.2517, 10.8535); SetTimerEx("H148GarageSound2", 2000, false, "i", playerid); } } } forward H148GarageSound2(playerid); public H148GarageSound2(playerid) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerInRangeOfPoint(i, 30, 1656.4711, 2576.2517, 10.8535)) { PlayerPlaySound(i, 1154, 1656.4711, 2576.2517, 10.8535); } } }