AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Command not responding (https://forums.alliedmods.net/showthread.php?t=26950)

[D]uMont 04-11-2006 20:21

Command not responding
 
I've gone to Hawk for help and GHW Chronic and they have both helped me a great deal and I can't keep going to them for help, but for some reason I can't get this script to work. Maybe someone else has the answer. Thanks.

Code:
#include <amxmodx> #include <amxmisc> #include <fun> new rope public plugin_init() {     register_plugin("Rope Mod","1.00","[D]uMont")     register_concmd("say /rope","create_rope")     register_event("DeathMsg","event_DeathMsg","a") } public plugin_precache() {     rope = precache_model("sprites/rope.spr")         } public event_DeathMsg(id) {     new idorigin[3], targetorigin[3]     new ent, body     get_user_origin(id,idorigin)     get_user_aiming(id,ent,body,9999)         message_begin(MSG_BROADCAST,SVC_TEMPENTITY)     write_coord(idorigin[0])     write_coord(idorigin[1])     write_coord(idorigin[2])     write_coord(targetorigin[0])     write_coord(targetorigin[1])     write_coord(targetorigin[2])     write_short(rope)     write_byte(1)       // framestart     write_byte(1)       // framerate     write_byte(0)       // life in 0.1's     write_byte(5)       // width     write_byte(0)       // noise     write_byte(255)     // red     write_byte(0)       // green     write_byte(0)       // blue     write_byte(200)     // brightness     write_byte(0)       // speed     message_end() }

* Note this is my first script. :D *

Hawk552 04-11-2006 20:32

I already told you, you never actually got ent's origin. Also you never checked if ent is valid.

Twilight Suzuka 04-11-2006 20:45

Also, that is the worst rope mod ever.

Code:
#include <amxmodx> #include <engine> #define HOLD_T 8.0 #define ROPE_DELAY 0.5 #define TE_BEAMENTPOINT 1 #define TE_KILLBEAM 99 #define DELTA_T 0.1     // seconds #define BEAMLIFE 1      // deciseconds #define MOVEACCELERATION 150    // units per second^2 #define REELSPEED 200       // units per second new beam new hook_id[33] public plugin_init() {     register_plugin("NinjaRope", "1.17","Twilight Suzuka")     register_clcmd("+ninjarope","attach_hook")     register_clcmd("-ninjarope","detach_hook")     register_cvar("ninjarope_on","1")     register_cvar("ninjarope_r","255")     register_cvar("ninjarope_g","255")     register_cvar("ninjarope_b","255")     register_cvar("ninjarope_width","10")     register_think("ninja_hook","hook_think") } public plugin_precache() {     beam = precache_model("sprites/zbeam4.spr")     precache_sound("weapons/xbow_hit2.wav") } public client_putinserver(id) {     hook_id[id] = 0; } stock can_use_hook(id) {     if(!get_cvar_num("ninjarope_on") || !is_user_alive(id) ) return 0;     return 1; } public attach_hook(id) {     if(!can_use_hook(id) ) return client_print(id,print_chat,"[NINJA] You cannot use the rope at this time!")     new s_origin[3]     get_user_origin(id,s_origin,3)     new Float:f_origin[3]     IVecFVec(s_origin,f_origin)     create_hook(id,f_origin )     return PLUGIN_HANDLED; } public detach_hook(id) {     delete_hook(id)     return PLUGIN_HANDLED; } public create_hook(id,Float:origin[3]) {     new hook = create_entity("info_target")     if(!hook) return;     entity_set_string(hook,EV_SZ_classname,"ninja_hook")     entity_set_origin(hook,origin)     hook_id[id] = hook;     entity_set_int(hook,EV_INT_iuser1,id)     entity_set_float(hook,EV_FL_fuser2,entity_range(id,hook) )     entity_set_float(hook,EV_FL_nextthink,get_gametime() + 0.0001 )     emit_sound(id, CHAN_STATIC, "weapons/xbow_hit2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) } public delete_hook(id) {     remove_entity(hook_id[id])     hook_id[id] = 0;     kill_hook(id) } public hook_think(id) {     new user = entity_get_int(id,EV_INT_iuser1)     if(!can_use_hook(user) ) detach_hook(user)     make_hook( user )     hook_effect(user,id)     entity_set_float(id,EV_FL_nextthink,get_gametime() + 0.01 ) } public make_hook(id) {     new Float:vec[3]     get_hook_vec(id,vec)     message_begin( MSG_BROADCAST, SVC_TEMPENTITY )     write_byte( TE_BEAMENTPOINT )     write_short( id )     write_coord( floatround(vec[0]) )     write_coord( floatround(vec[1]) )     write_coord( floatround(vec[2]) )     write_short( beam ) // sprite index     write_byte( 0 )     // start frame     write_byte( 0 )     // framerate     write_byte( BEAMLIFE )  // life     write_byte( get_cvar_num("ninjarope_width") )   // width     write_byte( 2 )     // noise     write_byte( get_cvar_num("ninjarope_r") )   // r, g, b     write_byte( get_cvar_num("ninjarope_g") )       // r, g, b     write_byte( get_cvar_num("ninjarope_b") )       // r, g, b     write_byte( 150 )       // brightness     write_byte( 0 )     // speed     message_end( ) } public kill_hook(id) {     message_begin( MSG_BROADCAST, SVC_TEMPENTITY )     write_byte( TE_KILLBEAM )     write_short( id )     message_end() } stock get_hook_vec(id,Float:vec[3]) {     new h_id = hook_id[id];     entity_get_vector(h_id, EV_VEC_origin,vec) } public hook_effect(id,hook) {     new user_origin[3], user_look[3], user_direction[3], move_direction[3]     new Float:hook_length = entity_get_float(hook,EV_FL_fuser2)     new Float:hook_origin[3], hook_origin_i[3]     entity_get_vector(hook,EV_VEC_origin,hook_origin)     FVecIVec(hook_origin,hook_origin_i)     new A[3], D[3], buttonadjust[3]     new acceleration, velocity_TA, desired_velocity_TA     new velocity[3], null[3]     new Float:tmpVector[3]     null[0] = 0     null[1] = 0     null[2] = 0     get_user_origin(id, user_origin)     get_user_origin(id, user_look,2)         entity_get_vector(id, EV_VEC_velocity, tmpVector)     FVecIVec(tmpVector, velocity)     buttonadjust[0] = 0     buttonadjust[1]  =0     new buttons = get_user_button(id)     if (buttons & IN_FORWARD)     {         buttonadjust[0]+=1     }     if (buttons & IN_BACK)     {         buttonadjust[0]-=1     }     if (buttons & IN_MOVERIGHT)     {         buttonadjust[1]+=1     }     if (buttons & IN_MOVELEFT)     {         buttonadjust[1]-=1     }     if (buttons & IN_JUMP)     {         buttonadjust[2] += 1     }     if (buttons & IN_DUCK)     {         buttonadjust[2] -= 1     }     if (buttonadjust[0] || buttonadjust[1])     {         user_direction[0] = user_look[0] - user_origin[0]         user_direction[1] = user_look[1] - user_origin[1]         move_direction[0] = buttonadjust[0] * user_direction[0] + user_direction[1]*buttonadjust[1]         move_direction[1] = buttonadjust[0] * user_direction[1] - user_direction[0]*buttonadjust[1]         move_direction[2] = 0         velocity[0] += floatround(move_direction[0] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))         velocity[1] += floatround(move_direction[1] * MOVEACCELERATION * DELTA_T / get_distance(null,move_direction))     }     if (buttonadjust[2])     {         hook_length -= buttonadjust[2] * REELSPEED * DELTA_T     }     if (hook_length < 100.0)     {         (hook_length) = 100.0     }     A[0] = floatround(hook_origin[0]) - user_origin[0]     A[1] = floatround(hook_origin[1]) - user_origin[1]     A[2] = floatround(hook_origin[2]) - user_origin[2]     D[0] = A[0]*A[2] / get_distance(null,A)     D[1] = A[1]*A[2] / get_distance(null,A)     D[2] = -(A[1]*A[1] + A[0]*A[0]) / get_distance(null,A)     new aDistance = get_distance(null,D) ? get_distance(null,D) : 1     acceleration = - 800 * D[2] / aDistance     velocity_TA = (velocity[0] * A[0] + velocity[1] * A[1] + velocity[2] * A[2]) / get_distance(null,A)     desired_velocity_TA = (get_distance(user_origin,hook_origin_i) - floatround(hook_length) /*- 10*/) * 4     if (get_distance(null,D)>10)     {         velocity[0] += floatround((acceleration * DELTA_T * D[0]) / get_distance(null,D))         velocity[1] += floatround((acceleration * DELTA_T * D[1]) / get_distance(null,D))         velocity[2] += floatround((acceleration * DELTA_T * D[2]) / get_distance(null,D))     }     velocity[0] += ((desired_velocity_TA - velocity_TA) * A[0]) / get_distance(null,A)     velocity[1] += ((desired_velocity_TA - velocity_TA) * A[1]) / get_distance(null,A)     velocity[2] += ((desired_velocity_TA - velocity_TA) * A[2]) / get_distance(null,A)     IVecFVec(velocity, tmpVector)     entity_set_vector(id, EV_VEC_velocity, tmpVector)     entity_set_float(hook,EV_FL_fuser2,hook_length) }

Now THATS a rope mod.

Five minutes of work and hacking ftw?

[D]uMont 04-11-2006 21:07

Twilight, I think you have mistaken my idea. My code relates to Manikstor's post about a TSRP rope for the cops. http://forums.alliedmods.net/showthread.php?t=26429+mod

Sorry Hawk signed off and forgot what you said in convo. Thanks!

Twilight Suzuka 04-11-2006 21:32

Yeah. Cause cops have rope. Thats how it works.
:nono: :nono: :nono: :nono: :nono: :nono: :nono: :nono:

[D]uMont 04-11-2006 22:12

Yes, very true. But do cops also have a jailmenu to teleport a player to jail? No, but that was invented wasn't it... :D

Twilight Suzuka 04-11-2006 22:16

Yeah, I see cops doing that all the time now. Yep. Even for jay walking. People are just, bam, suddenly in jail. Happens everyday.

[D]uMont 04-11-2006 22:58

Anyone ever tell you, you'd make a great lawyer? Just hope that none of your cases involve the Police. :D


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

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