AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   I need help with nVault (https://forums.alliedmods.net/showthread.php?t=284428)

GolfCart 06-26-2016 13:23

I need help with nVault
 
Hello, I use nVault and I have some problems. First let me post the codes.

Here is code when I want to restart kills...
PHP Code:

register_clcmd("say /resetall""RestartUbistava"); 

And here is "RestartUbistava" code...
PHP Code:

public RestartUbistava(id)
{
    
nvault_prune(g_vault0get_systime() - 1);
    
server_cmd("changelevel de_dust2");


And now, problem is that when I use /resetall command it reset every entrie except my. Is that cuz I have admin flags or something? Please, I need fast answer.

EFFx 06-26-2016 13:37

Re: I need help with nVault
 
PHP Code:

nvault_prune(g_vault0get_systime() - 1

PHP Code:

nvault_prune(g_vault0get_systime() + 1

Try it

GolfCart 06-26-2016 13:40

Re: I need help with nVault
 
Quote:

Originally Posted by EFFx (Post 2430831)
PHP Code:

nvault_prune(g_vault0get_systime() - 1

PHP Code:

nvault_prune(g_vault0get_systime() + 1

Try it

Same problem. :)

JusTGo 06-26-2016 14:04

Re: I need help with nVault
 
Quote:

Originally Posted by GolfCart (Post 2430833)
Same problem. :)

post the hole code.

GolfCart 06-26-2016 14:14

Re: I need help with nVault
 
PHP Code:

#include <amxmodx>
#include <nvault>  

new g_vault;

public 
plugin_init() { 
    
register_clcmd("say /resetall""RestartUbistava");
    
    
g_vault nvault_open("KnifeSystem");
    if(
g_vault== INVALID_HANDLEset_fail_state("Greska pri otvaranju gVaulta");  
}

public 
client_putinserver(id)
{
    
LoadData(id)
}

public 
client_disconnect(id)
{
    
SaveData(id)
}

public 
SaveData(id

    new 
AuthID[35
    
get_user_authid(id,AuthID,34)
    new 
vaultkey[64],vaultdata[256
 
    
format(vaultkey,63,"%s-Knife",AuthID
    
format(vaultdata,255,"%i",ubistva_igraca[id]) 
    
    
nvault_set(g_vault,vaultkey,vaultdata)
    return 
PLUGIN_CONTINUE 


public 
LoadData(id

    new 
AuthID[35
    
get_user_authid(id,AuthID,34
    new 
vaultkey[64],vaultdata[256
    
    
format(vaultkey,63,"%s-Knife",AuthID
    
format(vaultdata,255,"%i",ubistva_igraca[id]) 
    
    
nvault_get(g_vault,vaultkey,vaultdata,255
    
replace_all(vaultdata255"#"" "
    new 
ubistva[32]
    
parse(vaultdataubistva31
    
ubistva_igraca[id] = str_to_num(ubistva
    return 
PLUGIN_CONTINUE 
}  

public 
plugin_end()
{
    
nvault_close(g_vault)
}

public 
RestartUbistava(id)
{
    
nvault_prune(g_vault0get_systime() + 1)
    
ColorChat(0NORMAL"^4[Knife Mod] ^1Administrator je restartovao ubistva svim igracima.");
    
server_cmd("changelevel de_dust2");


There is also other part of code but it's not connected to this problem.

EFFx 06-26-2016 14:49

Re: I need help with nVault
 
Use

PHP Code:

public RestartUbistava(id)
{
    new 
szPlayers[32],iNum
    get_players
(szPlayers,iNum)
    for(new 
iNumi++)
    {
          
ubistva_igraca[players[i]] = 0
    
}
    
nvault_prune(g_vault0get_systime() + 1)
    
ColorChat(0NORMAL"^4[Knife Mod] ^1Administrator je restartovao ubistva svim igracima.");

    
server_cmd("changelevel de_dust2");


nvault_prune delete all knives saved on g_vault. So you need just reset for alive players.

GolfCart 06-26-2016 15:28

Re: I need help with nVault
 
Quote:

Originally Posted by EFFx (Post 2430847)
nvault_prune delete all knives saved on g_vault. So you need just reset for alive players.

Case solved, thank you. :)

Bugsy 06-26-2016 20:52

Re: I need help with nVault
 
get_systime() - 1 and get_systime() + 1 makes no sense and serves no purpose as this just adds or removes 1 second from the current time. You should just do nvault_prune( g_vault , 0 , get_systime() ).

GolfCart 06-27-2016 08:35

Re: I need help with nVault
 
Quote:

Originally Posted by Bugsy (Post 2430946)
get_systime() - 1 and get_systime() + 1 makes no sense and serves no purpose as this just adds or removes 1 second from the current time. You should just do nvault_prune( g_vault , 0 , get_systime() ).

Yeah, I figured it out already by taking a look on your nVault thread. Thanks. :)
Here is the working code..
PHP Code:

public RestartujUbistva()
{
    new 
iPlayer[32], iNum
    get_players
(iPlayeriNum)
    for(new 
iiNumi++) 
    {
        
ubistva_igraca[iPlayer[i]] = 0;
    }
    
nvault_prune(g_vault0get_systime())
    
server_cmd("changelevel de_dust2");
    return 
PLUGIN_CONTINUE




All times are GMT -4. The time now is 09:54.

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