SA:MP: MySQL StrickenKid
#1

Hello folks!
I am using mysql, the one strickenkid released, but something annoying just happend :/.
When i compile it works fine etc, but when i test the thing i've made i get errors.
The thing i made was like it will check if player is banned and will show him the informations. But it doesn't seems to work.

This is what i get in Console Log:
Код HTML:
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e-R2, ©2005-2012 SA-MP Team

[16:58:45] filterscripts = ""  (string)
[16:58:45] 
[16:58:45] Server Plugins
[16:58:45] --------------
[16:58:45]  Loading plugin: sscanf
[16:58:45] 

[16:58:45]  ===============================

[16:58:45]       sscanf plugin loaded.     

[16:58:45]          Version:  2.8.1        

[16:58:45]    © 2012 Alex "******" Cole  

[16:58:45]  ===============================

[16:58:45]   Loaded.
[16:58:45]  Loading plugin: streamer
[16:58:45] 

*** Streamer Plugin v2.6.1 by Incognito loaded ***

[16:58:45]   Loaded.
[16:58:45]  Loading plugin: mysql
[16:58:45]  SA:MP MySQL Plugin v2.1.1 Loaded.
[16:58:45]   Loaded.
[16:58:45]  Loading plugin: Whirlpool
[16:58:45] [MySQL] Thread running. Threadsafe: Yes.
[16:58:45]  
[16:58:45]  ==================
[16:58:45]  
[16:58:45]   Whirlpool loaded
[16:58:45]  
[16:58:45]  ==================
[16:58:45]  
[16:58:45]   Loaded.
[16:58:45]  Loaded 4 plugins.

[16:58:45] 
[16:58:45] Filterscripts
[16:58:45] ---------------
[16:58:45]   Loaded 0 filterscripts.

[16:58:45] [MySQL] Connected (0) to 'root'@'localhost via TCP/IP'.
[16:58:45] [MySQL] Server Version 5.5.27.
[16:58:45] 
----------------------------------
[16:58:45]  San Fierro Modern Warfare
[16:58:45] ----------------------------------

[16:58:45] Number of vehicle models: 0
[16:59:15] Incoming connection: 25.142.61.155:59431
[16:59:15] [join] CaptainShy has joined the server (0:25.142.61.155)
[16:59:15] [MySQL] Error (0): Function: mysql_fetch_field could not find field name: "Username".
[16:59:15] [MySQL] Error (0): Function: mysql_fetch_field could not find field name: "Banner".
[16:59:15] [MySQL] Error (0): Function: mysql_fetch_field could not find field name: "Reason".
[16:59:15] [part] CaptainShy has left the server (0:2)
The issue i want to fix in the console is:
Quote:

[16:59:15] [MySQL] Error (0): Function: mysql_fetch_field could not find field name: "Username".
[16:59:15] [MySQL] Error (0): Function: mysql_fetch_field could not find field name: "Banner".
[16:59:15] [MySQL] Error (0): Function: mysql_fetch_field could not find field name: "Reason".

and the Final Pawn code snippet:
pawn Код:
public OnPlayerConnect(playerid)
{
    TextDrawHideForPlayer(playerid, XPText);
    TextDrawHideForPlayer(playerid, DeathText);
    TextDrawHideForPlayer(playerid, KillText);
    new string[71];
    format(string, sizeof(string), "SELECT `IP` FROM `banned` WHERE `IP` = '%s'", PlayerIP(playerid));
    mysql_query(string);
    mysql_store_result();
    if(mysql_num_rows())
    {
        new BannedUsername[24], Bannedby[24], BannedReason[128];
        mysql_fetch_field("Username", BannedUsername, Connection);
        mysql_fetch_field("Banner", Bannedby, Connection);
        mysql_fetch_field("Reason", BannedReason, Connection);

        new mysqlString[412];
        format(mysqlString, sizeof(mysqlString), "\n{FFFFFF}If you think your ban is unfair, please visit {FF0000}%s {FFFFFF}and make an unban appeal \n\n\n\n{267F00}Banned name: \t{BA1400}%s \n{267F00}Banned by: \t{BA1400}%s \n{267F00}Reason: \t{BA1400}%s", SERVER_WEBSITE, BannedUsername, Bannedby, BannedReason);
        ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_MSGBOX, "{FF0000}You are banned from this server!", mysqlString, "Close", "");
        Kick(playerid);
    }
    else
    {
            format(string, sizeof(string), "SELECT * FROM `accounts` WHERE `Username` = '%s'", PlayerName(playerid));
            mysql_query(string);

            mysql_store_result();
            if(mysql_num_rows())
            {
                LoginDialog(playerid);
            }
            else RegisterDialog(playerid);
            mysql_free_result();
    }
    mysql_free_result();
    return 1;
}
Got any solution? If you didn't understand what i want to point out, please ask

-Thanks
-CaptainShy
Reply
#2

Nvm, solved by changing some functions, and switched to BlueG's MySQL packet.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)