MySQL r41 help! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL r41 help! (
/showthread.php?tid=657054)
MySQL r41 help! -
Tenka - 30.07.2018
I have problem with changing r39 > r41 and i got this issue
Код:
format(str, sizeof(str), "pRadio%i", i);
PlayerInfo[playerid][pRadio][i] = cache_get_field_content_int(0, str, ourConnection);
How to change this line?
Re: MySQL r41 help! -
Kraeror - 30.07.2018
You can use this wiki:
https://sampwiki.blast.hk/wiki/MySQL/R40
for loading the data as integer you can use that function "cache_get_value_index_int(row_idx, column_idx, &destination)". Check all the functions in the wiki!
Also I will edit your code to the R41 version. Here you are:
PHP код:
format(str, sizeof(str), "pRadio%i", i);
cache_get_value_index_int(0, str, PlayerInfo[playerid][pRadio][i]);
I hope I helped enough! +1 REP if I did!
Re: MySQL r41 help! -
Tenka - 31.07.2018
Ty for that code
Another problem
Код:
function:Query_LoadFactionRanks(factionid)
{
new rows, fields;
cache_get_row_count(rows);
cache_get_field_count(fields);
for (new i = 0; i < rows && i< MAX_FACTION_RANKS; i++)
{
cache_get_value_name(i, "FactionRank1", FactionRanks[PlayerInfo[i][pFaction]["NotSet"]);
cache_get_value_name(i, "FactionRank2", FactionRanks[PlayerInfo[i][pFaction]["NotSet"]); // example
}
return 1;
}
And my database screenshot
https://imgur.com/a/HP2JgJO
My variable
Код:
pFactionRank,
new FactionRanks[MAX_FACTIONS][MAX_FACTION_RANKS][60];
If you guys wanna see the old code
I try to add 1 by 1 lines so i change it
Код:
function:Query_LoadFactionRanks(factionid)
{
new str[128];
new rows, fields; cache_get_data(rows, fields, ourConnection);
for (new i = 0; i < rows; i++)
{
for (new j = 1; j < MAX_FACTION_RANKS; j++)
{
format(str, sizeof(str), "FactionRank%i", j);
cache_get_field_content(i, str, FactionRanks[factionid][j], ourConnection, 60);
}
}
return 1;
}
I dont know what to do with this code can anyone explain please
Sorry for stupid question
Re: MySQL r41 help! -
Calisthenics - 31.07.2018
Converting to R40 and above:
https://sampforum.blast.hk/showthread.php?tid=616103
pawn Код:
for (new j = 1; j < MAX_FACTION_RANKS; j++)
{
format(str, sizeof(str), "FactionRank%i", j);
cache_get_field_content(i, str, FactionRanks[factionid][j], ourConnection, 60);
}
This is bad design, use another table not columns.
Re: MySQL r41 help! -
Slawi - 31.07.2018
Check this
https://sampwiki.blast.hk/wiki/MySQL/R40
and the code need be like this
Код:
function:Query_LoadFactionRanks(factionid)
{
new str[128];
new rows = cache_num_rows();
for (new i = 0; i < rows; i++)
{
for (new j = 1; j < MAX_FACTION_RANKS; j++)
{
format(str, sizeof(str), "FactionRank%i", j);
cache_get_value(i, str, FactionRanks[factionid][j], 60);
}
}
return 1;
}