Gates Doesn't work for ID:0 players
#1

pawn code:
pawn Код:
#include <a_samp>
#include <zcmd>
#pragma tabsize 0

forward CheckGate();
new Gate1;
new Gate2;


public OnFilterScriptInit()
{
    SetTimer("CheckGate", 1000, true);
    CreateObject(966, 1328.35, -1385.73, 12.53, 0.0, 0.0, 0.0); // Gate1 talp
    Gate1 = CreateObject(968, 1328.33, -1385.72, 13.25, 0.0, -90.0, 0.0);
    CreateObject(966, 1722.78, 1611.90, 9.10, 0.00, 0.00, 70.20);
    Gate2 = CreateObject(968, 1722.76, 1611.90, 9.88, 0.00, -90.00, 70.25);
    print("\n--------------------------------------");
    print(" Gates! ");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public CheckGate()
{
 for(new i=0; i !=MAX_PLAYERS; i++)
    {
     if(IsPlayerConnected(i))
        {
            if(IsPlayerInRangeOfPoint(i, 5.00, 1325.0199,-1387.8572,13.6263))
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    MoveObject(Gate1, 1328.33, -1385.72, 13.25+0.0001, 0.0001, 0.0, 0.0, 0.0); //Nyilik
                }
                else
                {
                    SendClientMessage(i, 0x00FF00AA, "You are not in any vehicle.");
                }
            }
            else
            {
                MoveObject(Gate1, 1328.33, -1385.72, 13.25, 0.0001, 0.0, -90.0, 0.0); // Csukodik
            }

            if(IsPlayerInRangeOfPoint(i, 5.00, 1727.40, 1608.18, 8.91))
            {
                if(IsPlayerInAnyVehicle(i))
                {
                    MoveObject(Gate2, 1722.76, 1611.90, 9.88+0.0001, 0.0001, 0.00, 0.00, 70.25); //Nyilik
                }
                else
                {
                    SendClientMessage(i, 0x00FF00AA, "You are not in any vehicle.");
                }
            }
            else
            {
                MoveObject(Gate2, 1722.76, 1611.90, 9.88, 0.0001, 0.00, -90.00, 70.25); // Csukodik
            }
        }
    }
    return 0;
}
When 2 or more players are in the server One of the player who has ID:0 Nothing happened, anybody can help me?

Where is the problem? :S
Reply
#2

use
pawn Код:
for fucking code
Quote this post and see the magic
Reply
#3

Maybe try
pawn Код:
return 1;
Reply
#4

From what I gather, that's only going to work if ALL players are within the radius. What you need to do is check if ANY players are there, set a variable to 1, then outside the loop open/close accordingly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)