R41-2 Issues
#1

Hello

i got some issues using lastest version of mysql

Issues:

// example :

PHP код:
public onMySQLCheck(playerid)
{
    new 
    
rows;
    
cache_get_row_count(rows);
    if(
rows == 1
    { 
        
cache_get_value_name(0"Password"PlayerInfo[playerid][Password]); 
        
ShowPlayerDialog(playeridLoginDIALOG_STYLE_INPUT"Login""Welcome !\nthis account already registred. Please fill in your password:""Login""Quit"); 
        return 
1;
    } 
    else
    {
        new 
RegisterDS[1024];
        
format(RegisterDSsizeof(RegisterDS),""W"Welcome to San Andreas Playground"YE"%s\n\n"GetName(playerid));
        
strcat(RegisterDS,""W"You are not registered yet on this server,\n");
        
strcat(RegisterDS,""W"Enter your password below to register\n");
        
strcat(RegisterDS,""W"By registering all your statistics will be saved in server database!\n\n");
        
strcat(RegisterDS,""R"Info"W":\n");
        
strcat(RegisterDS,""R"- "W"Your password must contain at least 4 characters\n");
        
strcat(RegisterDS,""R"- "W"Remember your password, you will need it for your next login\n");
        
ShowPlayerDialog(playeridRegisterDIALOG_STYLE_PASSWORD""R" "W"VL Register Account"RegisterDS"Register","" );
    }
    return 
1;
}
// register dialog work fine just this not work
        
case Login
        { 
            if(!
responseKick(playerid); 
            new 
                
query[100], 
                
playername[MAX_PLAYER_NAME]; 
            
printf("Test with account Variable inputext = %s | Variable PlayerPassword = %s"inputtextPlayerInfo[playerid][Password]);
            if(!
strcmp(inputtextPlayerInfo[playerid][Password], true)) 
            { 
                
mysql_format(registerquerysizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1"playername); 
                
mysql_tquery(registerquery"OnMySQLValided""i"playerid); 
            } 
            else 
            { 
                
SendClientMessage(playerid, -1"You have specified an incorrect password!"); 
                
ShowPlayerDialog(playeridLoginDIALOG_STYLE_INPUT"Login""Welcome !\nthis account already registred. Please fill in your password:""Login""Quit"); 
            } 
        } 
output:

PHP код:
Test with account Variable inputext yaa Variable PlayerPassword 
also it's logging with any password

so

PHP код:
if(!strcmp(inputtextPlayerInfo[playerid][Password], true)) 
has no effect

i don't know why :/ others functions:
PHP код:
public OnMySQLValided(playerid

    new 
rowsfields
    
cache_get_field_count(fields);
    
cache_get_row_count(rows);
    if(
rows == 1
    {
        
cache_get_value_name_int(0"Admin"PlayerInfo[playerid][Admin]); 
        
cache_get_value_name_int(0"VIP"PlayerInfo[playerid][VIP]); 
        
cache_get_value_name_int(0"Money"PlayerInfo[playerid][Money]); 
        
cache_get_value_name(0"DeathMessage"PlayerInfo[playerid][pDM]);
        
cache_get_value_name_int(0"Deaths"PlayerInfo[playerid][pDeaths]);
        
cache_get_value_name_int(0"Kills"PlayerInfo[playerid][pKills]);
        
cache_get_value_name_int(0"Bans"PlayerInfo[playerid][pBans]);
        
cache_get_value_name_int(0"Kicks"PlayerInfo[playerid][pKicks]);
        
cache_get_value_name_int(0"Car"MyCar[playerid]);
        new 
query[150];
        
mysql_format(registerquerysizeof(query), "SELECT * FROM `accounts_2` WHERE `Name` = '%s' LIMIT 1"GetName(playerid));
        
mysql_tquery(registerquery"LoadPlayersHours""i"playerid);
    }
    return 
1

public 
LoadPlayersHours(playerid)
{
    new 
rowsfields
    
cache_get_field_count(fields);
    
cache_get_row_count(rows);
    if(
rows == 1
    {
        
cache_get_value_name_int(0"Hours"PlayerInfo[playerid][pHours]);
        
cache_get_value_name_int(0"Minutes"PlayerInfo[playerid][pMin]);
        
cache_get_value_name_int(0"BankValue"BankInfo[playerid][Deposit]);
        
cache_get_value_name_int(0"SkinID"PlayerInfo[playerid][pSkin]);
        
cache_get_value_name_int(0"Reaction"PlayerInfo[playerid][Reaction]);
    }
    
GivePlayerMoney(playeridPlayerInfo[playerid][Money]); 
    
SendClientMessage(playerid, -1"You have successfully logged in."); 
    
IsLoggedIn[playerid] = 1;
    return 
1;

this message not sended to players
PHP код:
SendClientMessage(playerid, -1"You have successfully logged in."); 
logs:

PHP код:
[23:13:40] [DEBUGCResultSet::Create(connection=0x99bc858query_str='SELECT * FROM `accounts` WHERE `Name` = '' LIMIT 1')
[
23:13:40] [DEBUGcreated new resultset '0x9d2ce80'
[23:13:40] [DEBUGfetched MySQL result '0x9d02158'
[23:13:40] [DEBUGallocated 0 bytes for PAWN result
[23:13:40] [DEBUGCCallback::Execute(amx=0x999c558index=98num_params=1)
[
23:13:40] [INFOExecuting callback 'OnMySQLValided' with 1 parameter...
[
23:13:40] [DEBUGprocessing internal specifier 'c'
[23:13:40] [DEBUGpushed value '0' onto AMX stack
[23:13:40] [DEBUGexecuting AMX callback with index '98'
[23:13:40] [DEBUGcache_get_field_count(0xF4A801F8) (D:\pawn-editor\include\SAPData\Server\Functions.pwn:45)
[
23:13:40] [DEBUGcache_get_field_count: return value'1' (D:\pawn-editor\include\SAPData\Server\Functions.pwn:45)
[
23:13:40] [DEBUGcache_get_row_count(0xF4A801FC) (D:\pawn-editor\include\SAPData\Server\Functions.pwn:46)
[
23:13:40] [DEBUGcache_get_row_count: return value'1' (D:\pawn-editor\include\SAPData\Server\Functions.pwn:46)
[
23:13:40] [DEBUGAMX callback executed with error '0'
[23:13:40] [INFOCallback successfully executed
after player spawn there nothing else so MySQLValided not called :/
Reply
#2

Quote:
PHP код:
cache_get_value_name(0"Password"PlayerInfo[playerid][Password]); 
When fetching directly into a multidimensional array you must provide the size explicitly. This has been the case since ... ever.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
When fetching directly into a multidimensional array you must provide the size explicitly. This has been the case since ... ever.
PHP код:
enum Player
{  
    
Name[MAX_PLAYER_NAME], 
    
Password[129], 
    
IP[16], 
    
Admin
    
VIP,
    
pDeaths,
    
pKills,
    
pBans,
    
pKicks,
    
pMin,
    
pHours,
    
pDM[50],
    
Money,
    
pSkin,
    
Reaction
}; 
enum ^^
Reply
#4

Sigh.

Код:
native cache_get_value_name(row_idx, const column_name[], destination[], max_len = sizeof(destination))
This must be provided explicitly in this case.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Sigh.

Код:
native cache_get_value_name(row_idx, const column_name[], destination[], max_len = sizeof(destination))
This must be provided explicitly in this case.
thank you.

this one fixed now what about !stcmp & functions not called ?
Reply
#6

bump ?
Reply
#7

You should hash the inputtext to compare it with the player password (That's if you are using hashed passwords).

Another thing;

PHP код:
    new rowsfields;  
    
cache_get_field_count(fields); 
    
cache_get_row_count(rows); 
You are not using the fields, Why did you define it?
Reply
#8

Quote:
Originally Posted by oMa37
Посмотреть сообщение
PHP код:
    new rowsfields;  
    
cache_get_field_count(fields); 
    
cache_get_row_count(rows); 
You are not using the fields, Why did you define it?
isn't needed ?
Reply
#9

strcmp returns 0 when compared to an empty string. You must consider checking the length of inputtext first.
Reply
#10

fixed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)