Raised This Month: $ Target: $400
 0% 

Hook Problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mAr7obg
Senior Member
Join Date: May 2007
Location: Bulgaria
Old 03-25-2009 , 06:35   Hook Problem
Reply With Quote #1

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()
}
mAr7obg is offline
Send a message via Skype™ to mAr7obg
 



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 08:52.


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