Help me with mysql R40
#1

Код HTML:
[WARNING] mysql_connect: no password specified
[ERROR] cache_get_value_name_int: no active cache
Код HTML:
forward Query_LoadCharacter(playerid);
public Query_LoadCharacter(playerid)
{	
    new rows = cache_num_rows();

    if(!rows) 
    { 
        printf("[SERVER]: No clans were loaded from the MYSQL Database."); 

        return 0; 
    } 

    for (new i = 0; i < rows; i ++) 
    {
		cache_get_value_name_int(i, "char_ID", CharacterInfo[i][cID]);
		cache_get_value_name_int(i, "char_Admin", CharacterInfo[i][cAdmin]);
		cache_get_value_name_int(i, "char_Skin", CharacterInfo[i][cSkin]);
		cache_get_value_float(i, "char_PosX", CharacterInfo[i][cPos][0]);
		cache_get_value_float(i, "char_PosY", CharacterInfo[i][cPos][1]);
		cache_get_value_float(i, "char_PosZ", CharacterInfo[i][cPos][2]);
		cache_get_value_float(i, "char_PosA", CharacterInfo[i][cPos][3]);	
		cache_get_value_name_int(i, "char_Interior", CharacterInfo[i][cInterior]);
	    cache_get_value_name_int(i, "char_VW", CharacterInfo[i][cVW]);
		cache_get_value_name_int(i, "char_Age", CharacterInfo[i][cAge]);
		cache_get_value_float(i, "char_Health", CharacterInfo[i][cHealth]);
		cache_get_value_float(i, "char_Armour", CharacterInfo[i][cArmour]);
		cache_get_value_name_int(i, "char_Money", CharacterInfo[i][cMoney]);
	}
	TogglePlayerSpectating(playerid, false);
	LoadCharacter(playerid);
	return 1;
}
Someone help me.
Reply
#2

Reply
#3

Show us your query.
Reply
#4

Quote:
Originally Posted by Rolux
Посмотреть сообщение
Show us your query.
PHP код:
stock SaveCharacter(playerid)

    
send_msg(playerid, -1"Save Pos");
    
GetPlayerPos(playeridCharacterInfo[playerid][cPos][0], CharacterInfo[playerid][cPos][1], CharacterInfo[playerid][cPos][2]);
    
GetPlayerFacingAngle(playeridCharacterInfo[playerid][cPos][3]);
    
GetPlayerHealth(playeridCharacterInfo[playerid][cHealth]);
    
GetPlayerArmour(playeridCharacterInfo[playerid][cArmour]);
    
CharacterInfo[playerid][cVW] = GetPlayerVirtualWorld(playerid);
    
CharacterInfo[playerid][cInterior] = GetPlayerInterior(playerid);
    
send_format(playerid, -1"X: %.4f | Y: %.4f | Z: %.4f | A: %.4f"CharacterInfo[playerid][cPos][0], CharacterInfo[playerid][cPos][1], CharacterInfo[playerid][cPos][2], CharacterInfo[playerid][cPos][3]);
    new 
query[2024];
    
format(querysizeof(query), "UPDATE `rp_characters` SET char_Admin = %d, char_Skin = %d, char_PosX = %.4f, char_PosY = %.4f, char_PosZ = %.4f, char_PosA = %.4f, char_Interior = %d, char_VW = %d",
        
CharacterInfo[playerid][cAdmin],
        
CharacterInfo[playerid][cSkin],
        
CharacterInfo[playerid][cPos][0],
        
CharacterInfo[playerid][cPos][1],
        
CharacterInfo[playerid][cPos][2],
        
CharacterInfo[playerid][cPos][3],
        
CharacterInfo[playerid][cVW],
        
CharacterInfo[playerid][cInterior]);
    
    
format(querysizeof(query), "%s, char_Health = %.4f = %d, char_Armour = %.4f, char_Money = %d WHERE char_ID = '%d'",
        
query,
        
CharacterInfo[playerid][cHealth],
        
CharacterInfo[playerid][cArmour],
        
CharacterInfo[playerid][cMoney],
        
CharacterInfo[playerid][cID]);
    
mysql_tquery(g_SQLquery);        
    return 
1;

Reply
#5

I meant the one which calls "Query_LoadCharacter".
Reply
#6

Quote:
Originally Posted by Rolux
Посмотреть сообщение
I meant the one which calls "Query_LoadCharacter".
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch (
dialogid)
    {
        case 
DIALOG_SELECT_CHARACTER_RP:
        {
            if(!
response) return 1;
            
playerMakingCharacter[playerid] = true;
            
playerCharacterStep[playerid] = 1;
            return 
1;
        }
        else
        {
                new 
string[128], thread[128];
            
TogglePlayerSpectating(playeridtrue);
            
playerMakingCharacter[playerid] = false;
            
playerCharacterStep[playerid] = 0;                
            
SetPlayerName(playeridCharacterLister[playerid][listitem]); 
                
            
mysql_format(g_SQLthreadsizeof(thread), "SELECT * FROM rp_characters WHERE char_Name = '%e' LIMIT 1"CharacterLister[playerid][listitem]);
            
mysql_tquery(g_SQLthread"Query_SelectCharacter""i"playerid); 
        }
    }
    return 
