AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Knife Question (https://forums.alliedmods.net/showthread.php?t=61081)

X-Script 09-20-2007 07:20

Knife Question
 
How would you force someone to use the KNIFE ONLY without stripping there weapons?

Alka 09-20-2007 07:49

Re: Knife Question
 
1.
Code:

engclient_cmd(id, "weapon_knife");
you must use this in Prethink or CurWeapon. ;)

X-Script 09-20-2007 07:50

Re: Knife Question
 
Does it matter if I use it in one rather than the other?

Alka 09-20-2007 07:52

Re: Knife Question
 
Don't think so...all you must to do is to check if weapon != CSW_KNIFE and do that cmd! :)

X-Script 09-20-2007 07:54

Re: Knife Question
 
Okay thanks Alka. :)

Zenith77 09-20-2007 12:21

Re: Knife Question
 
It'd be better in CurWeapon.

Wilson [29th ID] 09-20-2007 14:03

Re: Knife Question
 
Alka, that has to be the most inefficient way to do that...Executing a command like that every prethink?

Execute the command once, then alter the pev_weapons bitmask to be ONLY the knife, which would be something like set_pev(id,pev_weapons,CSW_KNIFE);

To safeguard from some workarounds (I think lastinv might be one of them), also hook CurWeapon and test which weapon it is being changed to - if it's not the knife, execute weapon_knife again.

Alka 09-20-2007 14:11

Re: Knife Question
 
Whoa lol, i've sayd about CurWeapon too, and how Zenith77 say's the efficient way is CurWeapon, check if weapon read_data(2) != CSW_KNIFE! :/

ConnorMcLeod 09-20-2007 17:08

Re: Knife Question
 
Because you said CurWeapon OR client prethink.

You can register the event with "2!29" so the event will be called only if player weapon is not a knife.

X-Script 09-20-2007 17:09

Re: Knife Question
 
I'm using prethink, although if that method isn't "good" i'll use curweapon.


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

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