AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to tell if a person has purchased a helmet (https://forums.alliedmods.net/showthread.php?t=3545)

TGK 07-09-2004 08:37

How to tell if a person has purchased a helmet
 
Does anyone know how to do this? I tried searching the forums and functions and didnt see anything that will return whether or not a player has purchased/posesses a kevlar helmet.

This would be useful for a headshot modification I am planning on writing, please give me some input =)

-TGK :twisted:

Deagle 07-09-2004 08:42

kevlar and kevlar/helmet has the exact same indications in armor (100)
so im not sure if there is anything other then that, after a test we did u can take 2 more shots from a glock in head with helmet before dying this is something we been over a couple of times too.

Deag

kingpin 07-09-2004 09:04

they have a different id tho kevlar with helmet was given with 16 I remmeber and just kevlar was 15 I think, this is in stipper2...... but I dont know the exact thing for that in amxx.

TGK 07-09-2004 09:23

something like get_user_helmet would be ideal =(

scafe 07-09-2004 12:09

well the icon itself (the sprite) is different (it has a helmet on the kevlar) other then that i see no real difference unless you shoot someone in the head with and smg or pistol the it takes 2-4 shots (not sure if this post helps though)

Johnny got his gun 07-09-2004 12:46

I made a quick research and found an interesting offset.

Try this

Code:
const HELMET_OFFSET = 112 stock cs_get_user_helmet(index) {     return get_offset_int(index, HELMET_OFFSET) == 2 }

I noticed that the value at this offset is set to 0 when user has no armor, then 1 when user has bought armor, then 2 when user bought armor + helmet.
Didn't test what happens if user has only armor 1, 34, 99 or whatever. Dont really know when you lose your helmet in CS, maybe after the first shot to your head is a good guess.

Guess I can add this as a native in a future release of cs module, but I can use your feedback on this. What does it (get_offset_int(index, HELMET_OFFSET)) return etc...

AssKicR 07-09-2004 13:08

the offset functions are according to BAILOPAN broken in 0.16 and will be/has been fixed in 0.20

if my memory serves me correctly

Dygear 07-09-2004 15:11

What about reading the icon down in the left-bottom side of the screen.
That has the Armor + Helmet.

TGK 07-09-2004 16:26

I'll be happy to test this this evening, will give you feedback then.

Ryan 07-09-2004 23:57

you can use the "ArmorType" event, used in register event, to catch whena player has armor and/or a helmet.

Code:
#define ARMORTYPE_KEVLAR              0 #define ARMORTYPE_HELMET              1 new g_iArmorType[33]; public Ev_ArmorType( id ) {     if ( read_data( 1 ) )         g_iArmorType[id] = ARMORTYPE_HELMET;     else     {         g_iArmorType[id] = ARMORTYPE_KEVLAR;     }     return PLUGIN_CONTINUE; } public plugin_init() {     // ... other stuff up here     register_event( "ArmorType", "Ev_ArmorType", "be" );     return PLUGIN_CONTINUE; }

Hope this helps :)


All times are GMT -4. The time now is 14:41.

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