Raised This Month: $95 Target: $400
 23% 

Hook only fot Humans (CT) on zombie plague


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RBE sLayeR
Junior Member
Join Date: Jul 2019
Location: Zombie Planet
Old 07-28-2019 , 09:25   Hook only fot Humans (CT) on zombie plague
Reply With Quote #1

Hello guys !
Can someone help me with this hook , i want this hook to work only on humans on zombie plague mod and not on zombies , and if possible to add a cvar for max hooks per round ..
P.S i searched a lot for this but i didnt found anything
Attached Files
File Type: sma Get Plugin or Get Source (hook.sma - 79 views - 7.1 KB)

Last edited by RBE sLayeR; 07-28-2019 at 09:26.
RBE sLayeR is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 07-30-2019 , 05:01   Re: Hook only fot Humans (CT) on zombie plague
Reply With Quote #2

I just add check to prevent zombies from using hook.
Cvar will add when finish playing Dota.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <zombieplague>

#define PLUGIN "ProKreedz Hook"
#define VERSION "v2.3"
#define AUTHOR "vato loco [GE-S] & p4ddY"

#define KZ_ACCESS  ADMIN_KICK
#define RANDOM_NUM random_num(0,255)
#define RED        255
#define GREEN      99
#define    BLUE       71

enum color {normal 1greenteam}
enum {HOOK_OFFHOOK_RELEASEHOOK_ON}

new 
is_plr_connected[33]
new 
bool:g_bCanUseHook[33]
new 
g_bIsHooked[33]
new 
g_iHookOrigin[33][3]
new 
g_bPlayerIsAdmin[33]
new 
g_SpriteBeam
new g_SpriteLaser
new g_SayText
new g_iMaxPlayers
new g_kz_tag

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_forward(FM_Think"fw_ThinkEnt")
    
register_clcmd("+hook""HookOn"KZ_ACCESS)
    
register_clcmd("-hook""HookOff"KZ_ACCESS)
    
register_clcmd("kz_hook""cmd_give_hook"KZ_ACCESS ,"<name|#userid|steamid|@ALL> <on/off>")
    
    
register_dictionary("prokreedz_v2.3.txt")
    
g_kz_tag register_cvar("kz_tag""[ProKreedz]")
    
    new 
iEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString "info_target"))
    
set_pev(iEntpev_classname"hook_think")
    
set_pev(iEntpev_nextthinkget_gametime() + 0.1)
    
    
g_SayText get_user_msgid("SayText")
    
g_iMaxPlayers get_maxplayers()
}

public 
plugin_precache() 
{
        
precache_sound("weapons/ric2.wav")
        
g_SpriteBeam engfunc(EngFunc_PrecacheModel"sprites/zbeam1.spr")
    
g_SpriteLaser engfunc(EngFunc_PrecacheModel,"sprites/zbeam1.spr")
}

