Name suddenly null?
#1



Код:
public OnAccountCheck(playerid)
{
	print("Reached onAccountCheck!");
	new rows, fields, string[128];
	cache_get_data(rows, fields, mysql);

	if (rows)
	{
	    format(string, sizeof(string), "Name before: %s", PlayerInfo[playerid][Name]);
	    print(string);
	    
	    cache_get_field_content(0, "Password", PlayerInfo[playerid][Password], mysql, 65);
	    cache_get_field_content(0, "Salt", PlayerInfo[playerid][Salt], mysql, 11);
	    cache_get_field_content(0, "ID", PlayerInfo[playerid][ID], mysql, 10);
	    
	    format(string, sizeof(string), "Name after: %s", PlayerInfo[playerid][Name]);
	    print(string);
	    
	    format(string, sizeof(string), "Welcome %s!\nThis username is registered, please fill in your password.", PlayerInfo[playerid][Name]);
	    ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Quit");
	}
	else
	{
	    format(string, sizeof(string), "Welcome %s!\nThis username is NOT registered. Please fill in a password.", PlayerInfo[playerid][Name]);
	    ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_PASSWORD, "Register", string, "Register", "Quit");
	}
	return 1;
}
Why is PlayerInfo[playerid][Name] suddenly empty after I retrieve 3 values from the cache? I save the name under OnPlayerConnect btw. It should have nothing to do with SQL, but I have no idea why it's suddenly empty.
It doesn't show the name either in the 'Welcome %s..' message.
Код:
public OnPlayerConnect(playerid)
{	
	.....
	GetPlayerName(playerid, PlayerInfo[playerid][Name], MAX_PLAYER_NAME);
        .....
Reply
#2

possible crash by size inexistent. (cache_get_field_content(0, "ID", PlayerInfo[playerid][ID], mysql, 10);) the argument it's optional and "ID" I think it would be an integer.

PHP код:
PlayerInfo[playerid][ID] = cache_get_field_int(0"ID"); 
PHP код:
cache_get_field_int(row, const field_name[])
{
    new
        
str[12]
        ;
      
cache_get_field_content(rowfield_namestrmysql);
       return 
strval(str);

If not, check if there is no crash in the other, at the point of having a size more large which the size of the cell.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)