AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hook Problem (https://forums.alliedmods.net/showthread.php?t=88463)

mAr7obg 03-25-2009 06:35

Hook Problem
 
Hello Hook have this plugin but not working properly.
The problem there is that when someone finish off a map in the Hook not working :(
Example: "Example Test"
When no name raztoyanie all his works
Example: "asdasd"

Here code
Code:

#include <amxmodx>
#include <amxmisc>
#include <engine>
#define KZ_LEVEL ADMIN_KICK
new bool:canusehook[32]
new bool:ishooked[32]
new hookorigin[32][3]
new Sbeam
public plugin_init() {
 register_plugin("ProKreedzHook","1.0","p4ddY")
 register_clcmd("+hook","hook_on",KZ_LEVEL)
 register_clcmd("-hook","hook_off",KZ_LEVEL)
 register_srvcmd("kz_hook","give_hook_cmd")
}
public plugin_precache() {
 precache_sound("weapons/xbow_hit2.wav")
 Sbeam = precache_model("sprites/laserbeam.spr")
}
public client_disconnect(id) {
 remove_hook(id)
}
public client_putinserver(id) {
 remove_hook(id)
}
public give_hook_cmd(id,level,cid) {
 
 new szarg1[33], szarg2[8], bool:mode
 read_argv(1,szarg1,32)
 read_argv(2,szarg2,7)
 remove_quotes(szarg1)
 remove_quotes(szarg2)
 if(equal(szarg2,"on"))
  mode = true
 
 new pid = cmd_target(id,szarg1,0)
 if(pid) {
  if(canusehook[pid-1] == mode)
  return PLUGIN_CONTINUE
  canusehook[pid-1] = mode
  if(mode) {
  client_print(id,print_chat,"")
  }
  else
  client_print(id,print_chat,"")
 }
 return PLUGIN_CONTINUE
}
public hook_on(id,level,cid) {
 if(!canusehook[id-1] && !cmd_access(id,level,cid,1))
  return PLUGIN_HANDLED
 get_user_origin(id,hookorigin[id-1],3)
 ishooked[id-1] = true
 emit_sound(id,CHAN_STATIC,"weapons/xbow_hit2.wav",1.0,ATTN_NORM,0,PITCH_NORM)
 set_task(0.1,"hook_task",id,"",0,"ab")
 hook_task(id)
 return PLUGIN_HANDLED
}
public is_hooked(id) {
 return ishooked[id-1]
}
public hook_off(id) {
 remove_hook(id)
 return PLUGIN_HANDLED
}
public hook_task(id) {
 if(!is_user_connected(id) || !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-1],origin)
 if(distance > 25)  {
  velocity[0] = (hookorigin[id-1][0] - origin[0]) * (2.0 * 300 / distance)
  velocity[1] = (hookorigin[id-1][1] - origin[1]) * (2.0 * 300 / distance)
  velocity[2] = (hookorigin[id-1][2] - origin[2]) * (2.0 * 300 / distance)
  entity_set_vector(id,EV_VEC_velocity,velocity)
 }
 else {
  entity_set_vector(id,EV_VEC_velocity,Float:{0.0,0.0,0.0})
  remove_hook(id)
 }
}
public draw_hook(id) {
 message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 write_byte(1)
 write_short(id)
 write_coord(hookorigin[id-1][0])
 write_coord(hookorigin[id-1][1])
 write_coord(hookorigin[id-1][2])
 write_short(Sbeam)
 write_byte(0)
 write_byte(0)
 write_byte(100)
 write_byte(10)
 write_byte(0)
 if(get_user_team(id) == 1) {
  write_byte(255)
  write_byte(0)
  write_byte(0)
 }
 else {
  write_byte(0)
  write_byte(0)
  write_byte(255)
 }
 write_byte(150)
 write_byte(0)
 message_end()
}
public remove_hook(id) {
 if(task_exists(id))
 remove_task(id)
 remove_beam(id)
 ishooked[id-1] = false
}
public remove_beam(id) {
 message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 write_byte(99)
 write_short(id)
 message_end()
}


vato loco [GE-S] 03-25-2009 07:06

Re: Hook Problem
 
did you downloaded here ???

ProKreedz 1.0
http://forums.alliedmods.net/showthr...dz+arg2&page=4

for me it's working without problems !!!

i'm using ProKreedz v2.2 with the same hook code and it work fine !!!

mAr7obg 03-25-2009 17:13

Re: Hook Problem
 
i will test now
EDIT : the same error :(
I use Kz jump plugin v0.08b a when have something like this name "asdasd asdasd" can't give him hook :(
I using prize system

vato loco [GE-S] 03-25-2009 17:24

Re: Hook Problem
 
yes you are using Kz jump plugin v0.08b

but this hook is for ProKreedz
Code:

register_plugin("ProKreedzHook","1.0","p4ddY")

tolsty 03-26-2009 19:21

Re: Hook Problem
 
post your sma`s, u could just add a srvcmd in prokreedzhook, and in jumpplugin, where is the timer stoping part add the hook srv_cmd

BOYSplayCS 03-26-2009 19:37

Re: Hook Problem
 
tolsty, if you would take the time to read, you could clearly see the code has been posted above. If you want the .sma file, copy the code above open AMXx Studio and save it.

tolsty 03-27-2009 06:32

Re: Hook Problem
 
he`s using kz_jumplugin, not prokreedz, i just told him what to do if you want add it to jumpplugin.


All times are GMT -4. The time now is 08:52.

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