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

[REQUEST] Random VIP (as_maps)


Post New Thread Reply   
 
Thread Tools Display Modes
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 06-04-2021 , 19:31   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #11

Still need this, please.
MAJESTIC_SZ is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-04-2021 , 20:34   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #12

Quote:
Originally Posted by MAJESTIC_SZ View Post
Still need this, please.
Try, untested:

PHP Code:
#include <amxmodx>

#define PLUGIN "Every X Round/Kill get vip"
#define VERSION "1.1"
#define AUTHOR "Supremache"

#define VIP_FLAG ADMIN_LEVEL_H

new eRoundNum 0;
new 
g_pCvarRounds
new bool:g_VipRound[33]
new 
szPlayerName[33][33]

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("DeathMsg""eDeath""a")
    
register_event("HLTV""OnNewRound""a""1=0""2=0");
    
register_logevent"eRoundEnd"2"1=Round_End" );
    
    
g_pCvarRounds register_cvar("vip_rounds""2")
}    

public 
OnNewRound()
{
    if(
eRoundNum == get_pcvar_num(g_pCvarRounds))
    {
        new 
iPlayers[32], iNum;
        
get_playersiPlayersiNum "a");
        
        for( new 
iiNumi++ )
        {
            new 
iPlayer GetRandomAlive(random_num(1iPlayers[i]))
            
            if (
g_VipRound[iPlayer])
            {
                
set_user_flags(iPlayerVIP_FLAG)
                
client_print(iPlayerprint_chat"[VIP Reward] Congratulations, You got free vip for one round.")
                
client_print(0print_chat"[VIP Reward] %s got free vip for one round."szPlayerName[iPlayer])
            }
        }
    }
    
    
eRoundNum++
}

public 
eRoundEnd()
{
    new 
iPlayers[32], iNum;
    
get_playersiPlayersiNum);
        
    for( new 
iiNumi++ )
    {
        
remove_user_flags(iPlayers[i], VIP_FLAG)
    }
}

public 
eDeath()
{
    new 
Attacker read_data(1)
    new 
Victim read_data(2)
        
    if(!
is_user_connected(Attacker))
        return
        
    if(
Victim != Attacker)
    {
        
set_user_flags(AttackerVIP_FLAG)
        
client_print(0print_chat"[VIP Reward] Player %s got vip for killing %s"szPlayerName[Attacker], szPlayerName[Victim])
    }
    else if (!
g_VipRound[Attacker])
    {
        
remove_user_flags(AttackerVIP_FLAG)
        
client_print(0print_chat"[VIP Reward] Player %s lost his vip because killed by %s"szPlayerName[Attacker], szPlayerName[Victim])
    }
}
 
public 
client_putinserver(id)
{
    
get_user_nameidszPlayerName[id], charsmax(szPlayerName[]));
    
    
// When player connecting to the server will get remove from vip access
    
remove_user_flags(idVIP_FLAG)
}

public 
client_disconnect(id)
{
    
g_VipRound[id] = false;
}

