AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Save/Load (XP) (https://forums.alliedmods.net/showthread.php?t=188681)

Driving To Heaven 06-29-2012 07:13

Save/Load (XP)
 
Does such a thing possible? If so what's wrong? Because it does not work.
PHP Code:

Save_Data(id)
{
    new 
szKey[64]
    
get_user_ip(idszKeycharsmax(szKey), 1)
 
    new 
iLen 0
    
static szData[1000]
 
    for (new 
0Maxsi++)
    {
        
iLen += formatex(szData[iLen], charsmax(szData) - iLen"%d#"PlayerXP[id][i]
    }
    
nvault_set(NvaultszKeyszData)
}
 
Load_Data(id)
{
    new 
szKey[64]
    
get_user_ip(idszKeycharsmax(szKey), 1)
 
    static 
szData[1000], szAll[1000]
    new 
szClassLevel[512]
    new 
szXP[10]
 
    
nvault_get(NvaultszKeyszDatacharsmax(szData))
 
    
strtok(szDataszDatasizeof(szData) - 1szAllsizeof(szAll) - 1'#')
 
    for (new 
0Maxsi++)
    {
        
strtok(szAllszClassLevelsizeof(szClassLevel) - 1szAllsizeof(szAll) - 1'#')
        
strtok(szClassLevelszXPsizeof(szXP) - 1szClassLevelsizeofszClassLevel ) - 1' ')
 
        
PlayerXP[id][i] = str_to_num(szXP)
    }


----
sorry for bad english.

Liverwiz 06-29-2012 11:20

Re: Save/Load (XP)
 
1. Technically, though not in real time, an IP address is dynamic. You could possibly get the same user from two different IPs. I suggest using steamID. Also...IPs will only be 16 chars "xxx.xxx.xxx.xxx"

2. how do you set PlayerXP[][] i.e. how do you put the data into it during execution?
I'm aware that most XP mods can get huge so try to do what you can for me.

Driving To Heaven 07-01-2012 14:23

Re: Save/Load (XP)
 
But still does not work.. Can someone help me? Or write good code... Thank you.
----------
sorry for my bad english.

Aooka 07-01-2012 14:47

Re: Save/Load (XP)
 
Why you set this #
Code:
iLen += formatex(szData[iLen], charsmax(szData) - iLen, "%d#", PlayerXP[id][i]

&

Code:
strtok(szAll, szClassLevel, sizeof(szClassLevel) - 1, szAll, sizeof(szAll) - 1, '#')

please ?


All times are GMT -4. The time now is 15:07.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.