Raised This Month: $32 Target: $400
 8% 

Remove line from users.ini


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-30-2020 , 20:59   Re: Remove line from users.ini
Reply With Quote #11

My code above will handle the remove part.

"and if users.ini LINE contain ip of user its remove line"
__________________
Bugsy is offline
Carrion
Member
Join Date: Mar 2020
Old 03-30-2020 , 21:02   Re: Remove line from users.ini
Reply With Quote #12

sma

Last edited by Carrion; 03-31-2020 at 22:14.
Carrion is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-30-2020 , 21:11   Re: Remove line from users.ini
Reply With Quote #13

I'm not looking through a plugin to try and figure out what you want. I think you're better off posting in suggestions.requests if you want a plugin modification.

I recommend not using users.ini, and giving flags during run-time using set_user_flags().
__________________

Last edited by Bugsy; 03-30-2020 at 21:12.
Bugsy is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-30-2020 , 21:16   Re: Remove line from users.ini
Reply With Quote #14

set_user_flags(), a variable & nvault would do the trick here imo...
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Carrion
Member
Join Date: Mar 2020
Old 03-30-2020 , 21:17   Re: Remove line from users.ini
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
I'm not looking through a plugin to try and figure out what you want. I think you're better off posting in suggestions.requests if you want a plugin modification.

I recommend not using users.ini, and giving flags during run-time using set_user_flags().
ok, can u move this post to there? or make newone?
Carrion is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-30-2020 , 21:22   Re: Remove line from users.ini
Reply With Quote #16

Quote:
Originally Posted by Carrion View Post
ok, can u move this post to there? or make newone?
Can you post your full code again please?
__________________

Last edited by Napoleon_be; 03-30-2020 at 21:35.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Carrion
Member
Join Date: Mar 2020
Old 03-30-2020 , 21:41   Re: Remove line from users.ini
Reply With Quote #17

Quote:
Originally Posted by Napoleon_be View Post
Can you post your full code again please?
done https://forums.alliedmods.net/showpo...9&postcount=12
Carrion is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 03-30-2020 , 22:02   Re: Remove line from users.ini
Reply With Quote #18

okay so this is how i would try to do it, it's untested though so it can be bugged. It shouldn't be more complicated than this.

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

#include <amxmodx>
#include <amxmisc>
#include <csstats>

#define PLUGIN "VipStats"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"


new pVipFlags;
new 
pAdminFlags;
new 
pVipKills;
new 
pAdminKills;

new 
bool:bHasFlags[33];

new 
szFlags[20];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
pVipFlags register_cvar("amx_vipflags""bi"); // Set desired flags
    
pAdminFlags register_cvar("amx_adminflags""bicdeu"); // Set desired flags
    
pVipKills register_cvar("amx_vipkills""1000");
    
pAdminKills register_cvar("amx_adminkills""5000");
}

public 
CheckFlags(id)
{
    if(!(
get_user_flags(id) & ADMIN_KICK)) // Avoid regular admins getting reset.
    
{    
        new 
iStats[8], iBodyHits[8];
        
get_user_stats(idiStatsiBodyHits);
    
        if(
iStats[0] >= get_pcvar_num(pAdminKills))
        {
            
get_pcvar_string(pAdminFlagsszFlagscharsmax(szFlags));
        
            
set_user_flags(idread_flags(szFlags));
        
            
bHasFlags[id] = true;
        }
    
        else if(
iStats[0] >= get_pcvar_num(pVipKills))
        {
            
get_pcvar_string(pVipFlags,  szFlagscharsmax(szFlags));
        
            
set_user_flags(idread_flags(szFlags));
        
            
bHasFlags[id] = true;
        }
    }
}

public 
RemoveFlags(id)
{
    
remove_user_flags(idread_flags(szFlags));
    
set_user_flags(idread_flags("z"));
    
    
bHasFlags[id] = false;
}

public 
client_putinserver(id)
{
    
CheckFlags(id);
}

#if AMXX_VERSION_NUM < 190
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
    if(
bHasFlags[id])
    {
        
RemoveFlags(id);
    }

__________________

Last edited by Napoleon_be; 03-30-2020 at 22:19.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-30-2020 , 22:13   Re: Remove line from users.ini
Reply With Quote #19

In RemoveFlags(), you must first remove flags before setting. set_user_flags() is basically an 'add flags' command. And szReadFlags variable is pointless, if you use the value only one time, just place the function directly in set_user_flags(). And no need to remove flags as the player is disconnecting.
__________________

Last edited by Bugsy; 03-30-2020 at 22:20.
Bugsy is offline
Carrion
Member
Join Date: Mar 2020
Old 03-30-2020 , 22:17   Re: Remove line from users.ini
Reply With Quote #20

Quote:
Originally Posted by Napoleon_be View Post
okay so this is how i would try to do it, it's untested though so it can be bugged. It shouldn't be more complicated than this.

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

#include <amxmodx>
#include <amxmisc>
#include <csstats>

#define PLUGIN "VipStats"
#define VERSION "1.0"
#define AUTHOR "NapoleoN#"


new pVipFlags;
new 
pAdminFlags;
new 
pVipKills;
new 
pAdminKills;

new 
bool:bHasFlags[33];

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
pVipFlags register_cvar("amx_vipflags""bi"); // Set desired flags
    
pAdminFlags register_cvar("amx_adminflags""bicdeu"); // Set desired flags
    
pVipKills register_cvar("amx_vipkills""1000");
    
pAdminKills register_cvar("amx_adminkills""5000");
}

public 
CheckFlags(id)
{
    if(!(
get_user_flags(id) & ADMIN_KICK)) // Avoid regular admins getting reset.
    
{    
        new 
iStats[8], iBodyHits[8];
        
get_user_stats(idiStatsiBodyHits);
    
        if(
iStats[0] >= get_pcvar_num(pAdminKills))
        {
            new 
szFlags[20], szReadFlags;
            
get_pcvar_string(pAdminFlagsszFlagscharsmax(szFlags));
        
            
szReadFlags read_flags(szFlags);
            
set_user_flags(idszReadFlags);
        
            
bHasFlags[id] = true;
        }
    
        else if(
iStats[0] >= get_pcvar_num(pVipKills))
        {
            new 
szFlags[20], szReadFlags;
            
get_pcvar_string(pVipFlags,  szFlagscharsmax(szFlags));
        
            
szReadFlags read_flags(szFlags);
            
set_user_flags(idszReadFlags);
        
            
bHasFlags[id] = true;
        }
    }
}

public 
RemoveFlags(id)
{
    new 
szFlags read_flags("z");
    
set_user_flags(idszFlags);
    
    
bHasFlags[id] = false;
}

public 
client_putinserver(id)
{
    
CheckFlags(id);
}

#if AMXX_VERSION_NUM < 190
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
    if(
bHasFlags[id])
    {
        
RemoveFlags(id);
    }

tnx man for your time <3 but i dont want set_user_flaggs and vault methods
there is lot of plugins with that method like https://forums.alliedmods.net/showthread.php?t=304480 etc...
i want the code just for remove line from users.ini, please check the code again i have bad knowledge with manipulating file...

Last edited by Carrion; 03-31-2020 at 22:19.
Carrion is offline
Reply


Thread Tools
Display Modes

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 19:00.


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