GetRandomAlive(iPlayer)
{
    static 
iAlive
    iAlive 
0
    
    
for (new 1<= get_maxplayers(); i++)
    {
        if (
is_user_alive(i))
        
iAlive++
        
        if (
iAlive == iPlayer)
        return 
i;
    }
    
    return -
1;

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 06-06-2021 at 12:25.
Supremache is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 06-05-2021 , 14:55   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #13

Thanks for answering Supremache, but it does not work. It prints a message saying player X got vip for killing player Y everytime someone kills another player, but nothing hapens.
I just want the VIP status to change to another CT player every 2 or 3 rounds or when he gets killed.
The VIP player is a special character only playable on AS maps (assassin mode), the objective is to CTs get him to an escape zone and Ts must prevent him to reach it.
I remember playing it years ago with no problems, but now the VIP sticks on the same player the entire map and i dont know why. Maybe because some update valve did.

Last edited by MAJESTIC_SZ; 06-05-2021 at 20:47.
MAJESTIC_SZ is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-06-2021 , 05:31   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #14

Quote:
Originally Posted by MAJESTIC_SZ View Post
Thanks for answering Supremache, but it does not work. It prints a message saying player X got vip for killing player Y everytime someone kills another player, but nothing hapens.
I just want the VIP status to change to another CT player every 2 or 3 rounds or when he gets killed.
The VIP player is a special character only playable on AS maps (assassin mode), the objective is to CTs get him to an escape zone and Ts must prevent him to reach it.
I remember playing it years ago with no problems, but now the VIP sticks on the same player the entire map and i dont know why. Maybe because some update valve did.
Check #12
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 06-06-2021 at 05:33.
Supremache is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-06-2021 , 13:01   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #15

Quote:
Originally Posted by Supremache View Post
Check #12
He isn't talking about "vip" as in admin. He is talking about the vip that spawns in the as map, the one CT's have to protect or they lose.
__________________
HamletEagle is offline
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 06-06-2021 , 13:06   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #16

Quote:
Originally Posted by HamletEagle View Post
He isn't talking about "vip" as in admin. He is talking about the vip that spawns in the as map, the one CT's have to protect or they lose.
Ooh, i understood
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 06-07-2021 , 18:10  
Reply With Quote #17

Quote:
Originally Posted by Supremache View Post
Ooh, i understood
Aleluia
So, can you do it?
I warn you, i use REHLDS +amx 1.9

Quote:
Originally Posted by HamletEagle View Post
He isn't talking about "vip" as in admin. He is talking about the vip that spawns in the as map, the one CT's have to protect or they lose.
Cmon Hamlet, help me out please

Last edited by HamletEagle; 06-08-2021 at 08:57.
MAJESTIC_SZ is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-08-2021 , 08:57   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #18

Please follow the rules and don't double post or bump your topic. If someone wants to help then they will help. Spamming isn't going to accomplish anything.
__________________
HamletEagle is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-09-2021 , 06:23   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #19

PHP Code:
#include <amxmodx>
#include <reapi>

new bool:g_AlreadyVIP[33]

public 
plugin_init()
{
    
register_plugin("Random VIP""1.0""Celena Luna")
    
RegisterHookChain(RG_CBasePlayer_MakeVIP"CBasePlayer_MakeVIP")
}

public 
client_disconnect(id)
{
    
g_AlreadyVIP[id] = false
}

public 
CBasePlayer_MakeVIP(id)
{
    new 
vip GetRandomPlayer() //Get random player that haven't been being VIP once

    
if(is_user_connected(vip))
    {
        
//Set him as VIP
        
rg_set_user_model(vip"vip");
        
set_member(vipm_iTeamTEAM_CT);
        
set_member(vipm_bIsVIPtrue);
        
set_member_game(m_pVIPvip)
        
set_member_game(m_iConsecutiveVIP1);
        
g_AlreadyVIP[vip] = true;
    }
    return 
HC_SUPERCEDE;
}

public 
GetRandomPlayer()
{
    new 
players[32], numiPlayer 
    
new RandomList[33], 0
    
new SelectedPlayer

    
//Get all player from alive CT 
    
get_players(playersnum"ae""CT")

    for(new 
i=0numi++)
    {
        
iPlayer players[i]
        if(!
g_AlreadyVIP[iPlayer]) //if he/she haven't been being VIP once
        
{
            
RandomList[j] = iPlayer //Put in RandomList
            
j++
        }    
    }

    if(
<= 0//If all CT have been VIP once
    
{
        
SelectedPlayer players[random_num(0num)] //Select 1 random player in CT to become vip

        //Then reset all player VIP counter
        
for(new i=0numi++)
        {
            
iPlayer players[i]
            
g_AlreadyVIP[iPlayer] = false 
        
}
    }
    else 
//If there is more than 1 player haven't been VIP once
    
{
        
SelectedPlayer RandomList[random_num(0j)] //Select Random player from the list to become VIP
    
}

    return 
SelectedPlayer    

I found this one on Dev-CS
It basically block the original MakeVIP functions and do it is own.
Edit: find_player_ex is not random, I will make an edit later with get_players
Edit2: Code updated.
__________________
My plugin:

Last edited by Celena Luna; 06-10-2021 at 00:01. Reason: I forget to set g_AlreadyVIP to true after make vip
Celena Luna is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 06-09-2021 , 22:17   Re: [REQUEST] Random VIP (as_maps)
Reply With Quote #20

I updated the code above. I also add to make every player from CT side can be VIP at least one.
If you don't want it, just replace this GetRandomPlayer() part:

Spoiler
__________________
My plugin:

Last edited by Celena Luna; 06-10-2021 at 00:00.
Celena Luna 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 23:06.


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