AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Weapon strings in register_event? (https://forums.alliedmods.net/showthread.php?t=25204)

organizedKaoS 03-09-2006 20:20

Weapon strings in register_event?
 
Is it possible to use
Code:
register_event("CurWeapon", "publicfunction", "be")

And then have the event only execute when the curweapon is not 1. knife 2. hegrenade 3. c4 by inputting it into the event like this
Code:
register_event("CurWeapon", "publicfunction", "be", "not sure what goes here if possible")
When the publicfunction gets called whats in the function will be executed if it is not one of the three weapon possibilities while having the weapon defined in the registered event. Is this possible? Ive tried using read_data in the public function but sometimes it wont allow the c4 or henade, only the knife. Thanks for any help.

VEN 03-10-2006 13:46

Answer on your main question: no.
While you still can filter weapon IDs with read_data and if/case inside function-handler.

organizedKaoS 03-10-2006 15:50

Thanks wanted to make sure.

Kraugh 03-10-2006 20:09

couldn't you use the extra arguments for register_event? where x is the argument number for the new weapon id:

Code:
register_event("CurWeapon", "publicfunction", "be", "x!CSW_KNIFE", "x!CSW_HEGRENADE", "x!CSW_C4")

and before people start yelling at me for putting variables inside a string like that, CSW_* are constants, so every occurance is replaced by the preprocessor before the compile actually starts.

organizedKaoS 03-10-2006 21:56

Quote:

Originally Posted by Kraugh
couldn't you use the extra arguments for register_event? where x is the argument number for the new weapon id:

Code:
register_event("CurWeapon", "publicfunction", "be", "x!CSW_KNIFE", "x!CSW_HEGRENADE", "x!CSW_C4")

and before people start yelling at me for putting variables inside a string like that, CSW_* are constants, so every occurance is replaced by the preprocessor before the compile actually starts.

Could this actually work? Im not sure thats why I asked :lol: :lol:

organizedKaoS 03-10-2006 23:28

So can anyone confirm or deny if weapon constants can be defined in the register_event so it does not have to be filtered in the public function? :?: :?: :?:

Kraugh 03-11-2006 02:01

after a brief study of CurWeapon, the following should work.

Code:
register_event("CurWeapon", "publicfunction", "b", "1=1", "2!0", "2!CSW_KNIFE", "2!CSW_HEGRENADE", "2!CSW_C4")

cheers!

organizedKaoS 03-11-2006 02:09

Quote:

Originally Posted by Kraugh
after a brief study of CurWeapon, the following should work.

Code:
register_event("CurWeapon", "publicfunction", "b", "1=1", "2!0", "2!CSW_KNIFE", "2!CSW_HEGRENADE", "2!CSW_C4")

cheers!

Thanks alot, Ill test it as soon as I can, not sure when tho. Hopefully it works :lol: :lol: :lol: Just some questions for my understanding....What does "1=1" mean? Im assuming that 2 is the current weapon check, so what does "2!0" mean? Thanks again.

PM 03-11-2006 05:02

If #defines are replaced by the preprocessor in string literals, it's a bug :O

They used to be but I thought that was fixed a long time ago.

organizedKaoS 03-11-2006 05:13

Quote:

Originally Posted by PM
If #defines are replaced by the preprocessor in string literals, it's a bug :O

They used to be but I thought that was fixed a long time ago.

Please elaborate??? :oops: :lol: :?: :?:


All times are GMT -4. The time now is 20:25.

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