public gatefront() { for(new i=0;i<MAX_PLAYERS; i++) { new PlayerName[24]; GetPlayerName(i, PlayerName, sizeof(PlayerName)); if(strfind(PlayerName[i], "[TT]", false) != -1) { if (PlayerToPoint(10.0, i,1970.0643,1764.3062,12.7157 ) && FrontGate_status == 0) { MoveObject(gatefront1, 1969.4080810547, 1761.0424804688, 17.521432876587,3); MoveObject(gatefront2, 1969.4031982422, 1767.6744384766, 17.521432876587,3); FrontGate_status = 1; } else if (!PlayerToPoint(10.0, i,1970.0643,1764.3062,12.7157 ) && FrontGate_status == 1) { MoveObject(gatefront1, 1969.4080810547, 1761.0424804688, 14.521432876587,3); MoveObject(gatefront2, 1969.4031982422, 1767.6744384766, 14.521432876587,3); FrontGate_status = 0; } } } } public gateback() { for(new i=0;i<MAX_PLAYERS; i++) { new PlayerName[24]; GetPlayerName(i, PlayerName, sizeof(PlayerName)); if(strfind(PlayerName[i], "[TT]", false) != -1) { if (PlayerToPoint(10.0, i,1918.0104,1969.7140,7.5938) && BackGate_status == 0) { MoveObject(gateback1,1917.3553466797, 1973.0606689453, 12.3714904785156,3); MoveObject(gateback2,1917.3598632813, 1966.2652587891, 12.3723287582397,3); BackGate_status = 1; } else if (!PlayerToPoint(10.0, i,1918.0104,1969.7140,7.5938) && BackGate_status == 1) { MoveObject(gateback1,1917.3553466797, 1973.0606689453, 9.3714904785156,3); MoveObject(gateback2,1917.3598632813, 1966.2652587891, 9.3723287582397,3); BackGate_status = 0; } } } }
forward gatefront(playerid);
forward gateback(playerid);
public OnPlayerConnect(playerid)
{
SetTimer("gatefront", 1000, true);
SetTimer("gateback", 1000, true);
}
public gatefront(playerid)
{
new FrontOpenGate;
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
if(strfind(name, "[TT]", true) != -1) {
if(IsPlayerInRangeOfPoint(i, 10, i, 1970.0643,1764.3062,12.7157)) FrontOpenGate = 1;
if(!IsPlayerInRangeOfPoint(i, 10, i, 1970.0643,1764.3062,12.7157)) FrontOpenGate = 0;
}
}
}
if(FrontOpenGate == 1) {
MoveObject(gatefront1, 1969.4080810547, 1761.0424804688, 17.521432876587, 3);
MoveObject(gatefront2, 1969.4031982422, 1767.6744384766, 17.521432876587,3); }
if(FrontOpenGate == 0) {
MoveObject(gatefront1, 1969.4080810547, 1761.0424804688, 14.521432876587,3);
MoveObject(gatefront2, 1969.4031982422, 1767.6744384766, 14.521432876587,3); }
}
public gateback(playerid)
{
new BackOpenGate;
for(new i=0; i<MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
new name[MAX_PLAYER_NAME];
GetPlayerName(i, name, sizeof(name));
if(strfind(name, "[TT]", true) != -1) {
if(IsPlayerInRangeOfPoint(i, 10, i, 1918.0104,1969.7140,7.5938)) BackOpenGate = 1;
if(!IsPlayerInRangeOfPoint(i, 10, i, 1918.0104,1969.7140,7.5938)) BackOpenGate = 0;
}
}
}
if(BackOpenGate == 1) {
MoveObject(gateback1,1917.3553466797, 1973.0606689453, 12.3714904785156,3);
MoveObject(gateback2,1917.3598632813, 1966.2652587891, 12.3723287582397,3); }
if(BackOpenGate == 0) {
MoveObject(gateback1,1917.3553466797, 1973.0606689453, 9.3714904785156,3);
MoveObject(gateback2,1917.3598632813, 1966.2652587891, 9.3723287582397,3); }
}
Originally Posted by doggeh
1 question, why you use the timers onplayerconnect, i used them at onfilterscriptinit/ongamemodeinit and why did you use i twice at IsPlayerInRangeOfPoint, isnt that btw a 0.3a function? my server is in 0.2x
|
if(strfind(PlayerName, "[TT]", false) != -1)
Originally Posted by doggeh
Well can you somehow make it for 0.2x please bcos my server is not in 0.3a...
another thing, why you forward it like this: forward gatefront(playerid); why that playerid? |