AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   prokreedz_hook ignore players (https://forums.alliedmods.net/showthread.php?t=82775)

card 12-29-2008 17:17

prokreedz_hook ignore players
 
how can i make prokreedz_hook to ignore players that i`m aiming ? to touch wall / sky / ground behind player etc, except him ?
here is the plugin,
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

#define KZ_LEVEL ADMIN_LEVEL_C

new bool:canusehook[33]
new 
bool:ishooked[33]
new 
hookorigin[33][3]

new 
Sbeamg_iMaxPlayers

public plugin_init() {
    
register_plugin("Hook","1.0","p4ddY")
    
    
register_clcmd("+hook","hook_on")
    
register_clcmd("-hook","hook_off")
    
    
register_concmd("kz_hook","give_hook",KZ_LEVEL,"<name|#userid|steamid|@ALL> <on/off>")

    
g_iMaxPlayers get_maxplayers()
}

public 
plugin_precache() {
    
Sbeam precache_model("sprites/laserbeam.spr")
}

// =================================================================================================

public client_disconnect(id) {
    
remove_hook(id)
}

public 
client_putinserver(id) {
    
remove_hook(id)
}

// =================================================================================================

public 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 
i=1;i<=g_iMaxPlayers;i++) {
            if(
is_user_alive(i)) {
                
canusehook[i] = mode
            
}
        }
    }
    else {
        new 
pid cmd_target(id,szarg1,2)
        if(
pid 0) {
            
canusehook[pid] = mode
        
}
    }
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public hook_on(id,level,cid) {
    if(!
canusehook[id])
        return 
PLUGIN_HANDLED
    
    get_user_origin
(id,hookorigin[id],3)
    
    if(
callfunc_begin("detect_cheat","prokreedz.amxx") == 1) {
        
callfunc_push_int(id)
        
callfunc_push_str("Hook")
        
callfunc_end()
    }
    
    
ishooked[id] = true
    
    set_task
(0.1,"hook_task",id,_,_,"b")
    
hook_task(id)
    
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public hook_off(id)
{
    
remove_hook(id)
    return 
PLUGIN_HANDLED
}

// =================================================================================================

public hook_task(id) {
    if(!
is_user_alive(id))
        
remove_hook(id)
    
    
remove_beam(id)
    
draw_hook(id)
    
    new 
origin[3], Float:velocity[3]
    
get_user_origin(id,origin
    new 
distance get_distance(hookorigin[id],origin)
    if(
distance 25)  { 
        
velocity[0] = (hookorigin[id][0] - origin[0]) * (2.0 300 distance)
        
velocity[1] = (hookorigin[id][1] - origin[1]) * (2.0 300 distance)
        
velocity[2] = (hookorigin[id][2] - origin[2]) * (2.0 300 distance)
        
        
set_pev(id,pev_velocity,velocity)
    } 
    else {
        
set_pev(id,pev_velocity,Float:{0.0,0.0,0.0})
        
remove_hook(id)
    }
}

// =================================================================================================

public draw_hook(id)
{
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_BEAMENTPOINT
    
write_short(id)                // entid
    
write_coord(hookorigin[id][0])    // origin
    
write_coord(hookorigin[id][1])    // origin
    
write_coord(hookorigin[id][2])    // origin
    
write_short(Sbeam)            // sprite index
    
write_byte(0)                // start frame
    
write_byte(0)                // framerate
    
write_byte(100)                // life
    
write_byte(10)                // width
    
write_byte(5)                // noise
    
write_byte(127)            // r
    
write_byte(255)            // g
    
write_byte(0)            // b
    
write_byte(150)                // brightness
    
write_byte(3)                // speed
    
message_end()
}

public 
remove_hook(id) {
    
remove_task(id)
    
remove_beam(id)
    
ishooked[id] = false
}

public 
remove_beam(id) {
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(99// TE_KILLBEAM
    
write_short(id)
    
message_end()


i have one more problem, my spectators are a kind of solid players because when someone is spectating me, i am stucking in air ...


All times are GMT -4. The time now is 09:16.

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