01.09.2010, 12:02
hi..
I made a timer which is constantly checking if a player is in range of several points...
those points are points of gates which should auto-open and auto-close..
the opening is no problem though...
For the close I wanted to do some kind of "SetTimerEx" and use "objectid" instead of "playerid"...
it doesn't work -.-
Here is what I got, maybe you can fix it or can tell me how to
I made a timer which is constantly checking if a player is in range of several points...
those points are points of gates which should auto-open and auto-close..
the opening is no problem though...
For the close I wanted to do some kind of "SetTimerEx" and use "objectid" instead of "playerid"...
it doesn't work -.-
Here is what I got, maybe you can fix it or can tell me how to
Код:
forward moveback(objectid); forward gatecheck(objectid); public gatecheck(objectid) { for(new i=0; i<MAX_PLAYERS; i++){ if(IsPlayerConnected(i)){ if(IsPlayerInRangeOfPoint(i, 8.0,1550.27575684,-1698.06298828,27.36819077) || IsPlayerInRangeOfPoint(i, 8.0,1544.19995117,-1630.96655273,12.38281250)){ if(IsPlayerInRangeOfPoint(i, 8.0, 1550.27575684,-1698.06298828,27.36819077)){ if(PlayerFaction[i][police] == 1){ if(ObjectData[lspdg1][down] == 0){ MoveObject(lspdg1, 1550.27539062,-1698.06250000,12.61819077, 1.00); SetTimerEx("moveback", 5000, false, "i", objectid); ObjectData[lspdg1][down] = 1; } } } if(IsPlayerInRangeOfPoint(i, 8.0, 1544.19995117,-1630.96655273,12.38281250)){ if(PlayerFaction[i][police] == 1){ if(ObjectData[lspdg2][down] == 0){ MoveObject(lspdg2,1544.17443848,-1623.71582031,12.38281250, 2.00); SetTimerEx("moveback", 5000, false, "i", objectid); ObjectData[lspdg2][down] = 1; } } } } } } return 1; } public moveback(objectid) { if(objectid == lspdg1){ ObjectData[lspdg1][down] = 0; MoveObject(lspdg1,1550.27575684,-1698.06298828,27.36819077, 1.00); }else if(objectid == lspdg2){ ObjectData[lspdg2][down] = 0; MoveObject(lspdg2,1544.19995117,-1630.96655273,12.38281250, 2.00); } return 1; }