Raised This Month: $ Target: $400
 0% 

Help with capturing a new weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 04-17-2005 , 16:45   Help with capturing a new weapon
Reply With Quote #1

Ok...so here is the situation. I want to create a new weapon, its not really a weapon, but that irrelivent. Ok, so its smoke grenades. Now what I have been trying to do is the following:

I have a smoke grenade dor dod, I have already created it, so this is NOT the problem. What I want to do is the following:

1) Capture slot6 which is linked to a smake grenade icon, same as the grenades for slot5

2) When slot6 is hit, it switches to the model arms that is holding a smoke grenade, I'm working on these models now.

3) When they fire with this smoke grenade it shoots it off.

Cheers!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-17-2005 , 19:58  
Reply With Quote #2

This is only theory, I have no idea if it will work:

Code:
#define NADE_FLOOD 1.7 // change to anim time of grenade throw new smokeNades[33]; // smoke grenade amount new usingSmokeNade[33]; // if a smoke grenade is out new canThrowNade[33];  // if a user can throw a smoke grenade public plugin_init() {    register_clcmd("slot6","cmd_slot6");    register_event("CurWeapon","event_curweapon","b"); } public event_curweapon(id) {    canThrowNade[id] = 1;    remove_task(id,0);    usingSmokeNade[id] = 0; } public cmd_slot6(id) {    if(smokeNades[id] > 0) {       usingSmokeNade[id] = 1;       entity_set_string(id,EV_SZ_viewmodel,"models/v_smokenade.mdl");       entity_set_string(id,EV_SZ_weaponmodel,"models/w_smokenade.mdl");    } } public client_PreThink(id) {    if(!is_user_alive(id) || usingSmokeNade[id] == 0) {       return PLUGIN_CONTINUE;    }    new button = get_user_button(id);    if(button & IN_ATTACK) {       entity_set_int(id,EV_INT_button,button & ~IN_ATTACK);       if(canThrowNade[id] > 0) {          canThrowNade[id] = 0;          smokeNades[id]--;          set_task(NADE_FLOOD,"throw_nade",id);       }    }    if(button & IN_ATTACK2) {       entity_set_int(id,EV_INT_button,button & ~IN_ATTACK2);    } } public throw_nade(id) {    // make grenade here    canThrowNade[id] = 1;    if(smokeNades[id] == 0) {       // switch back to some other weapon somehow    } }

There's a base. Good luck.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 04-18-2005 , 07:28  
Reply With Quote #3

@XxAvalanchexX

Thanks, I have the code already done for smoke grenades. And I tried to catch the slot6. But I think I may have tried client command already. It may be a console command instead. I will give this a try tonight if I'm able. What I was thinking/hoping was to use:

register_event("CurWeapon","cur_weapon","be", "1=1", "2=44")

Where I make a weapon thats linked to 44, I think DoD has like 40 weapons and 4 extra slots. But I need to figure that part out. What you can do at the moment is just throw the grenade, and throw or shoot at the same time. Not a good way to go about it. So the second thing I tried was to catch the grenade events as above, then if they hit it the second time it throws that event again and I switch to the smoke...but it didn't look like it worked. I could be wrong about it as the models I was using may have been the same as the ones for grenades.

So all in all, I will check what you put down out.

Cheers!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
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 09:49.


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