SA-MP Forums Archive
[RESOVLED]Empty Statement(PlayerToPoint) and Checkpoints - 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: [RESOVLED]Empty Statement(PlayerToPoint) and Checkpoints (/showthread.php?tid=84670)



[RESOVLED]Empty Statement(PlayerToPoint) and Checkpoints - Yuryfury - 02.07.2009

I have two quick questions
--------------------------
(1) I have a timer that checks if a player is near a certatin position, if true creates a checkpoint.

pawn Код:
public timer()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(PlayerToPoint(10.0,i,-2047.0293,-100.7723,35.1641)==0);//line 47
        {
            SetPlayerCheckpoint(i,-2047.0293,-100.7723,35.1641,10);
        }
    }
}
I get the error that line 47 is an empty statement.
----------------------------------------------------------------------------------------
(2) Also I have multiple checkpoints that are activated at a certain time. Under "OnPlayerEnterCheckpoint" how can I make it so that a different thing happens for each checkpoint? Is there a way to define them?

Thanks!


Re: Empty Statement(PlayerToPoint) and Checkpoints - Moustafa - 02.07.2009

remove the ==0 thingy i guess


Re: Empty Statement(PlayerToPoint) and Checkpoints - Yuryfury - 02.07.2009

Quote:
Originally Posted by Moustafa
remove the ==0 thingy i guess
That is what I had at first; same problem.


Re: [STILL UNAWNSERED]Empty Statement(PlayerToPoint) and Checkpoints - Yuryfury - 02.07.2009

Anyone? Other scripts have it formated exactly the same but this one says empty statement


Re: [STILL UNAWNSERED]Empty Statement(PlayerToPoint) and Checkpoints - Correlli - 02.07.2009

pawn Код:
if(PlayerToPoint(10.0,i,-2047.0293,-100.7723,35.1641)==0);
should be:
pawn Код:
if(PlayerToPoint(10.0,i,-2047.0293,-100.7723,35.1641)==0)
You forgot to remove ;


Re: [STILL UNAWNSERED]Empty Statement(PlayerToPoint) and Checkpoints - woot - 02.07.2009

(1)
pawn Код:
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(PlayerToPoint(10.0,i,-2047.0293,-100.7723,35.1641))
        {
            SetPlayerCheckpoint(i,-2047.0293,-100.7723,35.1641,10);
        }
    }
}
(2) You cant have multiple checkpoints at once, unless using a streamer. If using a streamer, theres normally a guide within it.


Re: [STILL UNAWNSERED]Empty Statement(PlayerToPoint) and Checkpoints - refshal - 02.07.2009

pawn Код:
forward timer();
public timer()
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(PlayerToPoint(10.0,i,-2047.0293,-100.7723,35.1641)==0)
{
SetPlayerCheckpoint(i,-2047.0293,-100.7723,35.1641,10);
return 0;
}
Just another suggestion.


Re: [STILL UNAWNSERED]Empty Statement(PlayerToPoint) and Checkpoints - Lewwy - 02.07.2009

pawn Код:
forward timer();
public timer()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(PlayerToPoint(10.0, i, -2047.0293, -100.7723, 35.1641))
        {
            SetPlayerCheckpoint(i,-2047.0293,-100.7723,35.1641,10);
            return 1;
        }
    }
    return 1;
}
Try that, it probably isn't right but oh well, most likely it's not what you wanted. :P


Re: [STILL UNAWNSERED]Empty Statement(PlayerToPoint) and Checkpoints - Yuryfury - 02.07.2009

Quote:
Originally Posted by Don Correlli
pawn Код:
if(PlayerToPoint(10.0,i,-2047.0293,-100.7723,35.1641)==0);
should be:
pawn Код:
if(PlayerToPoint(10.0,i,-2047.0293,-100.7723,35.1641)==0)
You forgot to remove ;
Thanks! I can't believe that I didn't notice that :P

Also thanks to everyone else for helping


Re: [STILL UNAWNSERED]Empty Statement(PlayerToPoint) and Checkpoints - Donny_k - 02.07.2009

pawn Код:
{
    for(new i = 0, j = GetMaxPlayers(); i < j; i++)
Would be better to use that type of loop if you are going to use GetMaxPlayers as it will save a ton of function calls (won't effect sync) or better yet adjust your MAX_PLAYERS using:

pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS //(some number here)