AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   vault problem (https://forums.alliedmods.net/showthread.php?t=140348)

OvidiuS 10-11-2010 04:07

vault problem
 
1 Attachment(s)
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

OvidiuS 10-11-2010 14:16

Re: vault problem
 
sorry for spam, but it's rly urgent,
any idea what is causing levels to reset?
any help?

nikhilgupta345 10-11-2010 14:26

Re: vault problem
 
tbh, it would be easier to understand teh code if it was in english. :(

OvidiuS 10-12-2010 03:40

Re: vault problem
 
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 :)

GXLZPGX 10-12-2010 06:48

Re: vault problem
 
Quote:

Originally Posted by OvidiuS (Post 1322728)
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.

OvidiuS 10-12-2010 15:00

Re: vault problem
 
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 :)

Bugsy 10-12-2010 20:58

Re: vault problem
 
Quote:

Originally Posted by GXLZPGX (Post 1322804)
PHP Code:

public plugin_end()
{
       
nvault_closevaultname )


The vault will continue to reset unless you close it when plugin_end is called.

:arrow: nvault_close( VaultHandle )

OvidiuS 10-13-2010 04:36

Re: vault problem
 
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

Bugsy 10-13-2010 09:46

Re: vault problem
 
You have it correctly, I was only pointing out that the function takes a vault handle as a param, not vault name.

OvidiuS 10-19-2010 11:40

Re: vault problem
 
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!


All times are GMT -4. The time now is 10:24.

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