AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Get Victim has helmet (https://forums.alliedmods.net/showthread.php?t=310747)

ItsMeMaLi 09-18-2018 06:33

Get Victim has helmet
 
Hi everybody,
I'm wondering if there's a way to understand if victim has helmet.

With
Code:

int armor = GetClientArmor(victim);
I only get the armor value 0 to 100 no difference if only kevlar or kevlar+helmet.

I'm writing a only hs plugin that will give difference if you have helmet or kevlar.

Thank you

Shane1390 09-18-2018 07:07

Re: Get Victim has helmet
 
I'm assuming this is for CS:GO?
Per splewis' 1v1 plugin: https://github.com/splewis/csgo-mult...1v1/generic.sp

Code:

stock void Client_SetHelmet(int client, bool helmet) {
  int offset = FindSendPropInfo("CCSPlayer", "m_bHasHelmet");
  SetEntData(client, offset, helmet);
}

You could just as easily implement a 'get' function like so (untested):

Code:

stock bool Client_GetHelmet(int client) {
  int offset = FindSendPropInfo("CCSPlayer", "m_bHasHelmet");
  return GetEntData(client, offset, 1);
}


shanapu 09-18-2018 11:06

Re: Get Victim has helmet
 
Quote:

Originally Posted by Shane1390 (Post 2615670)
...
Code:

stock bool Client_GetHelmet(int client) {
  int offset = FindSendPropInfo("CCSPlayer", "m_bHasHelmet");
  return GetEntData(client, offset, 1);
}


no need for "find offset" when using GetEntProp.
PHP Code:

GetEntProp(clientProp_Send"m_bHasHelmet"

PHP Code:

if (GetEntProp(clientProp_Send"m_bHasHelmet"))
{
     
//has helmet




All times are GMT -4. The time now is 23:46.

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