Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

This keeps returning "player not found"

$
0
0
I'm trying to teach myself dialogs and SQL, so I'm making a system where you can search for a player's info.

PHP Code:

Dialog:Panel_PlayerSearch(playeridresponselistiteminputtext[])
{
    if(!
response) return PanelMain(playerid);
    
    
ReplaceSpaces(inputtext);

    if(!
NameCheck(inputtext)) return Panel_PlayerSearch(playerid);
    
    new 
CharacterID GetSQLIDFromName(inputtext);

    if(
CharacterID == 0)
    {
        
SendErrorMessage(playerid"Player not found!");
        return 
Panel_PlayerSearch(playerid);
    }
    
    
PlayerData[playerid][pPanel] = CharacterID;
    
    
Panel_PlayerInfo(playerid);
    
    return 
1;


It gets stuck here, and everytime I type in my name either with or without the underscore, it returns the error message, even though my ID is 2 (so, not 0.)

Here's the code which should convert the name input to the character's ID and return the value...

PHP Code:

stock GetSQLIDFromName(name[])
{
    new 
query[128], CharID;
    
mysql_format(SQL_CONNECTquerysizeof(query), "SELECT ID FROM characters WHERE Username = '%e' LIMIT 1"name);
    new 
Cache:result mysql_query(SQL_CONNECTquery);
    
CharID cache_get_field_content_int(0"ID"SQL_CONNECT);
     
cache_delete(result);
    return 
CharID;


Can anybody see any errors?

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>