What is wrong ?
#1

what is wrong to prevent player spawn ?



Код:
public OnPlayerRequestSpawn(playerid)
{
    if(UserLogged[playerid] == 0)
    {
        format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `Name` = '%s' LIMIT 1", GetPlayerNameEx(playerid));
        mysql_query(Query);
        mysql_store_result();
        if(!mysql_num_rows()) 
        {
            ShowPlayerDialog(playerid, DIALOG_REG, DIALOG_STYLE_PASSWORD, "register", "insert a password \n register your account", "register", "");
			return 0;
		}
        else
        {
            ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "login", "insert a password \n login into your account", "login", "");
            return 0;
        }
    }
    return 1;
}
Reply
#2

OnPlayerSpawn, Give us that.
Reply
#3

but I do not have to spawn the player, if you click on spawn both in the register login that
Reply
#4

bump
Reply
#5

Try this:

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    TogglePlayerSpectating(playerid, 1);
    if(UserLogged[playerid] == 0)
    {
        format(Query, sizeof(Query), "SELECT * FROM `users` WHERE `Name` = '%s' LIMIT 1", GetPlayerNameEx(playerid));
        mysql_query(Query);
        mysql_store_result();
        if(!mysql_num_rows())
        {
            ShowPlayerDialog(playerid, DIALOG_REG, DIALOG_STYLE_PASSWORD, "register", "insert a password \n register your account", "register", "");
            return 0;
        }
        else
        {
            ShowPlayerDialog(playerid, DIALOG_LOG, DIALOG_STYLE_PASSWORD, "login", "insert a password \n login into your account", "login", "");
            return 0;
        }
    }
    return 1;
}
Reply
#6

but if you logging, you stay spectating ... in the other codes I set it to 0 right?
Reply
#7

In your first post you said players could just press the "spawn" botton to spawn, without registering or login.
The code I posted will fix that problem, and you dont need to use the /TogglePlayerSpectating(playerid, 1);/ anymore in the script. It's simply to take away the " << >> SPAWN " dialog at start-up.
Reply
#8

but if you put the password you must login or register to the spawn
Reply
#9

When you enter the game, the login or register dialog will pop up, yes. If that was your question.
Reply
#10

but my code is correct, when logged in I am spawn, in the register not and this is ok... in the login is problem..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)