Raised This Month: $ Target: $400
 0% 

Save/Load (XP)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Driving To Heaven
Senior Member
Join Date: Jun 2009
Location: somewhere far away
Old 06-29-2012 , 07:13   Save/Load (XP)
Reply With Quote #1

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.
Driving To Heaven is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-29-2012 , 11:20   Re: Save/Load (XP)
Reply With Quote #2

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.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
Driving To Heaven
Senior Member
Join Date: Jun 2009
Location: somewhere far away
Old 07-01-2012 , 14:23   Re: Save/Load (XP)
Reply With Quote #3

But still does not work.. Can someone help me? Or write good code... Thank you.
----------
sorry for my bad english.
Driving To Heaven is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 07-01-2012 , 14:47   Re: Save/Load (XP)
Reply With Quote #4

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 ?
__________________
Pawn ? Useless
Aooka is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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