Quote:
Originally Posted by Bugsy
Query string is too small, change static szQuery[ 256 ] to static szQuery[ 1024 ] in nVault_Export().
Your data looks like it's a mix of names/steam-id's/and other things as the key. How exactly are you organizing/saving data in your plugin/vault?
|
I changed it to 1024, 9999, and 99999 to test but unfortunately no good.
I'm going to post below a snippet of the code for the saving method used from PokeMod (xp.inl).
It saves all of the player's pokemon numbers followed by the XP for those pokemon.
Afterwards, there is a colon as a separator added and then the current timestamp followed by another colon as a separator.
It will then save their HUD position settings. Another colon and finally their pokerank number.
Example vault entry (the key is the player's SteamID. If player is a bot, then [Bot]Name).
Key :
PHP Code:
STEAM_0:0:12345678
Value :
PHP Code:
155 32 296 1 16 1 163 1 19 1 369 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 : 1485534210 : 18 0 : 9
Example Pokemon # followed by XP.
155 32 296 1 16 1 163 1 19 1 369 1
# XP # XP # XP # XP # XP # XP.
The zero's are empty slots because a player can hold 100 pokemon.
1485534210 is the time stamp. 18 0 is the HUD X and Y position. 9 is their Pokerank number.
xp.inl snippet :
PHP Code:
public load_all()
{
for( new x=0; x < MAX_PLAYERS; x++ )
LoadXP(x);
#if POKERANK_SYSTEM==1
LoadRanks()
#endif
}
public save_all()
{
if( !PM_Loaded )
return;
poke_print(0, print_center, "Saving All Data");
new players[MAX_PLAYERS], pnum;
poke_get_players(players, pnum);
for( new i=0; i<pnum; i++)
set_task( 1.5*(i+1), "delayed_save", players[i]);
#if POKERANK_SYSTEM==1
SaveRanks();
#endif
}
public delayed_save(id)
SaveXP(id, -1);
SaveXP(id, forced=1)
{
if(g_isWild[id]>0)
return false;
static key[35]
static Float:last_save[MAX_PLAYERS+1], Float:time_left, Float:current_time;
if( id ){
current_time = get_gametime();
time_left = current_time - last_save[id];
if( forced < 1 && time_left < SAVE_SPAM){
if( !forced )
poke_printlang(id,"POKEMOD_SAVESPAM", SAVE_SPAM-time_left);
return false;
}
last_save[id] = current_time;
}
if( Pokemod_Connected(id) && getSaveKey(id, key) && SaveXPon() )
{
RefreshPoke(id)
new Data[1501], iLen = 0, i
//save their pokemon and xp
for(i = 0; i<MAX_POKES; i++)
iLen += formatex(Data[iLen],(1501-iLen),"%d %d ", PlayersPoke[id][i], PlayersXP[id][i])
//save the time
iLen += copy(Data[iLen],(1501-iLen),": ")
iLen += formatex(Data[iLen],(1501-iLen),"%d ",get_systime())
iLen += copy(Data[iLen],(1501-iLen),": ")
//save their settings
for(i = 0; i<MAX_SETS; i++)
iLen += formatex(Data[iLen],(1501-iLen),"%d ", PlayersSet[id][i])
//save their pokerank crap
iLen += formatex(Data[iLen],(1501-iLen),": %d",PlayersCatch[id])
writeData(id, key, Data)
debugMessage(id,5,"XP", "saved data with save key %s", key)
return true;
}
return false;
}
#if SAVE_ID != 0
public client_infochanged(id)
{
new savekey[35], newname[NAME_LENGTH];
getSaveKey(id, savekey);
get_user_info(id, "name", newname, NAME_LENGTH-1);
if( !equal(savekey, newname) ){
SaveXP(id);
LoadXP(id);
}
}
#endif
//thanks to SHmod
getSaveKey(id, key[35]="", bool:update=false)
{
static player_key[MAX_PLAYERS+1][35];
if( update ) {
#if SAVE_ID == 0
if(is_user_bot(id)) {
new botname[32]
get_user_name(id,botname,31)
//Get Rid of BOT Tag
//PODBot
replace(botname,31,"[POD]",EMPTY)
replace(botname,31,"[P*D]",EMPTY)
replace(botname,31,"[P0D]",EMPTY)
//CZ Bots
replace(botname,31,"[BOT] ",EMPTY)
//Attempt to get rid of the skill tag so we save with bots true name
new lastchar = strlen(botname) - 1
if ( equal(botname[lastchar],")",1) ) {
new x
for ( x = lastchar - 1; x > 0; x--) {
if ( equal(botname[x],"(",1) ) {
botname[x - 1] = 0
break
}
if ( !isdigit(botname[x]) ) break
}
}
if (strlen(botname) > 0 ) {
#if SAVE==SAVE_MYSQL
replace_all(botname,31,"`","\\`")
replace_all(botname,31,"'","\\'")
#endif
replace_all(botname,31," ","_")
formatex( player_key[id], 34, "[BOT]%s", botname )
}
}
//Hack for STEAM's retardedness with listen servers
else if (!is_dedicated_server() && id == 1) {
copy( player_key[id], 34, "loopback" )
}
else {
if (get_pcvar_num(sv_lan) == 1) {
get_user_ip( id, player_key[id], 34, 1 ) // by ip without port
}
else {
get_user_authid( id, player_key[id], 34 ) // by steamid
if( equali(player_key[id],"STEAM_ID_LAN") || equali(player_key[id],"4294967295") ){
get_user_ip( id, player_key[id], 34, 1 ) // by ip without port
}
}
}
#else
get_user_name( id, player_key[id], 34 )
#endif
debugMessage(id,5,"XP", "updated savekey");
}
//Check to make sure we got something useable
if( equali(player_key[id], "STEAM_ID_PENDING") || equali(player_key[id], EMPTY) ){
debugMessage(id,5,"XP", "does not have a valid savekey ('%s')", player_key[id]);
return false;
}
copy( key, 34, player_key[id] );
return true;
}
Whole xp.inl code :
https://github.com/Liquidbullets/AMX...pokemon/xp.inl
Hope this clears up any questions. Thank you again Bugsy.
Quote:
Originally Posted by PartialCloning
In the vault file I only see PokeMod_Rank0-4 (5 total). You also seem to be saving bot data, doesn't make sense.
|
PartialCloning, bot data is saved due to bots having XP in PokeMod.
The vault appears to have 46 entries. Some player data, some bot data, and ranking data.
__________________