Raised This Month: $ Target: $400
 0% 

Solved Save, read and compare user IP in fvault


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
The overrated maniac
Member
Join Date: Jun 2021
Location: Argentina
Old 07-03-2021 , 07:21   Save, read and compare user IP in fvault
Reply With Quote #1

I add my ip that I found in amx_who, with amx_save_ip "ip". Then I reconnect and says the user ip isn't in the file. What can I do?

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fvault>

#define PLUGIN "fvault test"
#define VERSION "1.0"
#define AUTHOR "Maniatico"

new g_szUserIP[33][191];
new 
g_szSavedIP[191];

new const 
Vault[] = "_ips"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd("amx_save_ip""save_ip"ADMIN_IMMUNITY);
}


public 
client_putinserver(id){
    
    
get_user_ip(idg_szUserIP[id], charsmax(g_szUserIP[]), 1);
    
set_task(5.0"Load"id);
}

public 
client_disconnect(id){
    
    
remove_task(id);
}

public 
save_ip(id){
    
    if(!(
get_user_flags(id) & ADMIN_IMMUNITY)){
        
        return 
PLUGIN_HANDLED;
    }
    else{
        
read_argv(1g_szSavedIP190);
        
        if( 
equal(g_szSavedIP"" ) || contain(g_szSavedIP" ") != -1){
            
console_print(id"Cant take that ip");
            return 
PLUGIN_HANDLED;
        }
        else {
            static 
SZ_Data[512], SZ_NAME[32];
            
formatex(SZ_Datacharsmax(SZ_Data), "IP: %s"g_szSavedIP)
            
fvault_set_data(VaultSZ_NAMESZ_Data)
            
            
console_print(id"IP %s saved"g_szSavedIP);
            
Save(id);
        }
        return 
PLUGIN_CONTINUE;
    }
    return 
PLUGIN_HANDLED;
}
 
public 
Save(id){
    
    static 
SZ_Data[512], SZ_NAME[32]
    
get_user_name(idSZ_NAME31);
    
    
formatex(SZ_Datacharsmax(SZ_Data), "Name: %s - IP: %s"SZ_NAME[id], g_szSavedIP[id])
    
fvault_set_data(VaultSZ_NAMESZ_Data)
}

public 
Load(id){
    
    static 
SZ_Data[512],  VAULT_IP[191], SZ_NAME[32];
    new 
size_vault fvault_size(Vault);
    
    
get_user_name(idSZ_NAME31);
    
    if( !
fvault_get_dataVault,SZ_DataSZ_NAMEcharsmaxSZ_Data ) ) ){
        return 
0;
    }
    
    
parse(SZ_DataVAULT_IPcharsmax(VAULT_IP))
    
    for (new 
0size_vaulti++){
        
fvault_get_keyname(VaultiSZ_NAMEcharsmax(SZ_NAME));
        
fvault_get_data(VaultSZ_NAMESZ_Datacharsmax(SZ_Data));
        
        if(
equal(g_szUserIP[id], g_szSavedIP[i])){
            
client_print(0print_chat"The user ip is already saved in the file.");
        }
        else{
            
client_print(0print_chat"The user ip is not saved in the file.");
        }
    }
    return 
PLUGIN_HANDLED;


Last edited by The overrated maniac; 07-05-2021 at 01:37. Reason: Solved
The overrated maniac 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 02:29.


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