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

Request > VIP player plugin


Post New Thread Reply   
 
Thread Tools Display Modes
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-20-2017 , 17:40   Re: Request > VIP player plugin
Reply With Quote #11

Oh, my bad, got it.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
wendetta
Member
Join Date: Jul 2012
Old 03-20-2017 , 17:45   Re: Request > VIP player plugin
Reply With Quote #12

Quote:
Originally Posted by EFFx View Post
Oh, my bad, got it.
Okey I am waiting you
wendetta is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-20-2017 , 18:01   Re: Request > VIP player plugin
Reply With Quote #13

Not tested

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>

#define PLUGIN "Simple VIP"
#define VERSION "1.0"
#define AUTHOR "author"

#define MAX_PLAYERS            32
#define ACCESS_LEVEL            ADMIN_KICK

new bool:isVip[MAX_PLAYERS+1]

new 
g_sHudMsg[8]

new 
pCvarMinRounds
new g_iRoundsg_iVipId

enum Teams
{
    
CTs,
    
Ts
}

new 
g_iScores[Teams]
const 
XO_WEAPON 4

const m_pPlayer =        41
const m_flNextPrimaryAttack =    46
const TASK_HUDMESSAGE =            5031
const TASK_SHOW_RADAR =            5032

new msg_HostagePosmsg_HostageK

new bool:g_bVIPMode

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
msg_HostagePos =    get_user_msgid("HostagePos")
    
msg_HostageK =        get_user_msgid("HostageK")
    
    for(new 
i;sizeof g_sHudMsg;i++)
    {
        
g_sHudMsg[i] = CreateHudSyncObj()
    }
    
    
pCvarMinRounds register_cvar("vipmod_rounds""10")
    
    
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_c4""CC4_PrimaryAttack")
    
