Mysql spawning
#6

Looks correct, try this:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new Float:X, Float:Y, Float:Z, string[110];
    GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
    format(string, sizeof(string), "UPDATE Users SET X = '%f', Y = '%f', Z = '%f' WHERE Name = '%s'", X, Y, Z, UserStats[playerid][Name]);
    mysql_query(string);
    SavePlayer(playerid);

    UserStats[playerid][Admin] = 0;
    UserStats[playerid][Money] = 0;
    AccountExists[playerid] = 0;
    PlayerLogged[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new string[65], load[50];
    format(string, sizeof(string), "SELECT X, Y, Z FROM Users WHERE Name = '%s'", UserStats[playerid][Name]);
    mysql_query(string);
    mysql_store_result();
    if(mysql_num_rows() != 0 && mysql_fetch_row(load))
    {
        sscanf(load, "p<|>fff", UserStats[playerid][X], UserStats[playerid][Y], UserStats[playerid][Z]);
        SetPlayerPos(playerid, UserStats[playerid][X], UserStats[playerid][Y], UserStats[playerid][Z]);
    }
    mysql_free_result();
    return 1;
}
If it dont works, then comment "SavePlayer(playerid);" and try again. If it works when you have commented "SavePlayer(playerid);" then show us that function
Reply


Messages In This Thread
Mysql spawning - by thimo - 08.12.2011, 16:50
Re: Mysql spawning - by Laronic - 08.12.2011, 16:54
Re: Mysql spawning - by thimo - 08.12.2011, 16:57
Re: Mysql spawning - by Laronic - 08.12.2011, 16:58
Re: Mysql spawning - by thimo - 08.12.2011, 17:09
Re: Mysql spawning - by Laronic - 08.12.2011, 17:11
Re: Mysql spawning - by thimo - 08.12.2011, 17:18
Re: Mysql spawning - by Laronic - 08.12.2011, 17:24
Re: Mysql spawning - by thimo - 08.12.2011, 17:25
Re: Mysql spawning - by Laronic - 08.12.2011, 17:27

Forum Jump:


Users browsing this thread: 2 Guest(s)