AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to: create an admin cmd for reset vault (https://forums.alliedmods.net/showthread.php?t=240677)

swapped 05-20-2014 03:51

How to: create an admin cmd for reset vault
 
Hello all, i want to create a command for reset my vault :

Code:
        g_points = nvault_open("points");

how to do that ? ( cmd name: amx_reset_points )

, Thank you !

jimaway 05-20-2014 05:59

Re: How to: create an admin cmd for reset vault
 
Code:
/* Prunes the vault for entries that are within the given timestamps.  * This will not erase values set with pset  */ native nvault_prune(vault, start, end);

swapped 05-21-2014 00:25

Re: How to: create an admin cmd for reset vault
 
Is not working , is not reset the xp and level, just print the messages...

Code:

public cmd_reset_xp(id,level,cid)
{
        if(!cmd_access(id,level,cid,2))
                return PLUGIN_HANDLED;

        new arg[33]
        read_argv(1, arg, 32)

        new fp = str_to_num( arg );


        new player_name[35];
        get_user_name(id, player_name, charsmax(player_name) - 1);
        new TAG[60];
        get_pcvar_string( levelmod_prefix, TAG, charsmax( TAG ) - 1 );
       
        if( !fp )
        {
                console_print( id, "amx_resetpxp < 1 > for reset all xp / levels" );
                return 1;
        }

        else
        {
                ColorChat(0, TEAM_COLOR, "^1[ ^4%s^1 ] Admin ^4%s^1 has reset all xp and levels.",TAG, player_name ); 
                nvault_prune( g_hnsxp_vault, 0, get_systime() );
                return 1;
        }
        return 0;
}


xxxperts 05-23-2014 00:39

Re: How to: create an admin cmd for reset vault
 
PHP Code:

public cmd_ResetXP(idlevelcid)
{
    if(!
cmd_access(idlevelcid2)) return PLUGIN_HANDLED;
    
    new 
iArg[7]; // size of variable must me enough
    
read_argv(1iArgsizeof(iArg) - 1);
    
    new 
input str_to_num(iArg);
    
    if(
input == 1)
    {
        new 
Players[32], iNumid;
        
get_players(PlayersiNum"ch");
        
        
/* if thier are some players online loop and reset their xp and bla bla*/
        
for(--iNumiNum >= 0iNum--)
        {
            
id Players[iNum];
            
            
/* Reset your Variable here if u understood */
            
XP[id] = 0;
            
SaveData(id);
        }
        
        
nvault_prune(iVaultHandle0get_systime() + 1);
        
server_cmd("restart 1"); /* restarting sv depends on you*/
    
}
    
    return 
PLUGIN_CONTINUE;



joelverghese 05-23-2014 01:58

Re: How to: create an admin cmd for reset vault
 
Quote:

Originally Posted by xxxperts (Post 2141404)
PHP Code:

server_cmd("restart 1"); /* restarting sv depends on you*/ 


=====>
PHP Code:

server_cmd("sv_restart 1"); /* restarting sv depends on you*/ 


xxxperts 05-23-2014 08:26

Re: How to: create an admin cmd for reset vault
 
Quote:

Originally Posted by joelverghese (Post 2141414)
=====>
PHP Code:

server_cmd("sv_restart 1"); /* restarting sv depends on you*/ 


i dont wanted to restart game i wanted to restart server

Black Rose 05-23-2014 17:48

Re: How to: create an admin cmd for reset vault
 
Then it's just "restart", you don't need the number as it does nothing.


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

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