HELP! ERROR
#1

pawn Код:
public Gate3Check(playerid)
{
        if(IsPlayerConnected(playerid)) continue;
        {
            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);
            }
        }
    }
and i have this error
pawn Код:
error 024: "break" or "continue" is out of context
by this line
pawn Код:
if(IsPlayerConnected(playerid)) continue;
Reply
#2

Is there a valid reason you have 'continue' there ?
Reply
#3

You do not need brackets when you use it like that, try this:

pawn Код:
public Gate3Check(playerid)
{
    if(IsPlayerConnected(playerid)) continue;
    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);
    }
}
Reply
#4

Please, learn to code before you atempt to help others.



Just delete the continue
Reply
#5

Quote:
Originally Posted by dice7
Посмотреть сообщение
Is there a valid reason you have 'continue' there ?
yes because doors wont open for other people just for me
Reply
#6

Quote:
Originally Posted by dice7
Посмотреть сообщение
Please, learn to code before you atempt to help others.



Just delete the continue
He wanted to fix the errors, and it works like this, where is your try to fix the error? i cant see it.
@Darien: Can we see the part where it calls this function?
Reply
#7

Quote:
Originally Posted by DVDK
Посмотреть сообщение
He wanted to fix the errors, and it works like this, where is your try to fix the error? i cant see it.
nooo
\
Reply
#8

Quote:
Originally Posted by DVDK
Посмотреть сообщение
He wanted to fix the errors, and it works like this, where is your try to fix the error? i cant see it.
Did you atleast try to compile your code ? No, because it will give the same errors as op has.


Darien, 'continue' is used in loops, read the samp wiki or the pawn documentation on how to use it. If you want the gates to open only for you, you need to check the players name and not the id, since 'playerid' isn't a constant value, it changes when players trigger events so that It's their id on certain events, so the script knows which player is doing what (eg connecting (OnPlayerConnect))
Reply
#9

Quote:
Originally Posted by dice7
Посмотреть сообщение
Did you atleast try to compile your code ? No, because it will give the same errors as op has.


Darien, 'continue' is used in loops, read the samp wiki or the pawn documentation on how to use it. If you want the gates to open only for you, you need to check the players name and not the id, since 'playerid' isn't a constant value, it changes when players trigger events so that It's their id on certain events, so the script knows which player is doing what (eg connecting (OnPlayerConnect))
Did you atleast try to fix your code?
I fixed at least 1 error, that's a way to go.

@OP: Try this:
Код:
if(!IsPlayerConnected(playerid)) return 1;
Reply
#10

Quote:
Originally Posted by DVDK
Посмотреть сообщение
Did you atleast try to fix your code?
I fixed at least 1 error, that's a way to go.

@OP: Try this:
Код:
if(!IsPlayerConnected(playerid)) return 1;
D:\SERVER~3\FILTER~1\miestas.pwn(842) : warning 209: function "GateCheck" should return a value
D:\SERVER~3\FILTER~1\miestas.pwn(859) : warning 209: function "Gate1Check" should return a value
D:\SERVER~3\FILTER~1\miestas.pwn(875) : warning 209: function "Gate2Check" should return a value
D:\SERVER~3\FILTER~1\miestas.pwn(891) : warning 209: function "Gate3Check" should return a value
D:\SERVER~3\FILTER~1\miestas.pwn(909) : warning 209: function "Gate4Check" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


9 Warnings.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)