Raised This Month: $ Target: $400
 0% 

vault problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 10-11-2010 , 04:07   vault problem
Reply With Quote #1

i edit qtm cod mod, and i changed to save levels, skills, on steam ID
but i have a problem...
after a while, when there was big number of players on server, levels started to reset after every map change
here is the vault code
PHP Code:
public SacuvajPodatke(id)
{
get_user_authid(idID_igraca31);
new 
vaultkey[64],vaultdata[256];
format(vaultkey,63,"%s-%i-cod"ID_igraca[id], klasa_igraca[id]);
format(vaultdata,255,"%i#%i#%i#%i#%i#%i"iskustvo_igraca[id], level_igraca[id], inteligencija_igraca[id], energija_igraca[id], snaga_igraca[id], kondicija_igraca[id]);
nvault_set(g_vault,vaultkey,vaultdata);
}
public 
UcitajPodatke(idklasa)
{
get_user_authid(idID_igraca31);
new 
vaultkey[64],vaultdata[256];
format(vaultkey,63,"%s-%i-cod"ID_igraca[id], klasa);
format(vaultdata,255,"%i#%i#%i#%i#%i#%i"iskustvo_igraca[id],   level_igraca[id], inteligencija_igraca[id], energija_igraca[id], snaga_igraca[id], kondicija_igraca[id]);
nvault_get(g_vault,vaultkey,vaultdata,255);
 
replace_all(vaultdata255"#"" ");
 
new 
iskustvoigraca[32], leveligraca[32], inteligencijaigraca[32], energijaigraca[32], snagacigraca[32], kondicijaigraca[32];
 
parse(vaultdataiskustvoigraca31leveligraca31inteligencijaigraca31energijaigraca31snagacigraca31kondicijaigraca31);
 
iskustvo_igraca[id] = str_to_num(iskustvoigraca);
level_igraca[id] = str_to_num(leveligraca)>0?str_to_num(leveligraca):1;
inteligencija_igraca[id] = str_to_num(inteligencijaigraca);
energija_igraca[id] = str_to_num(energijaigraca);
snaga_igraca[id] = str_to_num(snagacigraca);
kondicija_igraca[id] = str_to_num(kondicijaigraca);
poeni_igraca[id] = (level_igraca[id]-1)*2-inteligencija_igraca[id]-energija_igraca[id]-snaga_igraca[id]-kondicija_igraca[id];

and here is the whole plugin
Attached Files
File Type: sma Get Plugin or Get Source (CodModNew+SHOP.sma - 551 views - 58.5 KB)

Last edited by OvidiuS; 10-11-2010 at 04:39.
OvidiuS is offline
Send a message via Skype™ to OvidiuS
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 10-11-2010 , 14:16   Re: vault problem
Reply With Quote #2

sorry for spam, but it's rly urgent,
any idea what is causing levels to reset?
any help?
OvidiuS is offline
Send a message via Skype™ to OvidiuS
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 10-11-2010 , 14:26   Re: vault problem
Reply With Quote #3

tbh, it would be easier to understand teh code if it was in english.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 10-12-2010 , 03:40   Re: vault problem
Reply With Quote #4

maybe this can help
http://forums.alliedmods.net/showthr...=66660&page=10
ok, here is what is this plugin doing...
first part is shop, where you can buy XP, items, play lotto etc.
second part is when player joins the server
it show's a menu when he joins the server...
player can choose between 17 characters..
every character has his own weapon, hp, armor, and some of them has items(mine's, rocket's, medical kit)
every time you kill someone you get item like in Diablo mod, which give you more hp, higher speed etc.
the rest is basic RPG mod, you kill, you get XP...
more XP= bigger level
every time you get a level you can choose

PHP Code:
inteligencija_igraca[id] = bigger attack(intelligence)
energija_igraca[id] = bigger energy(more hp)
snaga_igraca[id] = bigger strenght (injuries are lower)
kondicija_igraca[id] = condition of player(higher speed
here are some other translation's
PHP Code:
iskustvo_igraca[id] = XP of a player
level_igraca
[id] = player level
ID_igraca
[id] = player steam ID 
sorry for bad translation
OvidiuS is offline
Send a message via Skype™ to OvidiuS
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 10-12-2010 , 06:48   Re: vault problem
Reply With Quote #5

Quote:
Originally Posted by OvidiuS View Post
maybe this can help
http://forums.alliedmods.net/showthr...=66660&page=10
ok, here is what is this plugin doing...
first part is shop, where you can buy XP, items, play lotto etc.
second part is when player joins the server
it show's a menu when he joins the server...
player can choose between 17 characters..
every character has his own weapon, hp, armor, and some of them has items(mine's, rocket's, medical kit)
every time you kill someone you get item like in Diablo mod, which give you more hp, higher speed etc.
the rest is basic RPG mod, you kill, you get XP...
more XP= bigger level
every time you get a level you can choose

PHP Code:
inteligencija_igraca[id] = bigger attack(intelligence)
energija_igraca[id] = bigger energy(more hp)
snaga_igraca[id] = bigger strenght (injuries are lower)
kondicija_igraca[id] = condition of player(higher speed
here are some other translation's
PHP Code:
iskustvo_igraca[id] = XP of a player
level_igraca
[id] = player level
ID_igraca
[id] = player steam ID 
sorry for bad translation
PHP Code:
public plugin_end()
{
       
nvault_closevaultname )

The vault will continue to reset unless you close it when plugin_end is called.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 10-12-2010 , 15:00   Re: vault problem
Reply With Quote #6

i've added that line, but i don't think that was causing levels to reset...
when there wasn't so much players level's were stored properly, but when number of player's increased level's started to reset...
if i'm right level should start reseting no matter how much player's was on server
if someone has another idea, post it here
GXLZPGX thank you for helping me
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-12-2010 , 20:58   Re: vault problem
Reply With Quote #7

Quote:
Originally Posted by GXLZPGX View Post
PHP Code:
public plugin_end()
{
       
nvault_closevaultname )

The vault will continue to reset unless you close it when plugin_end is called.
nvault_close( VaultHandle )
__________________
Bugsy is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 10-13-2010 , 04:36   Re: vault problem
Reply With Quote #8

PHP Code:
new g_vault
i've tried
PHP Code:
public plugin_end()
{
       
nvault_closeg_vault )

and it compiled with no errors,
but Bugsy your method show me undefined symbol
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 10-13-2010 , 09:46   Re: vault problem
Reply With Quote #9

You have it correctly, I was only pointing out that the function takes a vault handle as a param, not vault name.
__________________
Bugsy is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 10-19-2010 , 11:40   Re: vault problem
Reply With Quote #10

levlel's still reseting after mapchange, i added what bugsy and GXLZPGX said
still have some error's in log file
Code:
Run time error 10 (plugin "CodModNew+SHOP.amxx") (native "get_user_attacker") - debug not enabled!
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Reply


Thread Tools
Display Modes

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 10:24.


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