Problem when loading factions
#1

Hi everyone, I have a loading problem in my faction system, when the stock LoadFactions () is called it does not load the factions, I believe the problem is in the cache_get_value that is not passing the database data to the variables because console show the correct number of the factions loaded, but the faction variables receive no data.
I already tried to fix it in several ways, changing the shape of the loop but without result, does anyone have an idea of how to fix it? Thank you in advance and sorry for my english, this is not my native language.
Here is the code
PHP код:
stock LoadFactions()
{
    new 
rows;
    new 
Cache:result;
    
result mysql_query(Connect"SELECT * FROM `factions`");
    if(
cache_get_row_count(rows))
    {
        for(new 
0rowsi++)
        {
            
cache_get_value_int(i"fID"Factions[i][fID]);
            
cache_get_value_int(i"fLeaderID"Factions[i][fLeaderID]);
            
cache_get_value_name(i"fLeaderName"Factions[i][fLeaderName]);
            
cache_get_value_name(i"fNome"Factions[i][fNome]);
            
cache_get_value_name(i"fTag",Factions[i][fTag]);
            
cache_get_value_name(i"Cargo1Faction"Factions[i][Cargo1Faction]);
            
cache_get_value_name(i"Cargo2Faction"Factions[i][Cargo2Faction]);
            
cache_get_value_name(i"Cargo3Faction",Factions[i][Cargo3Faction]);
            
cache_get_value_name(i"Cargo4Faction",Factions[i][Cargo4Faction]);
            
cache_get_value_name(i"Cargo5Faction",Factions[i][Cargo5Faction]);
            
cache_get_value_int(i"fKScore"Factions[i][fKScore]);
            
cache_get_value_int(i"fDScore"Factions[i][fDScore]);
            
cache_get_value_int(i"fCarteira"Factions[i][fCarteira]);
        }
    }
    
printf("[Faction] - %i Facзхes foram carregadas!"rows);
    
Total_Factions_Created rows;
    
cache_delete(result);
    return 
1;

Reply
#2

Anyone please?
Reply
#3

Quote:
Originally Posted by JhonnyMonroe
Посмотреть сообщение
Hi everyone, I have a loading problem in my faction system, when the stock LoadFactions () is called it does not load the factions, I believe the problem is in the cache_get_value that is not passing the database data to the variables because console show the correct number of the factions loaded, but the faction variables receive no data.
I already tried to fix it in several ways, changing the shape of the loop but without result, does anyone have an idea of how to fix it? Thank you in advance and sorry for my english, this is not my native language.
Here is the code
PHP код:
stock LoadFactions()
{
    new 
rows;
    new 
Cache:result;
    
result mysql_query(Connect"SELECT * FROM `factions`");
    if(
cache_get_row_count(rows))
    {
        for(new 
0rowsi++)
        {
            
cache_get_value_int(i"fID"Factions[i][fID]);
            
cache_get_value_int(i"fLeaderID"Factions[i][fLeaderID]);
            
cache_get_value_name(i"fLeaderName"Factions[i][fLeaderName]);
            
cache_get_value_name(i"fNome"Factions[i][fNome]);
            
cache_get_value_name(i"fTag",Factions[i][fTag]);
            
cache_get_value_name(i"Cargo1Faction"Factions[i][Cargo1Faction]);
            
cache_get_value_name(i"Cargo2Faction"Factions[i][Cargo2Faction]);
            
cache_get_value_name(i"Cargo3Faction",Factions[i][Cargo3Faction]);
            
cache_get_value_name(i"Cargo4Faction",Factions[i][Cargo4Faction]);
            
cache_get_value_name(i"Cargo5Faction",Factions[i][Cargo5Faction]);
            
cache_get_value_int(i"fKScore"Factions[i][fKScore]);
            
cache_get_value_int(i"fDScore"Factions[i][fDScore]);
            
cache_get_value_int(i"fCarteira"Factions[i][fCarteira]);
        }
    }
    
printf("[Faction] - %i Facзхes foram carregadas!"rows);
    
Total_Factions_Created rows;
    
cache_delete(result);
    return 
1;

Version mysql?
Reply
#4

It was solved with a modification in the loop, but thanks for the willingness to help! + Rep
Reply
#5

Quote:
Originally Posted by JhonnyMonroe
Посмотреть сообщение
It was solved with a modification in the loop, but thanks for the willingness to help! + Rep
Don't rep for that, and pay attention to the rules of the forum... 24 hour bumps only.

Whilst many of us aren't here 24 hours a day, you will get people who are post whoring to get the count up, or rep hunting to also get their rep up. Those are the usual ones to pounce on these threads.

The old 'try this' *pastes code without ANY explanation of what it does*, the blind 'update plugins' without ANY care for how it will affect your script. Be careful about these people, as once the real knowledgeable people get to you, you've already ruined your script more, and are en-grained in an approach which is terribly wrong.


Only rep those who actually help you, in an informative sense, and from a technique and advisory/successful helping... Hell, all he did was ask the version of MySQL.....
Reply
#6

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Don't rep for that, and pay attention to the rules of the forum... 24 hour bumps only.

Whilst many of us aren't here 24 hours a day, you will get people who are post whoring to get the count up, or rep hunting to also get their rep up. Those are the usual ones to pounce on these threads.

The old 'try this' *pastes code without ANY explanation of what it does*, the blind 'update plugins' without ANY care for how it will affect your script. Be careful about these people, as once the real knowledgeable people get to you, you've already ruined your script more, and are en-grained in an approach which is terribly wrong.


Only rep those who actually help you, in an informative sense, and from a technique and advisory/successful helping... Hell, all he did was ask the version of MySQL.....
Agreed whit Sew Here totally.

Also, you can definitely see you are using MySQL R40+ as those functions werent available in the past versions. Use the threaded MySQL Queries man. They will help your server not to freeze while performing tasks. make LoadFactions a public and call it with select * from factions on GameModeInit().
Reply
#7

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Don't rep for that, and pay attention to the rules of the forum... 24 hour bumps only.

Whilst many of us aren't here 24 hours a day, you will get people who are post whoring to get the count up, or rep hunting to also get their rep up. Those are the usual ones to pounce on these threads.

The old 'try this' *pastes code without ANY explanation of what it does*, the blind 'update plugins' without ANY care for how it will affect your script. Be careful about these people, as once the real knowledgeable people get to you, you've already ruined your script more, and are en-grained in an approach which is terribly wrong.


Only rep those who actually help you, in an informative sense, and from a technique and advisory/successful helping... Hell, all he did was ask the version of MySQL.....
Agreed whit Sew and GT.

Bro, In no time request to + Rep what you requested was the mysql version that you had.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)