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

Solved is_user_admin(id) , does not check after map change


Post New Thread Reply   
 
Thread Tools Display Modes
DJBosma
Member
Join Date: Dec 2009
Old 03-15-2020 , 16:08   Re: is_user_admin(id) , does not check after map change
Reply With Quote #11

Quote:
Originally Posted by Bugsy View Post
1. I am not using the original code because you may have modified code which will make it not work. I am not going to look every line of the code to reverse engineer it to make sure it works.
2. You should use steam id not name, so client_infochanged() does not matter.
Great, Thanks in advance.
DJBosma is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-15-2020 , 16:19   Re: is_user_admin(id) , does not check after map change
Reply With Quote #12

Have you posted a suggestion for this functionality in the plugin thread?
__________________
Bugsy is offline
DJBosma
Member
Join Date: Dec 2009
Old 03-15-2020 , 16:28   Re: is_user_admin(id) , does not check after map change
Reply With Quote #13

Quote:
Originally Posted by Bugsy View Post
Have you posted a suggestion for this functionality in the plugin thread?
There is no plugin thread, author is unreachable. Found the plugin in an archive on Yandex.Disc

Last edited by DJBosma; 03-15-2020 at 16:29.
DJBosma is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-15-2020 , 17:21   Re: is_user_admin(id) , does not check after map change
Reply With Quote #14

It may be easier to write this from scratch. Can you explain exactly what you want it to do?
__________________
Bugsy is offline
DJBosma
Member
Join Date: Dec 2009
Old 03-15-2020 , 17:42   Re: is_user_admin(id) , does not check after map change
Reply With Quote #15

Quote:
Originally Posted by Bugsy View Post
It may be easier to write this from scratch. Can you explain exactly what you want it to do?
When a user reaches certain time played he get's flags without expiration would be enough, I'll map those flags with other plugins. Print_chat with current time played or X more minutes needed to get flags would be appreciated.

Last edited by DJBosma; 03-15-2020 at 17:45.
DJBosma is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-15-2020 , 18:08   Re: is_user_admin(id) , does not check after map change
Reply With Quote #16

Do you want a HUD that always displays to show their time played and how much more time to get flags? or only a chat command like /time?

How many different levels of time played to get flags, just 1? Like play 30 to get 5 flags, play 60 to get 7 flags, etc.
__________________
Bugsy is offline
DJBosma
Member
Join Date: Dec 2009
Old 03-15-2020 , 18:30   Re: is_user_admin(id) , does not check after map change
Reply With Quote #17

Quote:
Originally Posted by Bugsy View Post
Do you want a HUD that always displays to show their time played and how much more time to get flags? or only a chat command like /time?

How many different levels of time played to get flags, just 1? Like play 30 to get 5 flags, play 60 to get 7 flags, etc.
Dhud in the beginning of the round would be great. 2 levels would be ok. The first one mapped to 1 flag, second one has the first flag incl. another one. Dhud would be like

2 - “To become veteran play X minutes. Type !veteran” where on !veteran I will map a MOTD with info about the extras”

2 - “You are a Veteran. To become Pro play for X minutes. Type !pro” where on !pro I will map another MOTD where info is shown

if_user_admin() || has flag-veteran && flag-pro dhud will not show and print_chat on say !skill “You are an Pro player”

!skill - will show the exact same as dhud 1 & 2 (for example if the user missed it on round start)

Pruning the db every 1 or 2 days would be a nice feature regarding to balance. Minutes played would be 40~

Off-topic: I am aware that dhud has 8 channels where set_hudmessage has only 4. Since the last var in dhud “reliable” is not usable, how much could I rely on it. Is it possible to map channel 1-4 in set_hudmessage which will be constantly on the screen AND use dhud?

Last edited by DJBosma; 03-15-2020 at 18:36.
DJBosma is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-15-2020 , 20:50   Re: is_user_admin(id) , does not check after map change
Reply With Quote #18

What does the 2 mean before each of these?
Code:
2 - “To become veteran play X minutes. Type !veteran” where on !veteran I will map a MOTD with info about the extras”

2 - “You are a Veteran. To become Pro play for X minutes. Type !pro” where on !pro I will map another MOTD where info is shown
What does this mean. Please dont talk in code, speak english
Code:
if_user_admin() || has flag-veteran && flag-pro dhud will not show and print_chat on say !skill “You are an Pro player”
__________________

Last edited by Bugsy; 03-15-2020 at 20:51.
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-15-2020 , 21:10   Re: is_user_admin(id) , does not check after map change
Reply With Quote #19

Here's a rough copy, I did no testing at all. Try it and see what else is needed.

PHP Code:

#include <amxmodx>
#include <nvault>

new const Version[] = "0.3";

const 
DaySeconds 86400;

enum VeteranLevels
{
    
Player,
    
Veteran,
    
Pro
}
enum VeteranLevelData
{
    
SecondsNeeded,
    
VeteranFlags26 ],
    
VeteranBits
}
new 
VeteranInfoVeteranLevels ][ VeteranLevelData ] = 
{
    { 
"" },
    { 
1800 "fghji" },
    { 
3600 "fghjijklmnopqrstu" }
};

enum VeteranData
{
    
SteamID34 ],
    
SecondsPlayed,
    
VeteranLevels:VeteranLevel
}
new 
PlayerDataMAX_PLAYERS ][ VeteranData ];

