Raised This Month: $ Target: $400
 0% 

Editing weapon help please


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
stupok
Veteran Member
Join Date: Feb 2006
Old 06-27-2007 , 01:21   Re: Editing weapon help please
Reply With Quote #9

I took a look at GabenMod, here's something useful:

from gm_soldier.sma by Basic-Master

Code:
public hook_prethink(id) {     if (g_IsEnabled && gHasClass[id] && is_user_alive(id) && gCurWeapon[id] == CSW_FLASHBANG) {         pt_button = pev(id, pev_button)         if (pt_button&IN_ATTACK)             set_pev(id, pev_button, pt_button&~IN_ATTACK)         if (pev(id, pev_oldbuttons)&IN_ATTACK) {             set_animation(id, 0)             set_pev(id, pev_oldbuttons, pev(id, pev_oldbuttons)&~IN_ATTACK)         }         if (!gActionAllowed[id] || !gm_IsValidPlayer(id))             return FMRES_HANDLED                 if (pt_button&IN_ATTACK) {             pt_delay = ROCKET_DELAY             if (cs_get_user_bpammo(id, CSW_FLASHBANG) != 0) {                 if (gReloadStatus[id] == 0) {                     set_pev(id, pev_punchangle, Float:{ -5.0, 0.0, 0.0 })                     set_animation(id, 3)                     cs_set_user_bpammo(id, CSW_FLASHBANG, cs_get_user_bpammo(id, CSW_FLASHBANG)-1)                     emit_sound(id, CHAN_WEAPON, "weapons/rocketfire1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM)                     /* The rocket */                     new rocket = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))                     set_pev(rocket, pev_classname, "gm_rocket")                     if (!gSkills[id][5])                         engfunc(EngFunc_SetModel, rocket, "models/rpgrocket.mdl")                     else {                         engfunc(EngFunc_SetModel, rocket, "models/chick.mdl")                         set_pev(rocket, pev_framerate, 25.0)                         set_pev(rocket, pev_frame, 0.0)                     }                     dllfunc(DLLFunc_Spawn, rocket)                     new Float:fVec[3]                     pev(id, pev_origin, fVec)                     fVec[2] = floatadd(fVec[2], 15.0)                     set_pev(rocket, pev_owner, id)                     engfunc(EngFunc_SetOrigin, rocket, fVec)                     pev(id, pev_v_angle, fVec)                     set_pev(rocket, pev_angles, fVec)                     engfunc(EngFunc_SetSize, rocket, ROCKET_MINS, ROCKET_MAXS)                     set_pev(rocket, pev_mins, ROCKET_MINS)                     set_pev(rocket, pev_maxs, ROCKET_MAXS)                     set_pev(rocket, pev_absmin, ROCKET_MINS)                     set_pev(rocket, pev_absmax, ROCKET_MAXS)                     set_pev(rocket, pev_solid, SOLID_BBOX)                     set_pev(rocket, pev_movetype, MOVETYPE_FLYMISSILE)                     set_pev(rocket, pev_health, 9999.0)                     set_pev(rocket, pev_takedamage, 2.0)                     set_task(0.1, "task_checkrocket", rocket+300)                     gm_VelocityByAim(id, 2000+get_ent_speed(id), fVec)                     set_pev(rocket, pev_velocity, fVec)                     emit_sound(rocket, CHAN_VOICE, "weapons/rocket1.wav", VOL_NORM, ATTN_NORM, 0, PITCH_HIGH)                     g_IsRocket[rocket] = 1                     /* Some fx */                     message_begin(MSG_BROADCAST, SVC_TEMPENTITY)                     write_byte(22)                     write_short(rocket)                     write_short(gSteam)                     write_byte(10)                     write_byte(4)                     write_byte(200)                     write_byte(50)                     write_byte(50)                     write_byte(255)                     message_end()                     /* Player values */                     if (cs_get_user_bpammo(id, CSW_FLASHBANG) != 0 && !gSkills[id][2]) {                         gReloadStatus[id] = 1                         set_task(ROCKET_DELAY, "task_reload", id+200)                         pt_delay = floatadd(ROCKET_DELAY, RELOAD_DELAY)                         set_task(pt_delay, "task_reloadend", id+100)                     }                 }             }             else {                 if (is_user_bot(id)) // they rather commit suicide before they run out of ammo but who cares ^^                     client_cmd(id, "slot1")                 else                     emit_sound(id, CHAN_WEAPON, "weapons/357_cock1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)             }             gActionAllowed[id] = 0             set_task(pt_delay, "task_reset", id)             return FMRES_SUPERCEDE         }     }     return FMRES_IGNORED }
stupok is offline
 



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 21:27.


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