auto gate
#1

what is this code problem?this works only for id 1 and upper.

Код:
public areagatecheck()
{
 	foreach(Player, i){
  	if(i < 101){
 		if(IsPlayerInRangeOfPoint(i, 15, 134.7061, 1941.5814, 21.6600)){
            if(gTeam[i] == TEAM_Internationalforces){
          		MoveObject(areagate1, 121.6021, 1941.5845, 21.6600, 5);}}
        else MoveObject(areagate1, 134.7061, 1941.5814, 21.6600, 5);
        if(IsPlayerInRangeOfPoint(i, 15, 286.0547, 1819.8330, 19.9611)){
            if(gTeam[i] == TEAM_Internationalforces){
          		MoveObject(areagate2, 286.0697, 1833.7720, 19.9611, 5);}}
   		else MoveObject(areagate2, 286.05475, 1819.83301, 19.96110, 5);
        return;}}}
Reply
#2

might be because your "foreach" starts with "i" as 1 instead of "0"...
In this case just use "i-1" each time within the loop
Reply
#3

Foreach syntax is:
PHP код:
foreach(new Player
Also I have no idea what this is supposed to do:
PHP код:
if(101
If your max players is 100 then redefine MAX_PLAYERS as such. Foreach only loops over connected players, which is one of its major design features.
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Foreach syntax is:
PHP код:
foreach(new Player
Also I have no idea what this is supposed to do:
PHP код:
if(101
If your max players is 100 then redefine MAX_PLAYERS as such. Foreach only loops over connected players, which is one of its major design features.
with this code, gates works only for id 0.
Reply
#5

pawn Код:
public areagatecheck()
{
    foreach(new i: Player)
    {
        if(i < 101){
            if(IsPlayerInRangeOfPoint(i, 15, 134.7061, 1941.5814, 21.6600))
            {
                if(gTeam[i] == TEAM_Internationalforces)
                {
                    MoveObject(areagate1, 121.6021, 1941.5845, 21.6600, 5);
                }
            }
            else MoveObject(areagate1, 134.7061, 1941.5814, 21.6600, 5);

            if(IsPlayerInRangeOfPoint(i, 15, 286.0547, 1819.8330, 19.9611))
            {
                if(gTeam[i] == TEAM_Internationalforces)
                {
                    MoveObject(areagate2, 286.0697, 1833.7720, 19.9611, 5);
                }
            }
            else MoveObject(areagate2, 286.05475, 1819.83301, 19.96110, 5);

            // return; Removes the iteration.
        }
    }
}
Reply
#6

not works.gates works only for 0
Reply
#7

What does
PHP код:
if(101
even do?

Remove that and try again?
Reply
#8

not works for all player.
Reply
#9

I need this code. please help.
Reply
#10

Quote:
Originally Posted by GeneralAref
Посмотреть сообщение
I need this code. please help.
Stop spam,

try this

PHP код:
public areagatecheck()
{
    foreach(new 
iPlayer)
    {
            if(
IsPlayerInRangeOfPoint(i15134.70611941.581421.6600))
            {
                if(
gTeam[i] == TEAM_Internationalforces)
                {
                    
MoveObject(areagate1121.60211941.584521.66005);
                }
            }
            else 
MoveObject(areagate1134.70611941.581421.66005);
            if(
IsPlayerInRangeOfPoint(i15286.05471819.833019.9611))
            {
                if(
gTeam[i] == TEAM_Internationalforces)
                {
                    
MoveObject(areagate2286.06971833.772019.96115);
                }
            }
            else 
MoveObject(areagate2286.054751819.8330119.961105);
            
// return; Removes the iteration.
        
}
    }

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)