new 
g_Vault;

public 
plugin_init() 
{
    
register_plugin"Veterans" Version "bugsy" );

    
register_event"HLTV" "NewRound" "a" "1=0" "2=0" );
    
    
register_clcmd"say !veteran" "VeteranSay" );
    
register_clcmd"say_team !veteran" "VeteranSay" );
    
    
register_clcmd"say !pro" "ProSay" );
    
register_clcmd"say_team !pro" "ProSay" );

    
register_clcmd"say !skill" "SkillSay" );
    
register_clcmd"say_team !skill" "SkillSay" );
}

public 
plugin_cfg()
{
    
nvault_prune( ( g_Vault nvault_open"veteran_data" ) ) , get_systime() - ( DaySeconds ) );
    
    for ( new 
VeteranLevels:Veteran VeteranLevels i++ )
    {
        
VeteranInfo][ VeteranBits ] = read_flagsVeteranInfo][ VeteranFlags ] );
    }
}

public 
plugin_end()
{
    
nvault_closeg_Vault );
}

public 
client_authorizedid )
{
    new 
szData13 ] , iTS;
    
    
get_user_authidid PlayerDataid ][ SteamID ] , charsmaxPlayerData[][ SteamID ] ) );
    
    if ( 
nvault_lookupg_Vault PlayerDataid ][ SteamID ] , szData charsmaxszData ) , iTS ) )
    {
        
PlayerDataid ][ SecondsPlayed ] = str_to_numszData );
        
SetVeteranLevelid );
    }
}

#if AMXX_VERSION_NUM >= 190 
public client_disconnectedid )
#else
public client_disconnectid )
#endif
{
    new 
szSeconds13 ];
    
    
num_to_strPlayerDataid ][ SecondsPlayed ] + get_user_timeid ) , szSeconds charsmaxszSeconds ) )
    
nvault_setg_Vault PlayerDataid ][ SteamID ] , szSeconds );
    
    
PlayerDataid ][ SecondsPlayed ] = 0;
    
PlayerDataid ][ VeteranLevel ] = Player;
}

public 
VeteranSayid )
{
    
show_motdid "veteran_motd.txt" );
}

public 
ProSayid )
{
    
show_motdid "pro_motd.txt" );
}

public 
SkillSayid )
{
    if ( 
PlayerDataid  ][ VeteranLevel ] < Pro )
    {
        
set_dhudmessage255 , -1.0 , -1.0 0.0 5.0 0.0 0.0 );
        
        switch ( 
PlayerDataid  ][ VeteranLevel ] )
        {
            case 
Player:
            {
                
show_dhudmessageid  "To become veteran play %d minutes. Type !veteran" VeteranInfoVeteran ][ SecondsNeeded ] / 60 );
            }
            case 
Veteran:
            {
                
show_dhudmessageid  "You are a Veteran. To become Pro play for %d minutes. Type !pro" VeteranInfoPro ][ SecondsNeeded ] / 60 );
            }
        }
    }
    else
    {
        
client_printid  print_chat "* You are a Pro player" );
    }
}

public 
NewRound()
{
    new 
iPlayers32 ] , iNum iPlayer;
    
    
get_playersiPlayers iNum "ch" );
    
    for ( new 
iNum i++ )
    {
        
iPlayer iPlayers];
        
        
SetVeteranLeveliPlayer );
        
SkillSayiPlayer );
    }
}

SetVeteranLevelid )
{
    new 
VeteranLevels:vlLevel Player;
    
    if ( 
PlayerDataid ][ VeteranLevel ] < Pro )
    {
        for ( new 
VeteranLevels:Pro >= Veteran i-- )
        {
            if ( 
PlayerDataid ][ SecondsPlayed ] >= VeteranInfo][ SecondsNeeded ] )
            {
                
vlLevel i;
                
remove_user_flagsid ADMIN_USER );
                
set_user_flagsid , ( get_user_flagsid ) | VeteranInfo][ VeteranBits ] ) );
                break;
            }
        }
    
        
PlayerDataid ][ VeteranLevel ] = vlLevel;
    }

__________________

Last edited by Bugsy; 03-17-2020 at 21:56.
Bugsy is offline
DJBosma
Member
Join Date: Dec 2009
Old 03-16-2020 , 02:37   Re: is_user_admin(id) , does not check after map change
Reply With Quote #20

Quote:
Originally Posted by Bugsy View Post
What does the 2 mean before each of these?
Code:
2 - “To become veteran play X minutes. Type !veteran” where on !veteran I will map a MOTD with info about the extras”

2 - “You are a Veteran. To become Pro play for X minutes. Type !pro” where on !pro I will map another MOTD where info is shown
What does this mean. Please dont talk in code, speak english
Code:
if_user_admin() || has flag-veteran && flag-pro dhud will not show and print_chat on say !skill “You are an Pro player”
PS3: I saw the nvault_prune. Does “* 2” indicate days?

PS2: I’m not seeing a function where it removes the rights and prunes the vault every day.

PS: I saw that it saves the seconds played when user disconnects. Does he/she receive flags right away or after next round?

The only thing is - !skill a command where the user could see the same info as dhud but in chat( when for example he/she missed the Dhud in the beginning of the round. And “you are a pro player” will only show when command is typed.

Last edited by DJBosma; 03-16-2020 at 03:13.
DJBosma 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 14:00.


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