Why isn't this working..
#1

ok this is really annoying me

I have made a timer that will check if a player is in a area and if he is , kill him..... but it isn't working!!
It's so annoying. oh yeah and I used a tutorial


I tried , i tested. now i just don't know. so i decided to post here.

timer:

pawn Код:
SetTimer("Checks",3000,1);
function:

pawn Код:
forward Checks();
public Checks()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) continue;
        if(IsPlayerInArea(i,-2931.596, -2981.811, 219.2902, -123.9217))
        {
           
            SetPlayerHealth(i,0);
        }
    }
    return 1;
}
Please help , thanks!
Reply
#2

Maybe you use wrong coordinates?
Reply
#3

Edit: Ignore me,
Reply
#4

pawn Код:
forward Checks();
public Checks()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
{
        if(IsPlayerInArea(i,-2931.596, -2981.811, 219.2902, -123.9217))
        {
           
            SetPlayerHealth(i,0);
 
}
   }
    }
    return 1;
}
The identitation sucks ... Hope it helped
Reply
#5

Quote:
Originally Posted by Berlovan
Посмотреть сообщение
pawn Код:
forward Checks();
public Checks()
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
{
        if(IsPlayerInArea(i,-2931.596, -2981.811, 219.2902, -123.9217))
        {
           
            SetPlayerHealth(i,0);
 
}
   }
    }
    return 1;
}
The identitation sucks ... Hope it helped
Didn't work , but thanks


area:

pawn Код:
stock IsPlayerInArea(playerid, Float:min_x, Float:max_x, Float:min_y, Float:max_y)
{
    new Float:pos[3]; //Save his position this this triple-var.
    GetPlayerPos(playerid,pos[0],pos[1],pos[2]); //Save his X in pos[0], his Y in pos[1] and his Z in pos[2].
    if(min_x <= pos[0] && max_x >= pos[0] && min_y <= pos[1] && max_y >= pos[1]) return 1; //Checks if the player is in the area, and if so returns 1.
    return 0; //Else it returns 0.
}
Willow: I'm sure they're right, i can upload a picture if you want.

picture
uploaded:

http://imageshack.us/photo/my-images/41/useryh.png/
Reply
#6

I also checked to see if my other timers were working and they are fine.
Oh and yeah , picture uploaded is above
Reply
#7

pawn Код:
forward Checks();
public Checks()
{
    print("DEBUG 1");
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) continue;
        if(IsPlayerInArea(i,-2931.596, -2981.811, 219.2902, -123.9217))
        {
            print("DEBUG 2");
            SetPlayerHealth(i,0);
        }
    }
    return 1;
}
Try this and check if it works
Reply
#8

Quote:
Originally Posted by gimini
Посмотреть сообщение
pawn Код:
forward Checks();
public Checks()
{
    print("DEBUG 1");
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) continue;
        if(IsPlayerInArea(i,-2931.596, -2981.811, 219.2902, -123.9217))
        {
            print("DEBUG 2");
            SetPlayerHealth(i,0);
        }
    }
    return 1;
}
Try this and check if it works
it spams DEBUG 1 in the console(when in the area)
and it doesn't work

EDIT: Even when im not in the area it spams it.
Reply
#9

If this timer works, then try to replace
pawn Код:
for(new i; i < MAX_PLAYERS; i++)
with this
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
If it still doesn't work, then I have no other ideas..
Reply
#10

pawn Код:
forward Checks();
public Checks()
{
    print("DEBUG 1");
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(IsPlayerInArea(i,-2931.596, -2981.811, 219.2902, -123.9217))
        {
            print("DEBUG 2");
            SetPlayerHealth(i,0);
        }
    }
    return 1;
}
pawn Код:
if(!IsPlayerConnected(i)) continue;
Tip for " countinue "
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)