SA-MP Forums Archive
HELP! ERROR - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: HELP! ERROR (/showthread.php?tid=219008)



HELP! ERROR - Darien - 31.01.2011

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;



Re: HELP! ERROR - dice7 - 31.01.2011

Is there a valid reason you have 'continue' there ?


Re: HELP! ERROR - DVDK - 31.01.2011

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);
    }
}



Re: HELP! ERROR - dice7 - 31.01.2011

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



Just delete the continue


Re: HELP! ERROR - Darien - 31.01.2011

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


Re: HELP! ERROR - DVDK - 31.01.2011

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?


Re: HELP! ERROR - Darien - 31.01.2011

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
\


Re: HELP! ERROR - dice7 - 31.01.2011

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))


Re: HELP! ERROR - DVDK - 31.01.2011

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;



Re: HELP! ERROR - Darien - 31.01.2011

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.