Need help with SpawnPlayer (auto spawn)
#1

Hi, how can I do that when player login he will be auto spawned? I'm using https://sampforum.blast.hk/showthread.php?tid=659037 this gamemode. Code:

pawn Code:
public OnPlayerConnect(playerid)
{
    new query[200], version[16];
    mysql_format(Database, query, sizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e'", GetName(playerid));
    mysql_tquery(Database, query, "CheckAccount", "d", playerid);
    return 1;
}
pawn Code:
forward OnPasswordChecked(playerid);
public OnPasswordChecked(playerid)
{
    new bool:match = bcrypt_is_equal();
    if(match)
    {
        new query[300];
        mysql_format(Database, query, sizeof(query), "SELECT * FROM `players` WHERE `Username` = '%e'", GetName(playerid));
        mysql_tquery(Database, query, "OnPlayerLoad", "d", playerid);
        TogglePlayerSpectating(playerid, false);
        SpawnPlayer(playerid);
    }
    else
    {
        new string[100];
        format(string, sizeof(string), "Wrong Password!\nPlease type your correct password below.");
        Dialog_Show(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login to our server", string, "Register", "Dip");
    }
    return 1;
}
Also I tried to put there:
pawn Code:
forward OnPlayerLoad(playerid);
public OnPlayerLoad(playerid)
{
    cache_get_value_name_int(0, "ID", PlayerInfo[playerid][user_id]);
    cache_get_value_name_int(0, "Cash", PlayerInfo[playerid][user_cash]);
    cache_get_value_name_int(0, "Kills", PlayerInfo[playerid][user_kills]);
    cache_get_value_name_int(0, "Deaths", PlayerInfo[playerid][user_deaths]);

    LoggedIn[playerid] = true;
    SendClientMessage(playerid, -1, "Welcome back to our server.");
    return 1;
}
but it still show spawn button when I log in and doesn't auto spawn
Reply
#2

can someone help me? :/
Reply
#3

Have you tried setting SetSpawnInfo first?

Also, you load all the player information, twice?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)