OnPlayerRequestSpawn
#1

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?
Reply
#2

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;
}
Reply
#3

Lol i gets lots of errors...
Reply
#4

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)