[HELP] Automatic gates
#1

Doors wont open for other ppls even they are rcon admins, doors open just for me (admin).
pawn Код:
public Gate1Check(playerid)
{
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, 2668.81933594,3961.33203125,5.57493210))
            {
                MoveDynamicObject(lab1, 2668.81933594,3961.33227539,8.58553982, 5.0);
            }
            else
            {
                MoveDynamicObject(lab1, 2668.81933594,3961.33203125,5.57493210, 5.0);
            }
        }
    }
Reply
#2

I assume you're calling that function using a timer? Can we see the timer and its context?
Reply
#3

And you didn't set it only for admin!
Reply
#4

why u dont use SetTimer o_0
and btw where is that if(!IsPlayerAdmin)) return SendClientMessage(playerid, COLLOR, "Sorry, you are not RCON admin.");

if u searching this ...
Reply
#5

I DONT SAID THT, THIS CODE ONLY FOR ADMIN, I SAID THT WHAT THESE DOORS CAN B OPEN JUST FOR ME ! FOR ME! AND ONLY FOR ME!!!!!!!!!!!!!!!!!

SO WHY OTHER CANT OPEN THESE DOORS!?

This is the full code

pawn Код:
public OnFilterScriptInit()
{
    SetTimer("GateCheck", 500, true);
    boxes = CreateDynamicObject(18260,2680.30444336,3969.71020508,7.33100510,0.00000000,0.00000000,311.23046875);

    SetTimer("Gate1Check", 500, true);
    lab1 = CreateDynamicObject(2951,2668.81933594,3961.33203125,5.57493210,0.00000000,0.00000000,312.12707520); //object(a51_labdoor) (3)

    SetTimer("Gate2Check", 500, true);
    lab2 = CreateDynamicObject(2951,2657.72460938,3950.75073242,5.57493210,0.00000000,0.00000000,312.12707520); //object(a51_labdoor) (2)

    SetTimer("Gate3Check", 500, true);
    lab3 = CreateDynamicObject(2951,2667.74267578,3967.53808594,5.57493210,0.00000000,0.00000000,224.78771973); //object(a51_labdoor) (3)

    SetTimer("Gate4Check", 500, true);
    lab4 = CreateDynamicObject(2951,2658.64379883,3976.94995117,5.57493210,0.00000000,0.00000000,224.78576660); //object(a51_labdoor) (4)

    return 1;
}
public GateCheck(playerid)
{
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, 2681.29, 3972.49, 6.76))
            {
                MoveDynamicObject(boxes, 2683.57153320,3966.04736328,7.33100510, 5.0);
            }
            else
            {
                MoveDynamicObject(boxes, 2680.30444336,3969.71020508,7.33100510, 5.0);
            }
        }
   }

//--------- Research gates nr 1 --------------

public Gate1Check(playerid)
{
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, 2668.81933594,3961.33203125,5.57493210))
            {
                MoveDynamicObject(lab1, 2668.81933594,3961.33227539,8.58553982, 5.0);
            }
            else
            {
                MoveDynamicObject(lab1, 2668.81933594,3961.33203125,5.57493210, 5.0);
            }
        }
    }

//--------- Research gates nr 2 --------------
public Gate2Check(playerid)
{
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, 2657.72460938,3950.75073242,5.57493210))
            {
                MoveDynamicObject(lab2, 2657.72460938,3950.75000000,8.58553982, 5.0);
            }
            else
            {
                MoveDynamicObject(lab2, 2657.72460938,3950.75073242,5.57493210, 5.0);
            }
        }
    }

//--------- Research gates nr 3 --------------
public Gate3Check(playerid)
{
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, 2667.74267578,3967.53808594,5.57493210))
            {
                MoveDynamicObject(lab3, 2667.74218750,3967.53808594,8.58553982, 5.0);
            }
            else
            {
                MoveDynamicObject(lab3, 2667.74267578,3967.53808594,5.57493210, 5.0);
            }
        }
    }

//--------- Research gates nr 4 --------------


public Gate4Check(playerid)
{
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, 2658.64379883,3976.94995117,5.57493210))
            {
                MoveDynamicObject(lab4, 2658.64355469,3976.94921875,8.58553982, 5.0);
            }
            else
            {
                MoveDynamicObject(lab4, 2658.64379883,3976.94995117,5.57493210, 5.0);
            }
        }
    }
Reply
#6

Well there's your problem, you need to pass a parameter to the "GateCheck" function as it's expecting a parameter, which you've named playerid. Pawn cannot guess what the playerid is supposed to be, you need to tell it, like so:

pawn Код:
SetTimerEx("GateCheck", 500, true, "i", playerid);
Then you're actually giving the "GateCheck" function the parameter it needs and the playerid value in that function doesn't default to 0, therefore it will work for other playerids.
Reply
#7

Your also running alot of timers for gates. Make one timer and check which gate etc using vars.

Note: not related to your problem although it saves setting 5+ timers at 500ms each.
Reply
#8

pawn Код:
SetTimerEx("GateCheck", 500, true, "i", playerid);
    boxes = CreateDynamicObject(18260,2680.30444336,3969.71020508,7.33100510,0.00000000,0.00000000,311.23046875);

    SetTimerEx("Gate1Check", 500, true, "i", playerid);
    lab1 = CreateDynamicObject(2951,2668.81933594,3961.33203125,5.57493210,0.00000000,0.00000000,312.12707520); //object(a51_labdoor) (3)

    SetTimerEx("Gate2Check", 500, true, "i", playerid);
    lab2 = CreateDynamicObject(2951,2657.72460938,3950.75073242,5.57493210,0.00000000,0.00000000,312.12707520); //object(a51_labdoor) (2)

    SetTimerEx("Gate3Check", 500, true, "i", playerid);
    lab3 = CreateDynamicObject(2951,2667.74267578,3967.53808594,5.57493210,0.00000000,0.00000000,224.78771973); //object(a51_labdoor) (3)

    SetTimerEx("Gate4Check", 500, true, "i", playerid);
    lab4 = CreateDynamicObject(2951,2658.64379883,3976.94995117,5.57493210,0.00000000,0.00000000,224.78576660); //object(a51_labdoor) (4)

    return 1;
pawn Код:
D:\SERVER~3\FILTER~1\miestas.pwn(811) : error 017: undefined symbol "playerid"
D:\SERVER~3\FILTER~1\miestas.pwn(814) : error 017: undefined symbol "playerid"
D:\SERVER~3\FILTER~1\miestas.pwn(817) : error 017: undefined symbol "playerid"
D:\SERVER~3\FILTER~1\miestas.pwn(820) : error 017: undefined symbol "playerid"
D:\SERVER~3\FILTER~1\miestas.pwn(823) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
Reply
#9

Well you need to define playerid too, I'm not sure I understand your logic actually. How are you planning on picking the player that it's supposed to operate for if the callback you're initiating the timer in doesn't actually pass any parameter to suggest a playerid?
Reply
#10

My bad english, i dont know how to fix that and now im looking like "rage guy". End...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)