Raised This Month: $51 Target: $400
 12% 

How to: create an admin cmd for reset vault


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-20-2014 , 03:51   How to: create an admin cmd for reset vault
Reply With Quote #1

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 !
swapped is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 05-20-2014 , 05:59   Re: How to: create an admin cmd for reset vault
Reply With Quote #2

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);
jimaway is offline
Old 05-20-2014, 10:42
swapped
This message has been deleted by swapped. Reason: read second reply.
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-21-2014 , 00:25   Re: How to: create an admin cmd for reset vault
Reply With Quote #3

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;
}
swapped is offline
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 05-23-2014 , 00:39   Re: How to: create an admin cmd for reset vault
Reply With Quote #4

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;

__________________
All my work is here
xxxperts is offline
joelverghese
Member
Join Date: Oct 2011
Old 05-23-2014 , 01:58   Re: How to: create an admin cmd for reset vault
Reply With Quote #5

Quote:
Originally Posted by xxxperts View Post
PHP Code:
server_cmd("restart 1"); /* restarting sv depends on you*/ 
=====>
PHP Code:
server_cmd("sv_restart 1"); /* restarting sv depends on you*/ 
joelverghese is offline
xxxperts
Senior Member
Join Date: Oct 2013
Location: India
Old 05-23-2014 , 08:26   Re: How to: create an admin cmd for reset vault
Reply With Quote #6

Quote:
Originally Posted by joelverghese View Post
=====>
PHP Code:
server_cmd("sv_restart 1"); /* restarting sv depends on you*/ 
i dont wanted to restart game i wanted to restart server
__________________
All my work is here
xxxperts is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-23-2014 , 17:48   Re: How to: create an admin cmd for reset vault
Reply With Quote #7

Then it's just "restart", you don't need the number as it does nothing.
__________________

Last edited by Black Rose; 05-23-2014 at 17:49.
Black Rose is offline
Reply



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 17:33.


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