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

Simple Hook


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-02-2009 , 16:55   Simple Hook
Reply With Quote #1

Hello i need a simple hook with the max & min. usage. howmany time player can use this.
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.

Last edited by TitANious; 05-02-2009 at 16:59.
TitANious is offline
Send a message via MSN to TitANious
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-02-2009 , 17:00   Re: Simple Hook
Reply With Quote #2

Edit: Posted before you edited, hope it helps.

I found this somewhere, I think the traceline tut.

PHP Code:
new beampoint;

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

public 
draw_laser(Float:start[3], Float:end[3], staytime)
{                    
    
message_begin(MSG_ALLSVC_TEMPENTITY)
    
write_byte(TE_BEAMPOINTS)
    
engfunc(EngFunc_WriteCoordstart[0])
    
engfunc(EngFunc_WriteCoordstart[1])
    
engfunc(EngFunc_WriteCoordstart[2])
    
engfunc(EngFunc_WriteCoordend[0])
    
engfunc(EngFunc_WriteCoordend[1])
    
engfunc(EngFunc_WriteCoordend[2])
    
write_short(beampoint)
    
write_byte(0)
    
write_byte(0)
    
write_byte(staytime// In tenths of a second.
    
write_byte(10)
    
write_byte(1)
    
write_byte(255// Red
    
write_byte(0// Green
    
write_byte(0// Blue
    
write_byte(127)
    
write_byte(1)
    
message_end()

__________________
Bugsy is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 05-02-2009 , 17:03   Re: Simple Hook
Reply With Quote #3

Easyier than i thought, well i just looked in bigger hooks, were they use alot more. And can any1 help with max, min part?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-02-2009 , 17:07   Re: Simple Hook
Reply With Quote #4

hmmm..

PHP Code:
new usage

set_task
(float(get_pcvar_num(usage)), "usage")
usege register_cvar("amx_usage_hook","10");


draw_laser(Float:start[3], Float:end[3], staytime)
set_task(float(get_pcvar_num(usage)), "usage"
anything like this?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-02-2009 , 17:11   Re: Simple Hook
Reply With Quote #5

One, that makes no sense at all.
__________________
Bugsy is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-02-2009 , 17:13   Re: Simple Hook
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
One, that makes no sense at all.
hmm.. i have realy no idea. so i give up
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-02-2009 , 17:14   Re: Simple Hook
Reply With Quote #7

Quote:
Originally Posted by One View Post
hmm.. i have realy no idea. so i give up
If you don't know how to do something, why do you try to show someone else how to do it? I'm not trying to be mean or anything.
__________________
Bugsy is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 05-02-2009 , 17:17   Re: Simple Hook
Reply With Quote #8

i just thinked this can work.read ma post

Quote:
anything like this?
;) befor he posts, he asked me for this. i said ask better in forum!so i wasnt sure if i can do this shit. i had just the idea with task & i asked for ma code!!read again ma post :

Quote:
anything like this?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-02-2009 , 17:20   Re: Simple Hook
Reply With Quote #9

This makes no sense to me. Do you care to explain what you are attempting to do?
PHP Code:
//Defining a global variable
new usage

//seting a task with for 10 seconds to call "usage" function that does not exist
set_task(float(get_pcvar_num(usage)), "usage")
//register cvar to hold 10
usage register_cvar("amx_usage_hook","10");

//drawing a laser for staytime seconds
draw_laser(Float:start[3], Float:end[3], staytime)

//seting a task with again for 10 seconds to call "usage" function that does not exist
set_task(float(get_pcvar_num(usage)), "usage"
TitANious, when you say hook are you referring to a plugin that creates a hook to swing from?
__________________
Bugsy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-02-2009 , 18:40   Re: Simple Hook
Reply With Quote #10

PHP Code:
/*    Copyright © 2009, ConnorMcLeod

    Kz Hook is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Kz Hook; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <engine>

#define PLUGIN "Kz Hook"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

#define HOOK_SPEED    900

#define MAX_PLAYERS    32
#define RANDOM_BYTE    random_num(0, 0xFF)

native kz_reset_timer(index)

enum {x,y,z}
enum {HOOK_OFFHOOK_RELEASEHOOK_ON}

new 
m_spriteTexture

new g_iHook[MAX_PLAYERS+1]
new 
g_iHookOrigin[MAX_PLAYERS+1][3]
new 
Float:g_fHookVelocity[MAX_PLAYERS+1][3]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_clcmd("+hook""ClientCommand_HookOn")
    
register_clcmd("-hook""ClientCommand_HookOff")

    new 
iEnt
    
if( (iEnt create_entity("info_target")) )
    {
        
entity_set_string(iEntEV_SZ_classname"hook_think")
        
register_think("hook_think""Hook_Think")
        
entity_set_float(iEntEV_FL_nextthinkget_gametime() + 0.2)
    }
}

public 
plugin_precache()
{
    
m_spriteTexture precache_model("sprites/zbeam4.spr")
}

public 
plugin_natives()
{
    
register_native("kz_has_user_hook""has_user_hook")
}

public 
has_user_hook(iPluginiParams)
{
    return !!
g_iHookget_param(1) ]
}

public 
client_putinserver(id)
{
    
g_iHook[id] = HOOK_OFF
}

public 
ClientCommand_HookOn(id)
{
    
g_iHook[id] = HOOK_ON

    get_user_origin
(idg_iHookOrigin[id], 3)
    
velocity_by_aim(idmin(HOOK_SPEED2000), g_fHookVelocity[id])

    
client_cmd(id"speak ^"weapons/(v10xbow_hit1^"")

    
kz_reset_timer(id)

    return 
PLUGIN_HANDLED
}

public 
ClientCommand_HookOff(id)
{
    
g_iHook[id] = HOOK_RELEASE
    
return PLUGIN_HANDLED
}

public 
Hook_ThinkiEnt )
{
    static 
iPlayers[MAX_PLAYERS], iNumiidiHook

    entity_set_float
(iEntEV_FL_nextthinkget_gametime() + 0.2)

    
get_players(iPlayersiNum)

    for(
i=0i<iNumi++)
    {
        
id iPlayers[i]
        
iHook g_iHook[id]
        if( 
iHook == HOOK_ON )
        {
            
message_begin(MSG_ONE_UNRELIABLESVC_TEMPENTITY_id)
            
write_byte(TE_BEAMENTPOINT)
            
write_short(id
            
write_coord(g_iHookOrigin[id][x])
            
write_coord(g_iHookOrigin[id][y])
            
write_coord(g_iHookOrigin[id][z])
            
write_short(m_spriteTexture
            
write_byte(0
            
write_byte(1
            
write_byte(2// life
            
write_byte(10
            
write_byte(10
            
write_byte(RANDOM_BYTE)
            
write_byte(RANDOM_BYTE)
            
write_byte(RANDOM_BYTE)
            
write_byte(RANDOM_BYTE)
            
write_byte(1)
            
message_end()

            
entity_set_vector(idEV_VEC_velocityg_fHookVelocity[id])
        }
        else if( 
iHook == HOOK_RELEASE )
        {
            
entity_get_vector(idEV_VEC_velocityg_fHookVelocity[id])
            if(    
g_fHookVelocity[id][x] < 100.0
            
&&    g_fHookVelocity[id][y] < 100.0
            
&&    g_fHookVelocity[id][z] < 100.0    )
            {
                
g_iHook[id] = HOOK_OFF
            
}
        }
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 01:00.


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