AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   nVault Problem (https://forums.alliedmods.net/showthread.php?t=77075)

anakin_cstrike 09-04-2008 19:26

nVault Problem
 
Hi..i have this code, but it doesn't work.
PHP Code:

public client_disconnect(id)
{
    static 
    
Key[64],Value[64],name[32],
    
stats[8],body[8],stats2[4],
    
rank_pos,Vault;
    
rank_pos get_user_stats(id,stats,body)
    
get_user_stats2(id,stats2);
    
total[id] = stats2[1] + stats2[2] + stats2[3] + stats[0] - stats[1];
    
    
Vault nvault_open("war_points");
    
get_user_name(id,namesizeof name 1);
    
formatex(Keysizeof Key 1"%s-War_Points-%d",name,rank_pos);
    
formatex(Value,sizeof Value 1"%d"total[id]);
    
nvault_set(VaultKeyValue);
    
nvault_close(Vault);
}
public 
client_putinserver(id)
{
    static 
Key[64], Value[64], name[32],Vault;
    
get_user_name(id,namesizeof name 1);
    
Vault nvault_open("war_points");
    
formatex(Keysizeof Key 1"%s-War_Points:",name);
    
nvault_get(VaultKeyValuesizeof Value 1);
    
nvault_close(Vault);
    
Number[id] = str_to_num(Value);
    
set_task(5.0,"changewithpoints",id);
}
public 
changewithpoints(id)
{
    if(!
is_user_connected(id))
        return 
PLUGIN_CONTINUE;
    new 
name[32],Buffer[64],value;
    
get_user_name(id,name,31);
    if(
Number[id] > 0)
        
value 100 Number[id];
    else if(
Number[id] < 0)
        
value 100 Number[id];
    switch(
get_user_team(id))
    {
        case 
1formatex(Buffer,63,"b.%s<%d>",name,value);
        case 
2formatex(Buffer,63,"a.%s<%d>",name,value);
    }
    
client_cmd(id,"name ^"%s^"",Buffer);
    return 
PLUGIN_CONTINUE;


I want to change the name like this:
Code:

a.player<150>
for example...
* 100 - default number
* 150 - example number...bomb exploded,+defused,+planted + kills - deaths

Emp` 09-04-2008 20:29

Re: nVault Problem
 
you're not using the same key to save and read from

Code:

    formatex(Key, sizeof Key - 1, "%s-War_Points-%d",name,rank_pos);
Code:

    formatex(Key, sizeof Key - 1, "%s-War_Points:",name);


All times are GMT -4. The time now is 03:17.

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