SA-MP Forums Archive
MySQL Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL Problem (/showthread.php?tid=298710)



MySQL Problem - gabitzu4ever - 22.11.2011

Hello, I have a little problem in MySQL is unique players when they connect to the server, GTA crashes in OnPlayerConnect no dialog is no Login / Register. The script is:

pawn Код:
new pnamee[24];
    new qstr[512];
    GetPlayerName(playerid, pnamee, sizeof(pnamee));
    format(qstr,sizeof(qstr),"SELECT * FROM `users` WHERE `name`='%s' LIMIT 1",pnamee);
    mysql_query(qstr);
    mysql_store_result();
    if(mysql_num_rows())
    {
        gPlayerAccount[playerid] = 1;
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "{EE5555}SERVER:{00FF00} Zonek SA:MP RPG Officil Server");

    }
    else
    {
        gPlayerAccount[playerid] = 0;
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "{EE5555}SERVER:{00FF00} Zonek SA:MP RPG Officil Server");

    }
    mysql_free_result();



Re: MySQL Problem - juraska - 22.11.2011

You didn't indicate num row

if(mysql_num_rows())
should be if(mysql_num_rows()=='value')

Код:
new pnamee[24];
    new qstr[512];
    GetPlayerName(playerid, pnamee, sizeof(pnamee));
    format(qstr,sizeof(qstr),"SELECT * FROM `users` WHERE `name`='%s' LIMIT 1",pnamee);
    mysql_query(qstr);
    mysql_store_result();
    if(mysql_num_rows()!=0)
    {
        gPlayerAccount[playerid] = 1;
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "{EE5555}SERVER:{00FF00} Zonek SA:MP RPG Officil Server");

    }
    else
    {
        gPlayerAccount[playerid] = 0;
        SendClientMessage(playerid, COLOR_LIGHTBLUE, "{EE5555}SERVER:{00FF00} Zonek SA:MP RPG Officil Server");

    }
    mysql_free_result();



Re: MySQL Problem - Jordiee - 22.11.2011

Are you using VX-RP 2?


Re: MySQL Problem - gabitzu4ever - 22.11.2011

Quote:
Originally Posted by Jordiee
Посмотреть сообщение
Are you using VX-RP 2?
no, is my gamemode