Raised This Month: $ Target: $400
 0% 

Editing weapon help please


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mogel
Senior Member
Join Date: Jan 2007
Old 06-26-2007 , 14:50   Re: Editing weapon help please
Reply With Quote #1

Hi,

i have the same problem ... current i use a very bad workaround for the problem ... but i need a better solution

http://forums.alliedmods.net/showthread.php?p=424755

i think with this plugin is it posible to block the shoot, following by a fakedamage for the player ... please let me know if the idea work, thanks

hand, mogel
__________________
mogel is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 06-26-2007 , 16:34   Re: Editing weapon help please
Reply With Quote #2

Post the code you're using to block the animation and sound.

I think if you use:

Code:
set_cd(cd_handle, CD_ID, 0)
then you might be able to see when a client is pressing the attack key. I'm not sure.
stupok is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-26-2007 , 18:45   Re: Editing weapon help please
Reply With Quote #3

Yeah that's what I'm using and I couldn't seem to figure it out. Here is the code...

PHP Code:
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_forward(FM_UpdateClientData"UpdateClientData_Post"1);
}

public 
client_PreThink(id)
{
    if(!
is_user_alive(id))
    {
        return 
PLUGIN_CONTINUE;
    }
    
    
// Remove the attack button from their button mask
    
entity_set_int(idEV_INT_buttonentity_get_int(idEV_INT_button) & ~IN_ATTACK);
    
    if(
pev(idpev_button) & IN_ATTACK)
    {
        
// Added this to check if it would spam test when I held attack down
        
client_print(0print_chat"test");
    }
    
    return 
PLUGIN_CONTINUE;
}

public 
UpdateClientData_Post(idsendweaponscd_handle)
{
    if(!
is_user_alive(id))
    {
        return 
FMRES_IGNORED;
    }
    
    
set_cd(cd_handleCD_ID0);
    
    return 
FMRES_HANDLED;

hlstriker is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 06-26-2007 , 20:13   Re: Editing weapon help please
Reply With Quote #4

What if you remove the line with entity_set_int? I don't think you need to remove the button AND change CD_ID with set_cd().
stupok is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-26-2007 , 20:42   Re: Editing weapon help please
Reply With Quote #5

Once again you fixed my problem stupok69

Thanks
hlstriker is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-26-2007 , 22:39   Re: Editing weapon help please
Reply With Quote #6

Quote:
Originally Posted by hlstriker View Post
Once again you fixed my problem stupok69

Thanks
EDIT:
Well sort of. I just noticed the gun will fire, but doesn't play the sound or animations (that's why I didn't catch it at first).

Is there a way to block the damage and ammo drain somehow?

EDIT:
GAH!!! I clicked quote instead of edit, my bad.
hlstriker is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 06-27-2007 , 01:21   Re: Editing weapon help please
Reply With Quote #7

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


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