RegisterHam(Ham_Spawn"player""HamPlayerSpawnPost"1
    
    
register_event("SendAudio""roundEnd","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
    
register_event("DeathMsg""deathMsg""a")
    
register_event("SendAudio""event_CTsWin""a""1=0""2=%!MRAD_ctwin"
    
    
register_clcmd("jointeam""cmdJoinTeam")
    
register_clcmd("say""checkSay")
}

public 
event_CTsWin()
{
    if(
g_bVIPMode)
    {
        
set_hudmessage(random_num(0255), random_num(0255), random_num(0255), -1.00.2011.04.0)
        
ShowSyncHudMsg(0g_sHudMsg[6], "The VIP has survived!^nCounter-Terrorists, good job!")    
        
        
set_task(3.0"cmdRR")
        
        
g_iScores[CTs]++
    }
}

public 
roundEnd()
{
    if(
g_bVIPMode)
    {
        if(
g_iRounds get_pcvar_num(pCvarMinRounds))
        {
            
g_iRounds++
        }
        else
        {
            
DisableVIPMode()
            
            
set_hudmessage(random_num(0255), random_num(0255), random_num(0255), -1.00.2011.04.0)
            
ShowSyncHudMsg(0g_sHudMsg[3], "%d rounds has passed!^nfinishing the VIP Mode..."get_pcvar_num(pCvarMinRounds))
            
            
console_print(0"[AMXX]: %d rounds has passed. Finishing the VIP Mode..."get_pcvar_num(pCvarMinRounds))
        }
    }
}

public 
deathMsg()
{
    if(
g_bVIPMode)
    {
        new 
iKiller read_data(1)
        new 
iVictim read_data(2)
        
        
remove_task(iVictim+TASK_SHOW_RADAR)
        
        if(
isVip[iVictim])
        {
            
g_iScores[Ts]++
            
            if(!
IsLastCT())
            {
                
g_iRounds++
            }
            
            new 
szKillerName[MAX_PLAYERS], szVipName[MAX_PLAYERS]
            
get_user_name(iKillerszKillerNamecharsmax(szKillerName))
            
get_user_name(iVictimszVipNamecharsmax(szVipName))
            
            
set_hudmessage(random_num(0255), random_num(0255), random_num(0255), -1.00.2011.04.0)
            
ShowSyncHudMsg(0g_sHudMsg[0], "%s has killed the VIP %s^nCounter-Terrorists, you guys sucks!"szKillerNameszVipName)
            
            
client_print(0print_chat"[AMXX]: %s has killed the VIP %s, Counter-Terrorists, you guys sucks!"szKillerNameszVipName)
            
set_task(3.0"cmdRR")
        }
    }
}

public 
CC4_PrimaryAttack(iC4)
{
    if(
g_bVIPMode)
    {
        
client_print(get_pdata_cbase(iC4m_pPlayerXO_WEAPON), print_chat"VIP Mode ON. C4 disabled!")
        
        
set_pdata_float(iC4m_flNextPrimaryAttack1.0XO_WEAPON)
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED


public 
cmdRR()
{
    
server_cmd("sv_restart 1")
}

public 
client_disconnect(id)
{
    if(
g_bVIPMode)
    {
        if(
isVip[id])
        {
            
isVip[id] = false
            
            remove_task
(TASK_HUDMESSAGE)
            
            new 
szVipName[MAX_PLAYERS]
            
get_user_name(idszVipNamecharsmax(szVipName))
            
            
set_hudmessage(random_num(0255), random_num(0255), random_num(0255), -1.00.2011.04.0)
            
ShowSyncHudMsg(0g_sHudMsg[2], "The VIP %s has disconnected^nselecting another VIP..."szVipName)
            
            
client_print(0print_chat"The VIP %s has disconnected. Selecting another VIP..."szVipName)
            
            
set_task(3.0"selectRandomPlayerFromCT")
        }    
    }
}

public 
HamPlayerSpawnPost(id)
{
    if(!
g_bVIPMode
        return 
HAM_IGNORED
    
    
if(!is_user_alive(id))
        return 
HAM_IGNORED
    
    
if(cs_get_user_team(id) == CS_TEAM_T)
    {
        
set_hudmessage(random_num(0255), random_num(0255), random_num(0255), -1.00.2011.04.0)
        
ShowSyncHudMsg(idg_sHudMsg[5], "KILL THE VIP!")
    }
    else
    {
        if(
g_iVipId != id)
        {    
            new 
szVipName[MAX_PLAYERS]
            
get_user_name(g_iVipIdszVipNamecharsmax(szVipName))
            
            
set_hudmessage(random_num(0255), random_num(0255), random_num(0255), -1.00.2011.04.0)
            
ShowSyncHudMsg(idg_sHudMsg[1], "%s is the VIP, protect him!"szVipName)
            
            if(!
task_exists(id+TASK_SHOW_RADAR))
            {
                
set_task(1.0"VIP_RadarScan"id+TASK_SHOW_RADAR, .flags "b")
            }
        }
        else
        {
            
set_hudmessage(random_num(0255), random_num(0255), random_num(0255), -1.00.2011.04.0)
            
ShowSyncHudMsg(idg_sHudMsg[7], "You are the VIP!^nDon't die! Good luck!")
        }
    }
    return 
HAM_IGNORED
}

public 
checkSay(id)
{
    new 
szArgs[9]
    
read_argv(1szArgscharsmax(szArgs))
    
remove_quotes(szArgs)
        
    if(
equal(szArgs"/vipmode"))
    {    
        if(
access(idACCESS_LEVEL))
        {
            switch(
g_bVIPMode)
            {
                case 
true:
                {
                    
DisableVIPMode()
                }
                case 
false:
                {
                    
g_bVIPMode true

                    set_task
(3.0"selectRandomPlayerFromCT")
                }
            }
            
            new 
szAdminName[MAX_PLAYERS]
            
get_user_name(idszAdminNamecharsmax(szAdminName))
            
client_print(0print_chat"[AMXX]: ADMIN %s has %sabled the VIP mod!"szAdminName ,g_bVIPMode "en" "dis")
            return 
PLUGIN_HANDLED
        
}
        else
        {
            
client_print(idprint_chat"[AMXX]: You haven't access to this command!"
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

public 
VIP_RadarScan(playerid)
{
    
playerid -= TASK_SHOW_RADAR
    
    
new VIPCoords[3]
    
    new 
iPlayers[MAX_PLAYERS], iPlayersNumid
    get_players
(iPlayersiPlayersNum"aeh""CT")
    for(new 
i;iPlayersNum;i++)
    {
        
id iPlayers[i]
        
        if(
isVip[id])
        {            
            
get_user_origin(idVIPCoords)
            
            
message_begin(MSG_ONE_UNRELIABLEmsg_HostagePos, {0,0,0}, playerid)
            
write_byte(id)
            
write_byte(i)        
            
write_coord(VIPCoords[0])
            
write_coord(VIPCoords[1])
            
write_coord(VIPCoords[2])
            
message_end()
            
            
message_begin(MSG_ONE_UNRELIABLEmsg_HostageK, {0,0,0}, playerid)
            
write_byte(i)
            
message_end()
        }
    }
}

public 
cmdJoinTeam(id)
{
    if(
g_bVIPMode)
    {
        if(!
is_user_admin(id) || isVip[id])
        {
            
console_print(id"[AMXX]: You cannot until the VIP Mode finishs.")
            return 
PLUGIN_HANDLED
        
}
    }
    return 
PLUGIN_CONTINUE
}

public 
selectRandomPlayerFromCT()
{
    new 
iPlayers[MAX_PLAYERS], iPlayersNum
    get_players
(iPlayersiPlayersNum"eh""CT")
    
    if(!
iPlayersNum)
        return
    
    new 
iRandomPlayer iPlayers[random(iPlayersNum)]
    
    if(
get_user_flags(iRandomPlayer) & ACCESS_LEVEL)
    {
        
isVip[iRandomPlayer] = true
        g_iVipId 
iRandomPlayer
        
        
new szRandomPlayerName[32]
        
get_user_name(iRandomPlayerszRandomPlayerNamecharsmax(szRandomPlayerName))
        
        
set_task(1.0"pHudMessage"TASK_HUDMESSAGE, .flags "b")
        
        
client_print(0print_chat"[AMXX]: Random player selected: %s. Starting the VIP Mod..."szRandomPlayerName)
        
set_task(1.5"cmdRR")
    }
}

public 
pHudMessage()
{
    
set_hudmessage(02550, -1.00.001.01.0)
    
ShowSyncHudMsg(0g_sHudMsg[4], "[ VIP Mode enabled ]^n[ Round: %d | Remaining: %d ]^n[ CTs: %d | Ts: %d ]"g_iRoundsget_pcvar_num(pCvarMinRounds) - g_iRoundsg_iScores[CTs], g_iScores[Ts])
}

IsLastCT()
{
    new 
iPlayers[MAX_PLAYERS], iPlayersNum
    get_players
(iPlayersiPlayersNum"eh""CT")
    
    return (
iPlayersNum == 1) ? true false
}

DisableVIPMode()
{
    
g_iRounds 0
    g_bVIPMode 
false
    g_iVipId 
0
    
    
for(new i;sizeof g_iScores;i++)
    {
        
g_iScores[Teams:i] = 0
    
}
    
    
set_task(2.0"cmdRR")
    
remove_task(TASK_HUDMESSAGE)    
    
    new 
iPlayers[MAX_PLAYERS], iPlayersNumiPlayer
    get_players
(iPlayersiPlayersNum"eh""CT")
    
    for(new 
i;iPlayersNum;i++)
    {
        
iPlayer iPlayers[i]
        
        
remove_task(iPlayer+TASK_SHOW_RADAR)
        
        if(
isVip[iPlayer])
        {
            
isVip[iPlayer] = false
        
}
    }

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-29-2017 at 14:39.
EFFx is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-20-2017 , 19:22   Re: Request > VIP player plugin
Reply With Quote #14

Code updated without errors and more features added.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
wendetta
Member
Join Date: Jul 2012
Old 03-22-2017 , 13:37   Re: Request > VIP player plugin
Reply With Quote #15

Quote:
Originally Posted by EFFx View Post
Code updated without errors and more features added.

I tested the plugin. When I write amx_plugins, plugin is running. But When I use " /vipmode " command, vip mode doesn't start . Nothing has changed. There were 31 players on the server.
What is the problem ?
wendetta is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-22-2017 , 15:10   Re: Request > VIP player plugin
Reply With Quote #16

Any log errors? I tested here and it works.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 03-22-2017 at 15:11.
EFFx is offline
wendetta
Member
Join Date: Jul 2012
Old 03-22-2017 , 15:43   Re: Request > VIP player plugin
Reply With Quote #17

Quote:
Originally Posted by EFFx View Post
Any log errors? I tested here and it works.

Plugin doesn't give an error. I am using AMXX 1.8.3 Dev. Could this be the source of the problem?

when I use " /vipmode " command, VIP players not selected.
wendetta is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-22-2017 , 16:35   Re: Request > VIP player plugin
Reply With Quote #18

Maybe, i'll make for 1.8.3 aswell.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
wendetta
Member
Join Date: Jul 2012
Old 03-22-2017 , 16:44   Re: Request > VIP player plugin
Reply With Quote #19

Quote:
Originally Posted by EFFx View Post
Maybe, i'll make for 1.8.3 aswell.

Thank you It would be great . I expect news from you .
wendetta is offline
wendetta
Member
Join Date: Jul 2012
Old 03-23-2017 , 08:07   Re: Request > VIP player plugin
Reply With Quote #20

Quote:
Originally Posted by EFFx View Post
Any log errors? I tested here and it works.

I tried the dev version 1.8.2. But plugin not working . What should I write to start VIP mode?
wendetta 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 10:16.


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