1;
}
forward Query_SelectCharacter(playerid);
public 
Query_SelectCharacter(playerid)
{
    if (!
cache_num_rows())
    {        
        new
            
liststring[128]
        ;
        
        for (new 
03++) {
            
format(liststringsizeof(liststring), "%s%s\n"liststringCharacterLister[playerid][i]); }
            
        return 
ShowPlayerDialog(playeridDIALOG_SELECT_CHARACTER_RPDIALOG_STYLE_LIST"Nhan vat:"liststring"Chon""Tro lai"); 
    }
    
    new 
rowsfieldsthread[128]; 
    
cache_get_row_count(rows);
    
cache_get_field_count(fields);
    
    if(
rows)
    {
        
mysql_format(g_SQLthreadsizeof(thread), "SELECT * FROM rp_characters WHERE char_Name = '%e'"GetPlayerNameEx(playerid));
        
mysql_tquery(g_SQLthread"Query_LoadCharacter""i"playerid);
    }
    
    return 
1;

Reply
#7

Код:
forward Query_LoadCharacter(playerid);
public Query_LoadCharacter(playerid)
{	
    new rows = cache_num_rows();

    if(!rows) 
    { 
        printf("[SERVER]: No clans were loaded from the MYSQL Database."); //clans?

        return 0; 
    } 

	//We dont have to loop,because you are only loading 1 characters data.

    
	cache_get_value_name_int(0, "char_ID", CharacterInfo[playerid][cID]);
	cache_get_value_name_int(0, "char_Admin", CharacterInfo[playerid][cAdmin]);
	cache_get_value_name_int(0, "char_Skin", CharacterInfo[playerid][cSkin]);
	cache_get_value_float(0, "char_PosX", CharacterInfo[playerid][cPos][0]);
	cache_get_value_float(0, "char_PosY", CharacterInfo[playerid][cPos][1]);
	cache_get_value_float(0, "char_PosZ", CharacterInfo[playerid][cPos][2]);
	cache_get_value_float(0, "char_PosA", CharacterInfo[playerid][cPos][3]);	
	cache_get_value_name_int(0, "char_Interior", CharacterInfo[playerid][cInterior]);
	cache_get_value_name_int(0, "char_VW", CharacterInfo[playerid][cVW]);
	cache_get_value_name_int(0, "char_Age", CharacterInfo[playerid][cAge]);
	cache_get_value_float(0, "char_Health", CharacterInfo[playerid][cHealth]);
	cache_get_value_float(0, "char_Armour", CharacterInfo[playerid][cArmour]);
	cache_get_value_name_int(0, "char_Money", CharacterInfo[playerid][cMoney]);
	
	TogglePlayerSpectating(playerid, false);
	LoadCharacter(playerid);
	return 1;
}
Reply
#8

Quote:
Originally Posted by Rolux
Посмотреть сообщение
Код:
forward Query_LoadCharacter(playerid);
public Query_LoadCharacter(playerid)
{	
    new rows = cache_num_rows();

    if(!rows) 
    { 
        printf("[SERVER]: No clans were loaded from the MYSQL Database."); //clans?

        return 0; 
    } 

	//We dont have to loop,because you are only loading 1 characters data.

    
	cache_get_value_name_int(0, "char_ID", CharacterInfo[playerid][cID]);
	cache_get_value_name_int(0, "char_Admin", CharacterInfo[playerid][cAdmin]);
	cache_get_value_name_int(0, "char_Skin", CharacterInfo[playerid][cSkin]);
	cache_get_value_float(0, "char_PosX", CharacterInfo[playerid][cPos][0]);
	cache_get_value_float(0, "char_PosY", CharacterInfo[playerid][cPos][1]);
	cache_get_value_float(0, "char_PosZ", CharacterInfo[playerid][cPos][2]);
	cache_get_value_float(0, "char_PosA", CharacterInfo[playerid][cPos][3]);	
	cache_get_value_name_int(0, "char_Interior", CharacterInfo[playerid][cInterior]);
	cache_get_value_name_int(0, "char_VW", CharacterInfo[playerid][cVW]);
	cache_get_value_name_int(0, "char_Age", CharacterInfo[playerid][cAge]);
	cache_get_value_float(0, "char_Health", CharacterInfo[playerid][cHealth]);
	cache_get_value_float(0, "char_Armour", CharacterInfo[playerid][cArmour]);
	cache_get_value_name_int(0, "char_Money", CharacterInfo[playerid][cMoney]);
	
	TogglePlayerSpectating(playerid, false);
	LoadCharacter(playerid);
	return 1;
}
It not working.
Reply
#9

Does it give you the same error as before?
Reply
#10

Quote:
Originally Posted by Rolux
Посмотреть сообщение
Does it give you the same error as before?
Yes!
Reply
#11

Quote:
Originally Posted by Rolux
View Post
Does it give you the same error as before?
I think it relate to

cache_save

cache_delete

cache_set_active


my gamemode no use it.
Reply
#12

I fixed
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)