Player Problem (MYSQL)
#3

Okey

Checking players on OnPlayerConnect (After +30 players OnPlayerConnect doesn't even call):
pawn Code:
new szDestination[100];
format(szDestination,sizeof(szDestination), "SELECT * FROM `Igraci` WHERE pProfil = '%s'",plname);
mysql_function_query(1,szDestination,true,"CheckAccountExists","i",playerid);
pawn Code:
forward CheckAccountExists(playerid);
public CheckAccountExists(playerid)
{
    if(!IsPlayerConnected(playerid)) return 1; // Ako igracot slucajno se isklucil za da ne ja poebe databazata

    new rows, fields;
    cache_get_data(rows, fields);
    if(!rows)
    {
        gPlayerAccount[playerid] = 1;
    }
    else
    {
        gPlayerAccount[playerid] = 2;
        new playername2[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername2, sizeof(playername2));
        new query[264];
        format(query,sizeof(query), "SELECT * FROM `Igraci` WHERE pProfil = '%s'", playername2);
        mysql_function_query(1,query,true,"VcituvanjePodatoci","ds",playerid, playername2);
    }
    return 1;
}
pawn Code:
forward VcituvanjePodatoci(playerid, ime[]);
public VcituvanjePodatoci(playerid, ime[])
{
    if(!IsPlayerConnected(playerid)) return 1; // Ako igracot slucajno se isklucil za da ne ja poebe databazata

    new rows, fields;
    cache_get_data(rows, fields);
   
    new podatok[64];
    cache_get_row(0, 0, podatok);
    PlayerInfo[playerid][pIgracID] = strval(podatok);
    //etc
    return 1;
}
Reply


Messages In This Thread
Player Problem (MYSQL) - by NeroX98 - 05.10.2013, 14:21
Re: Player Problem (MYSQL) - by DanishHaq - 05.10.2013, 14:25
Re: Player Problem (MYSQL) - by NeroX98 - 05.10.2013, 14:32
Re: Player Problem (MYSQL) - by NeroX98 - 06.10.2013, 14:42

Forum Jump:


Users browsing this thread: 1 Guest(s)