public 
client_putinserver(id
{
    
is_plr_connected[id] = true
    g_bIsHooked
[id] = HOOK_OFF
    
if(get_user_flags(id) & KZ_ACCESS
        
g_bPlayerIsAdmin[id] = true
}

public 
client_disconnect(id
{
    
is_plr_connected[id] = false
    g_bIsHooked
[id] = HOOK_OFF
    
if(g_bPlayerIsAdmin[id]) 
        
g_bPlayerIsAdmin[id] = false
}

public 
kz_prize_hook(idstatus[])
{
    switch(
status[0])
    {
        case 
'0'g_bCanUseHook[id] = false
            
        
case '1'
        {
            
g_bCanUseHook[id] = true
            kz_colorchat
(idgreen"%L"id"PKU_PRIZE_HOOK")
        }
    }
}

public 
cmd_give_hook(id,level,cid
{
    if(!
cmd_access(id,level,cid,3))
        return 
PLUGIN_HANDLED
    
    
new name[32]
    
get_user_name(id,name,31)
    
    new 
szarg1[32], szarg2[8], bool:mode
    read_argv
(1,szarg1,31)
    
read_argv(2,szarg2,7)
    if(
equal(szarg2,"on"))
        
mode true
    
    
if(equal(szarg1,"@ALL")) 
    {
        for(new 
1<= g_iMaxPlayersi++) 
        {
            if(
is_plr_connected[i] && is_user_alive(i)) 
            {
                
g_bCanUseHook[i] = mode
                
if(mode
                    
kz_colorchat(igreen"%L"i"PKU_HOOK_AT_ALL"name)
                else 
                    
kz_colorchat(igreen"%L"i"PKU_HOOK_TAKE_ALL"name)
            }
        }
    }
    else 
    {
        new 
pid cmd_target(id,szarg1,2)
        if(
pid 0
        {
            
g_bCanUseHook[pid] = mode
            
if(mode
                
kz_colorchat(pidgreen"%L"pid"PKU_HOOK_AT_TARGET"name)
            else 
                
kz_colorchat(pidgreen"%L"pid"PKU_HOOK_TAKE_TARGET"name)
        }
    }
    return 
PLUGIN_HANDLED
}

public 
HookOn(id)  
{
    if(!
g_bCanUseHook[id] && !g_bPlayerIsAdmin[id])
        return 
PLUGIN_HANDLED

        
if(zp_get_user_zombie(id))
        return 
PLUGIN_HANDLED
    
    
if(is_plr_connected[id] && is_user_alive(id))
    {
        
get_user_origin(idg_iHookOrigin[id], 3)
        
        if(
callfunc_begin("DetectCheat","ProKreedz_v2.3.amxx") == 1
        {
            
callfunc_push_int(id)
            
callfunc_push_str("Hook")
            
callfunc_end()
        }
        
g_bIsHooked[id] = HOOK_ON
                emit_sound
(idCHAN_STATIC"weapons/ric2.wav"1.0ATTN_NORM0PITCH_NORM)
    }
    return 
PLUGIN_HANDLED
}

public 
HookOff(id
{
    
g_bIsHooked[id] = HOOK_RELEASE
    
return PLUGIN_HANDLED
}

public 
fw_ThinkEnt(iEnt)
{
    if (
pev_valid(iEnt)) 
    { 
        static 
ClassName[33]
        
pev(iEntpev_classnameClassName32)
        
        if(
equal(ClassName"hook_think"))
        {
            
fw_HookThink()
            
set_pev(iEntpev_nextthinkget_gametime() + 0.1)
        }
    }
}

public 
fw_HookThink()
{
    static 
idorigin[3], Float:velocity[3], distance
    
for(id id <= g_iMaxPlayers id++) 
    {
        if(
g_bIsHooked[id] == HOOK_ON)
        {
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
            
write_byte(1)              // TE_BEAMENTPOINT
            
write_short(id)              // entid
            
write_coord(g_iHookOrigin[id][0]) // origin
            
write_coord(g_iHookOrigin[id][1]) // origin
            
write_coord(g_iHookOrigin[id][2]) // origin
            
if(g_bPlayerIsAdmin[id])
            {
                
write_short(g_SpriteBeam)      // sprite index
                
write_byte(0)              // start frame
                
write_byte(0)              // framerate
                
write_byte(2)              // life
                
write_byte(30)              // width
                
write_byte(0)
                
write_byte(RANDOM_NUM// r
                
write_byte(RANDOM_NUM// g
                
write_byte(RANDOM_NUM// b
            
}
            else 
            {
                
write_short(g_SpriteLaser)      // sprite index
                
write_byte(0)              // start frame
                
write_byte(0)              // framerate
                
write_byte(2)              // life
                
write_byte(30)              // width
                
write_byte(0)
                
write_byte(RED)           // r
                
write_byte(GREEN)      // g
                
write_byte(BLUE)       // b
            
}
            
write_byte(500)                   // brightness
            
write_byte(0)                   // speed
            
message_end()
            
            
get_user_origin(idorigin)
            
distance get_distance(g_iHookOrigin[id], origin)
            if(
distance 25)  
            { 
                
velocity[0] = (g_iHookOrigin[id][0] - origin[0]) * (2.0 350 distance)
                
velocity[1] = (g_iHookOrigin[id][1] - origin[1]) * (2.0 350 distance)
                
velocity[2] = (g_iHookOrigin[id][2] - origin[2]) * (2.0 350 distance)
                
set_pev(idpev_velocityvelocity)
            }
        }
        else if(
g_bIsHooked[id] == HOOK_RELEASE)
        {
            
g_bIsHooked[id] = HOOK_OFF
        
}
    }
}

kz_colorchat(idcolor:type, const msg[], {Float,Sql,Result,_}:...) {
    
    static 
message[256], pkmsg[180], changed[8], argscount,j
    argscount 
numargs()
    
    switch(
type
    {
        case 
normalmessage[0] = 0x01
            
        
case greenmessage[0] = 0x04
            
        
default: message[0] = 0x03
        
    
}
    new 
pktag[32]
    
get_pcvar_string(g_kz_tagpktag31)
    
    if(
id)
    {
        if(
is_plr_connected[id])
        {
            
vformat(pkmsg179msg4)
            
formatex(message[1], 255"%s %s"pktagpkmsg)
            
message[192] = '^0'
            
            
replace_all(message191"!g""^x04")
            
replace_all(message191"!n""^x01")
            
replace_all(message191"!t""^x03")
            
kz_print_msg(idmessage)
        }
    } 
    else 
    {
        for(new 
1<= g_iMaxPlayersi++)
        {
            if(
is_plr_connected[i])
            {
                new 
changedcount 0
                
                
for(2argscountj++)
                {
                    if(
getarg(j) == LANG_PLAYER)
                    {
                        
setarg(j0i);
                        
changed[changedcount++] = j;
                    }
                }
                
vformat(pkmsg179msg4)
                
formatex(message[1], 255"%s %s"pktagpkmsg)
                
message[192] = '^0'
                
                
replace_all(message191"!g""^x04")
                
replace_all(message191"!n""^x01")
                
replace_all(message191"!t""^x03")
                
kz_print_msg(imessage)
                
                for(
0changedcountj++)
                {
                    
setarg(changed[j], 0LANG_PLAYER)
                }
            }
        }
    }
}

stock kz_print_msg(id, const msg[])
{
    
message_begin(MSG_ONE_UNRELIABLEg_SayText_id)
    
write_byte(id)        
    
write_string(msg)
    
message_end()
}







/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1031\\ f0\\ fs16 \n\\ par }
*/ 
__________________
Check my new Zombie Mod (2019)
Look at the video below to see gameplay

https://www.youtube.com/watch?v=U4mf9obA6x0
Krtola is offline
Send a message via Skype™ to Krtola
Old 07-31-2019, 09:10
RBE sLayeR
This message has been deleted by RBE sLayeR.
RBE sLayeR
Junior Member
Join Date: Jul 2019
Location: Zombie Planet
Old 07-31-2019 , 09:11   Re: Hook only fot Humans (CT) on zombie plague
Reply With Quote #3

Thanks , didnt finish Dota yet ? xD
RBE sLayeR is offline
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 07-31-2019 , 17:55   Re: Hook only fot Humans (CT) on zombie plague
Reply With Quote #4

Quote:
Originally Posted by RBE sLayeR View Post
Thanks , didnt finish Dota yet ? xD
I'm sorry, it's a 5 minute job.
But I'll be able to do it when I'm home.
I work overtime last few weeks.
__________________
Check my new Zombie Mod (2019)
Look at the video below to see gameplay

https://www.youtube.com/watch?v=U4mf9obA6x0
Krtola is offline
Send a message via Skype™ to Krtola
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 08-01-2019 , 08:34   Re: Hook only fot Humans (CT) on zombie plague
Reply With Quote #5

Sorry for delay.
Test this.
PHP Code:
hook_limit 
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <fakemeta> 
#include <zombieplague> 

#define PLUGIN "ProKreedz Hook" 
#define VERSION "v2.3" 
#define AUTHOR "vato loco [GE-S] & p4ddY" 

#define KZ_ACCESS  ADMIN_KICK 
#define RANDOM_NUM random_num(0,255) 
#define RED        255 
#define GREEN      99 
#define    BLUE       71 

enum color {normal 1greenteam
enum {HOOK_OFFHOOK_RELEASEHOOK_ON

new 
is_plr_connected[33
new 
bool:g_bCanUseHook[33
new 
g_bIsHooked[33
new 
g_iHookOrigin[33][3
new 
g_bPlayerIsAdmin[33
new 
g_SpriteBeam 
new g_SpriteLaser 
new g_SayText 
new g_iMaxPlayers 
new g_kz_tag 

new amxx_limitamxx_hook_count[33], g_maxplayers

public plugin_init()  

    
register_plugin(PLUGINVERSIONAUTHOR
     
    
register_forward(FM_Think"fw_ThinkEnt"
    
register_clcmd("+hook""HookOn"KZ_ACCESS
    
register_clcmd("-hook""HookOff"KZ_ACCESS
    
register_clcmd("kz_hook""cmd_give_hook"KZ_ACCESS ,"<name|#userid|steamid|@ALL> <on/off>"
     
    
register_dictionary("prokreedz_v2.3.txt"
    
g_kz_tag register_cvar("kz_tag""[ProKreedz]"
     
    new 
iEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString "info_target")) 
    
set_pev(iEntpev_classname"hook_think"
    
set_pev(iEntpev_nextthinkget_gametime() + 0.1
     
    
g_SayText get_user_msgid("SayText"
    
g_iMaxPlayers get_maxplayers() 

    
register_logevent("logevent_round_start"2"1=Round_Start")
    
g_maxplayers get_maxplayers()
    
amxx_limit register_cvar("hook_limit","20")


public 
plugin_precache()  

    
precache_sound("weapons/ric2.wav"
    
g_SpriteBeam engfunc(EngFunc_PrecacheModel"sprites/zbeam1.spr"
    
g_SpriteLaser engfunc(EngFunc_PrecacheModel,"sprites/zbeam1.spr"


public 
client_putinserver(id)  

    
is_plr_connected[id] = true 
    g_bIsHooked
[id] = HOOK_OFF 
    
if(get_user_flags(id) & KZ_ACCESS)  
        
g_bPlayerIsAdmin[id] = true 


public 
client_disconnect(id)  

    
is_plr_connected[id] = false 
    g_bIsHooked
[id] = HOOK_OFF 
    
if(g_bPlayerIsAdmin[id])  
        
g_bPlayerIsAdmin[id] = false 


public 
logevent_round_start() 

    static 
id 
    
for(id 1id <= g_maxplayersid++) 
    { 
        if(
is_user_connected(id)) 
        {    
            
amxx_hook_count[id] = 0
        
}
    }
}

public 
kz_prize_hook(idstatus[]) 

    switch(
status[0]) 
    { 
        case 
'0'g_bCanUseHook[id] = false 
             
        
case '1':  
        { 
            
g_bCanUseHook[id] = true 
            kz_colorchat
(idgreen"%L"id"PKU_PRIZE_HOOK"
        } 
    } 


public 
cmd_give_hook(id,level,cid)  

    if(!
cmd_access(id,level,cid,3)) 
        return 
PLUGIN_HANDLED 
     
    
new name[32
    
get_user_name(id,name,31
     
    new 
szarg1[32], szarg2[8], bool:mode 
    read_argv
(1,szarg1,31
    
read_argv(2,szarg2,7
    if(
equal(szarg2,"on")) 
        
mode true 
     
    
if(equal(szarg1,"@ALL"))  
    { 
        for(new 
1<= g_iMaxPlayersi++)  
        { 
            if(
is_plr_connected[i] && is_user_alive(i))  
            { 
                
g_bCanUseHook[i] = mode 
                
if(mode)  
                    
kz_colorchat(igreen"%L"i"PKU_HOOK_AT_ALL"name
                else  
                    
kz_colorchat(igreen"%L"i"PKU_HOOK_TAKE_ALL"name
            } 
        } 
    } 
    else  
    { 
        new 
pid cmd_target(id,szarg1,2
        if(
pid 0)  
        { 
            
g_bCanUseHook[pid] = mode 
            
if(mode)  
                
kz_colorchat(pidgreen"%L"pid"PKU_HOOK_AT_TARGET"name
            else  
                
kz_colorchat(pidgreen"%L"pid"PKU_HOOK_TAKE_TARGET"name
        } 
    } 
    return 
PLUGIN_HANDLED 


public 
HookOn(id)   

    if(!
g_bCanUseHook[id] && !g_bPlayerIsAdmin[id]) 
        return 
PLUGIN_HANDLED 

    
if(zp_get_user_zombie(id)) 
        return 
PLUGIN_HANDLED 

    
if(amxx_hook_count[id] > get_pcvar_num(amxx_limit))
        return 
PLUGIN_HANDLED
    
     
    
if(is_plr_connected[id] && is_user_alive(id)) 
    { 
        
get_user_origin(idg_iHookOrigin[id], 3
         
        if(
callfunc_begin("DetectCheat","ProKreedz_v2.3.amxx") == 1)  
        { 
            
callfunc_push_int(id
            
callfunc_push_str("Hook"
            
callfunc_end() 
        } 
        
g_bIsHooked[id] = HOOK_ON 
                emit_sound
(idCHAN_STATIC"weapons/ric2.wav"1.0ATTN_NORM0PITCH_NORM
                
amxx_hook_count[id]++
    } 
    return 
PLUGIN_HANDLED 


public 
HookOff(id)  

    
g_bIsHooked[id] = HOOK_RELEASE 
    
return PLUGIN_HANDLED 


public 
fw_ThinkEnt(iEnt

    if (
pev_valid(iEnt))  
    {  
        static 
ClassName[33
        
pev(iEntpev_classnameClassName32
         
        if(
equal(ClassName"hook_think")) 
        { 
            
fw_HookThink() 
            
set_pev(iEntpev_nextthinkget_gametime() + 0.1
        } 
    } 


public 
fw_HookThink() 

    static 
idorigin[3], Float:velocity[3], distance 
    
for(id id <= g_iMaxPlayers id++)  
    { 
        if(
g_bIsHooked[id] == HOOK_ON
        { 
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY
            
write_byte(1)              // TE_BEAMENTPOINT 
            
write_short(id)              // entid 
            
write_coord(g_iHookOrigin[id][0]) // origin 
            
write_coord(g_iHookOrigin[id][1]) // origin 
            
write_coord(g_iHookOrigin[id][2]) // origin 
            
if(g_bPlayerIsAdmin[id]) 
            { 
                
write_short(g_SpriteBeam)      // sprite index 
                
write_byte(0)              // start frame 
                
write_byte(0)              // framerate 
                
write_byte(2)              // life 
                
write_byte(30)              // width 
                
write_byte(0
                
write_byte(RANDOM_NUM// r 
                
write_byte(RANDOM_NUM// g 
                
write_byte(RANDOM_NUM// b 
            

            else  
            { 
                
write_short(g_SpriteLaser)      // sprite index 
                
write_byte(0)              // start frame 
                
write_byte(0)              // framerate 
                
write_byte(2)              // life 
                
write_byte(30)              // width 
                
write_byte(0
                
write_byte(RED)           // r 
                
write_byte(GREEN)      // g 
                
write_byte(BLUE)       // b 
            

            
write_byte(500)                   // brightness 
            
write_byte(0)                   // speed 
            
message_end() 
             
            
get_user_origin(idorigin
            
distance get_distance(g_iHookOrigin[id], origin
            if(
distance 25)   
            {  
                
velocity[0] = (g_iHookOrigin[id][0] - origin[0]) * (2.0 350 distance
                
velocity[1] = (g_iHookOrigin[id][1] - origin[1]) * (2.0 350 distance
                
velocity[2] = (g_iHookOrigin[id][2] - origin[2]) * (2.0 350 distance
                
set_pev(idpev_velocityvelocity
            } 
        } 
        else if(
g_bIsHooked[id] == HOOK_RELEASE
        { 
            
g_bIsHooked[id] = HOOK_OFF 
        

    } 


kz_colorchat(idcolor:type, const msg[], {Float,Sql,Result,_}:...) { 
     
    static 
message[256], pkmsg[180], changed[8], argscount,
    argscount 
numargs() 
     
    switch(
type)  
    { 
        case 
normalmessage[0] = 0x01 
             
        
case greenmessage[0] = 0x04 
             
        
default: message[0] = 0x03 
         
    

    new 
pktag[32
    
get_pcvar_string(g_kz_tagpktag31
     
    if(
id
    { 
        if(
is_plr_connected[id]) 
        { 
            
vformat(pkmsg179msg4
            
formatex(message[1], 255"%s %s"pktagpkmsg
            
message[192] = '^0' 
             
            
replace_all(message191"!g""^x04"
            
replace_all(message191"!n""^x01"
            
replace_all(message191"!t""^x03"
            
kz_print_msg(idmessage
        } 
    }  
    else  
    { 
        for(new 
1<= g_iMaxPlayersi++) 
        { 
            if(
is_plr_connected[i]) 
            { 
                new 
changedcount 
                 
                
for(2argscountj++) 
                { 
                    if(
getarg(j) == LANG_PLAYER
                    { 
                        
setarg(j0i); 
                        
changed[changedcount++] = j
                    } 
                } 
                
vformat(pkmsg179msg4
                
formatex(message[1], 255"%s %s"pktagpkmsg
                
message[192] = '^0' 
                 
                
replace_all(message191"!g""^x04"
                
replace_all(message191"!n""^x01"
                
replace_all(message191"!t""^x03"
                
kz_print_msg(imessage
                 
                for(
0changedcountj++) 
                { 
                    
setarg(changed[j], 0LANG_PLAYER
                } 
            } 
        } 
    } 


stock kz_print_msg(id, const msg[]) 

    
message_begin(MSG_ONE_UNRELIABLEg_SayText_id
    
write_byte(id)         
    
write_string(msg
    
message_end() 








/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE 
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1031\\ f0\\ fs16 \n\\ par } 
*/ 
__________________
Check my new Zombie Mod (2019)
Look at the video below to see gameplay

https://www.youtube.com/watch?v=U4mf9obA6x0
Krtola is offline
Send a message via Skype™ to Krtola
RBE sLayeR
Junior Member
Join Date: Jul 2019
Location: Zombie Planet
Old 08-01-2019 , 12:47   Re: Hook only fot Humans (CT) on zombie plague
Reply With Quote #6

Thanks
RBE sLayeR is offline
RBE sLayeR
Junior Member
Join Date: Jul 2019
Location: Zombie Planet
Old 08-25-2019 , 13:58   Re: Hook only for Humans (CT) on zombie plague
Reply With Quote #7

Quote:
Originally Posted by Krtola View Post
Test this.
Sorry to disturb you again but is there any way to have another cvar which sets limit of hook for an admin flag
For example
hook_limit_f
hook_limit_b
__________________
DISCORD : sLayeR#4823
RBE sLayeR is offline
DON KHAN 1
Senior Member
Join Date: Mar 2019
Location: Pakistan
Old 08-25-2019 , 15:23   Re: Hook only fot Humans (CT) on zombie plague
Reply With Quote #8

Try Now:

PHP Code:
#include <amxmodx>  
#include <amxmisc>  
#include <fakemeta>  
#include <zombieplague>  

#define PLUGIN "ProKreedz Hook"  
#define VERSION "v2.3"  
#define AUTHOR "vato loco [GE-S] & p4ddY"  

#define KZ_ACCESS  ADMIN_KICK  
#define RANDOM_NUM random_num(0,255)  
#define RED        255  
#define GREEN      99  
#define    BLUE       71


enum color {normal 1greenteam}  
enum {HOOK_OFFHOOK_RELEASEHOOK_ON}  

new 
is_plr_connected[33]  
new 
bool:g_bCanUseHook[33]  
new 
g_bIsHooked[33]  
new 
g_iHookOrigin[33][3]  
new 
g_bPlayerIsAdmin[33]  
new 
g_SpriteBeam  
new g_SpriteLaser  
new g_SayText  
new g_iMaxPlayers  
new g_kz_tag  

new amxx_limitamxx_limit_adminamxx_hook_count[33], g_maxplayers 

public plugin_init()   
{  
    
register_plugin(PLUGINVERSIONAUTHOR)  
      
    
register_forward(FM_Think"fw_ThinkEnt")  
    
register_clcmd("+hook""HookOn"KZ_ACCESS)  
    
register_clcmd("-hook""HookOff"KZ_ACCESS)  
    
register_clcmd("kz_hook""cmd_give_hook"KZ_ACCESS ,"<name|#userid|steamid|@ALL> <on/off>")  
      
    
register_dictionary("prokreedz_v2.3.txt")  
    
g_kz_tag register_cvar("kz_tag""[ProKreedz]")  
      
    new 
iEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString "info_target"))  
    
set_pev(iEntpev_classname"hook_think")  
    
set_pev(iEntpev_nextthinkget_gametime() + 0.1)  
      
    
g_SayText get_user_msgid("SayText")  
    
g_iMaxPlayers get_maxplayers()  

    
register_logevent("logevent_round_start"2"1=Round_Start"
    
g_maxplayers get_maxplayers() 
    
amxx_limit register_cvar("hook_limit","20")
    
amxx_limit_admin register_cvar("hook_limit_admin","30")
}  

public 
plugin_precache()   
{  
    
precache_sound("weapons/ric2.wav")  
    
g_SpriteBeam engfunc(EngFunc_PrecacheModel"sprites/zbeam1.spr")  
    
g_SpriteLaser engfunc(EngFunc_PrecacheModel,"sprites/zbeam1.spr")  
}  

public 
client_putinserver(id)   
{  
    
is_plr_connected[id] = true  
    g_bIsHooked
[id] = HOOK_OFF  
    
if(get_user_flags(id) & KZ_ACCESS)   
        
g_bPlayerIsAdmin[id] = true  
}  

public 
client_disconnect(id)   
{  
    
is_plr_connected[id] = false  
    g_bIsHooked
[id] = HOOK_OFF  
    
if(g_bPlayerIsAdmin[id])   
        
g_bPlayerIsAdmin[id] = false  
}  

public 
logevent_round_start()  
{  
    static 
id  
    
for(id 1id <= g_maxplayersid++)  
    {  
        if(
is_user_connected(id))  
        {     
            
amxx_hook_count[id] = 
        

    } 


public 
kz_prize_hook(idstatus[])  
{  
    switch(
status[0])  
    {  
        case 
'0'g_bCanUseHook[id] = false  
              
        
case '1':   
        {  
            
g_bCanUseHook[id] = true  
            kz_colorchat
(idgreen"%L"id"PKU_PRIZE_HOOK")  
        }  
    }  
}  

public 
cmd_give_hook(id,level,cid)   
{  
    if(!
cmd_access(id,level,cid,3))  
        return 
PLUGIN_HANDLED  
      
    
new name[32]  
    
get_user_name(id,name,31)  
      
    new 
szarg1[32], szarg2[8], bool:mode  
    read_argv
(1,szarg1,31)  
    
read_argv(2,szarg2,7)  
    if(
equal(szarg2,"on"))  
        
mode true  
      
    
if(equal(szarg1,"@ALL"))   
    {  
        for(new 
1<= g_iMaxPlayersi++)   
        {  
            if(
is_plr_connected[i] && is_user_alive(i))   
            {  
                
g_bCanUseHook[i] = mode  
                
if(mode)   
                    
kz_colorchat(igreen"%L"i"PKU_HOOK_AT_ALL"name)  
                else   
                    
kz_colorchat(igreen"%L"i"PKU_HOOK_TAKE_ALL"name)  
            }  
        }  
    }  
    else   
    {  
        new 
pid cmd_target(id,szarg1,2)  
        if(
pid 0)   
        {  
            
g_bCanUseHook[pid] = mode  
            
if(mode)   
                
kz_colorchat(pidgreen"%L"pid"PKU_HOOK_AT_TARGET"name)  
            else   
                
kz_colorchat(pidgreen"%L"pid"PKU_HOOK_TAKE_TARGET"name)  
        }  
    }  
    return 
PLUGIN_HANDLED  
}  

public 
HookOn(id)    
{  
    if(!
g_bCanUseHook[id] && !g_bPlayerIsAdmin[id])  
        return 
PLUGIN_HANDLED  

    
if(zp_get_user_zombie(id))  
        return 
PLUGIN_HANDLED  

    
if(amxx_hook_count[id] > get_pcvar_num(amxx_limit)) 
        return 
PLUGIN_HANDLED 
    
    
if(get_user_flags(id) & ADMIN_LEVEL_H)
    if(
amxx_hook_count[id] > get_pcvar_num(amxx_limit_admin))
        return 
PLUGIN_HANDLED
     
      
    
if(is_plr_connected[id] && is_user_alive(id))  
    {  
        
get_user_origin(idg_iHookOrigin[id], 3)  
          
        if(
callfunc_begin("DetectCheat","ProKreedz_v2.3.amxx") == 1)   
        {  
            
callfunc_push_int(id)  
            
callfunc_push_str("Hook")  
            
callfunc_end()  
        }  
        
g_bIsHooked[id] = HOOK_ON  
        emit_sound
(idCHAN_STATIC"weapons/ric2.wav"1.0ATTN_NORM0PITCH_NORM)  
        
amxx_hook_count[id]++ 
    }  
    return 
PLUGIN_HANDLED  
}  

public 
HookOff(id)   
{  
    
g_bIsHooked[id] = HOOK_RELEASE  
    
return PLUGIN_HANDLED  
}  

public 
fw_ThinkEnt(iEnt)  
{  
    if (
pev_valid(iEnt))   
    {   
        static 
ClassName[33]  
        
pev(iEntpev_classnameClassName32)  
          
        if(
equal(ClassName"hook_think"))  
        {  
            
fw_HookThink()  
            
set_pev(iEntpev_nextthinkget_gametime() + 0.1)  
        }  
    }  
}  

public 
fw_HookThink()  
{  
    static 
idorigin[3], Float:velocity[3], distance  
    
for(id id <= g_iMaxPlayers id++)   
    {  
        if(
g_bIsHooked[id] == HOOK_ON)  
        {  
            
message_begin(MSG_BROADCASTSVC_TEMPENTITY)  
            
write_byte(1)              // TE_BEAMENTPOINT  
            
write_short(id)              // entid  
            
write_coord(g_iHookOrigin[id][0]) // origin  
            
write_coord(g_iHookOrigin[id][1]) // origin  
            
write_coord(g_iHookOrigin[id][2]) // origin  
            
if(g_bPlayerIsAdmin[id])  
            {  
                
write_short(g_SpriteBeam)      // sprite index  
                
write_byte(0)              // start frame  
                
write_byte(0)              // framerate  
                
write_byte(2)              // life  
                
write_byte(30)              // width  
                
write_byte(0)  
                
write_byte(RANDOM_NUM// r  
                
write_byte(RANDOM_NUM// g  
                
write_byte(RANDOM_NUM// b  
            
}  
            else   
            {  
                
write_short(g_SpriteLaser)      // sprite index  
                
write_byte(0)              // start frame  
                
write_byte(0)              // framerate  
                
write_byte(2)              // life  
                
write_byte(30)              // width  
                
write_byte(0)  
                
write_byte(RED)           // r  
                
write_byte(GREEN)      // g  
                
write_byte(BLUE)       // b  
            
}  
            
write_byte(500)                   // brightness  
            
write_byte(0)                   // speed  
            
message_end()  
              
            
get_user_origin(idorigin)  
            
distance get_distance(g_iHookOrigin[id], origin)  
            if(
distance 25)    
            {   
                
velocity[0] = (g_iHookOrigin[id][0] - origin[0]) * (2.0 350 distance)  
                
velocity[1] = (g_iHookOrigin[id][1] - origin[1]) * (2.0 350 distance)  
                
velocity[2] = (g_iHookOrigin[id][2] - origin[2]) * (2.0 350 distance)  
                
set_pev(idpev_velocityvelocity)  
            }  
        }  
        else if(
g_bIsHooked[id] == HOOK_RELEASE)  
        {  
            
g_bIsHooked[id] = HOOK_OFF  
        
}  
    }  
}  

kz_colorchat(idcolor:type, const msg[], {Float,Sql,Result,_}:...) {  
      
    static 
message[256], pkmsg[180], changed[8], argscount,j  
    argscount 
numargs()  
      
    switch(
type)   
    {  
        case 
normalmessage[0] = 0x01  
              
        
case greenmessage[0] = 0x04  
              
        
default: message[0] = 0x03  
          
    
}  
    new 
pktag[32]  
    
get_pcvar_string(g_kz_tagpktag31)  
      
    if(
id)  
    {  
        if(
is_plr_connected[id])  
        {  
            
vformat(pkmsg179msg4)  
            
formatex(message[1], 255"%s %s"pktagpkmsg)  
            
message[192] = '^0'  
              
            
replace_all(message191"!g""^x04")  
            
replace_all(message191"!n""^x01")  
            
replace_all(message191"!t""^x03")  
            
kz_print_msg(idmessage)  
        }  
    }   
    else   
    {  
        for(new 
1<= g_iMaxPlayersi++)  
        {  
            if(
is_plr_connected[i])  
            {  
                new 
changedcount 0  
                  
                
for(2argscountj++)  
                {  
                    if(
getarg(j) == LANG_PLAYER)  
                    {  
                        
setarg(j0i);  
                        
changed[changedcount++] = j;  
                    }  
                }  
                
vformat(pkmsg179msg4)  
                
formatex(message[1], 255"%s %s"pktagpkmsg)  
                
message[192] = '^0'  
                  
                
replace_all(message191"!g""^x04")  
                
replace_all(message191"!n""^x01")  
                
replace_all(message191"!t""^x03")  
                
kz_print_msg(imessage)  
                  
                for(
0changedcountj++)  
                {  
                    
setarg(changed[j], 0LANG_PLAYER)  
                }  
            }  
        }  
    }  
}  

stock kz_print_msg(id, const msg[])  
{  
    
message_begin(MSG_ONE_UNRELIABLEg_SayText_id)  
    
write_byte(id)          
    
write_string(msg)  
    
message_end()  
}  







/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE  
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1031\\ f0\\ fs16 \n\\ par }  
*/ 
__________________
Hosting Servers: Angel Of Games

Facebook
My YouTube
Join My Forum
Ro{Y}aL WarLanD CommuniTy
Angel Of Games - Forum
Currently Working On: ADVANCED VIP + API : 70%
DON KHAN 1 is offline
RBE sLayeR
Junior Member
Join Date: Jul 2019
Location: Zombie Planet
Old 08-27-2019 , 07:20   Re: Hook only fot Humans (CT) on zombie plague
Reply With Quote #9

Quote:
Originally Posted by DON KHAN 1 View Post
Try Now:
Nope didn't work
__________________
DISCORD : sLayeR#4823
RBE sLayeR is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 08-27-2019 , 14:36   Re: Hook only fot Humans (CT) on zombie plague
Reply With Quote #10

You need to clarify some things first, this hook currently only works on admins. Do you want it to work on all players with a specific max hooks and have a different max for admins with flags f and b? Or do you want it to only work on admins with flags f and b with different max hooks?
Moody92 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 11:22.


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