Raised This Month: $ Target: $400
 0% 

[HELP]How can I save.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ShLuMieL
Senior Member
Join Date: Jul 2010
Old 01-08-2014 , 11:40   [HELP]How can I save.
Reply With Quote #1

Hello to all.
I want to maker some plugin but I ain't got any idea how can I save fuction for player even he logs off.

I Helped with Exeloet tutorial about save&load (fvault).

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fvault>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "AUTHOR"

new const g_vault_name[] = "Health-Saver";

new 
gXP[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
register_clcmd("say /heal""Menu")
}

public 
Menu(id)
{
    new 
szItem[256]
    
    
formatex(szItemcharsmax(szItem), "\w[ \rMenu \w] \yMain Menu:")
    new 
menu menu_create(szItem"Menu_Handler"
    
    
menu_additem(menu"Item1"""0);
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}

public 
Menu_Handler(iditem)
{
    switch(
item)
    {
        case 
0:
        {
            
set_user_health(id155)
        }
    }
    
    return 
PLUGIN_HANDLED;
}

// Save & Load.
public LoadHealth(id)
{
    new 
authid[35];
    
get_user_authid(idauthidsizeof(authid) - 1);
    
    new 
data[16];
    if( 
fvault_get_data(g_vault_nameauthiddatasizeof(data) - 1) )
    {
        
gXP[id] = str_to_num(data);
    }
    else
    {
        
gXP[id] = 0;
    }
}

public 
SaveHealth(id)
{
    new 
authid[35];
    
get_user_authid(idauthidsizeof(authid) - 1);
    
    new 
data[16];
    
num_to_str(gXP[id], datasizeof(data) - 1);
    
    
fvault_set_data(g_vault_nameauthiddata);

if I want to save the 'Health' for someplayer, if he take 'Item 1' his health allway will stay 155, how can I add it in fvault? can it possible?

Thank's.

Last edited by ShLuMieL; 01-08-2014 at 11:41.
ShLuMieL is offline
 



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 10:13.


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