SA-MP Forums Archive
OnPlayerRequestSpawn - 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: OnPlayerRequestSpawn (/showthread.php?tid=200535)



OnPlayerRequestSpawn - Face9000 - 18.12.2010

Hi,i've a trouble:

Код:
public OnPlayerRequestSpawn(playerid)
{
    if(IsLogged[playerid] == 1)
   {
		return 1;
		}
		else ForceClassSelection(playerid);
        return SendClientMessage(playerid, COLOR_YELLOW, "ERROR: You can't spawn,maybe you arent registered or logged in.Use /register or /login");
 }
This is the code given to me in my another topic,i've edited a bit.

Now the problem is:

If im not logged in but i can spawn anyway,wtf?


Re: OnPlayerRequestSpawn - Benjo - 18.12.2010

You need to return 0 to stop them from spawning. Try this:
pawn Код:
if(IsLogged[playerid] == 1)
{
    return 1;
}
else
{
    SendClientMessage(playerid, COLOR_YELLOW, "ERROR: You can't spawn,maybe you arent registered or logged in.Use /register or /login");
    return 0;
}



Re: OnPlayerRequestSpawn - Face9000 - 18.12.2010

Lol i gets lots of errors...


Re: OnPlayerRequestSpawn - Mean - 18.12.2010

pawn Код:
if(IsLogged[playerid] == 1)
{
    return 1;
}
else
{
    return 0;
}
show the errors


Re: OnPlayerRequestSpawn - Benjo - 18.12.2010

Even though I'm 99% sure, I just test-compiled it under OnPlayerRequestSpawn callback and it worked fine. Check that you haven't got too many/too little brackets { }.

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(IsLogged[playerid] == 1)
    {
        return 1;
    }
    else
    {
        SendClientMessage(playerid, COLOR_YELLOW, "ERROR: You can't spawn,maybe you arent registered or logged in.Use /register or /login");
        return 0;
    }
}