This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Check Flashlight


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-06-2010 , 23:43   Check Flashlight
Reply With Quote #1

Anyone know a way to check if a client's flashlight is on or off? Short of tracking it manually from when they spawn. I'd rather explore other possibilities before doing this.
__________________
Greyscale is offline
javalia
Senior Member
Join Date: May 2009
Location: korea, republic of
Old 01-07-2010 , 00:30   Re: Check Flashlight
Reply With Quote #2

289 CHL2MP_Player::FlashlightIsOn(void)
290 CHL2MP_Player::FlashlightTurnOn(void)
291 CHL2MP_Player::FlashlightTurnOff(void)

isnt this so cool?
maybe on other game like css u can use this
but...not sure about l4d2...
and i found this from sourcemod homepage`s
virtual offset list page.
javalia is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 01-07-2010 , 01:21   Re: Check Flashlight
Reply With Quote #3

Ooh

Code:
CCSPlayer::FlashlightIsOn()
CCSPlayer::FlashlightTurnOn()
CCSPlayer::FlashlightTurnOff()
Didn't think to check virtual offsets. Only checked entity properties.

Thanks!


Code:
CBasePlayer::IsIlluminatedByFlashlight(CBaseEntity*, float*)
Interesting..
__________________
Greyscale is offline
TESLA-X4
Senior Member
Join Date: Dec 2008
Location: $Recycle.Bin
Old 01-08-2010 , 02:08   Re: Check Flashlight
Reply With Quote #4

Or you can check the player's m_fEffects offset, if it's 0, the player's flashlight is off, and if it's 4, the player's flashlight is on. You can also force it on or off by setting the data to the corresponding value.
TESLA-X4 is offline
Paaf
Member
Join Date: Dec 2010
Old 12-27-2011 , 05:12   Re: Check Flashlight
Reply With Quote #5

Sorry for using that old post...

Quote:
CBasePlayer::IsIlluminatedByFlashlight(CBaseE ntity*, float*)
I would like to use that function for CS:S but I don't really know how... This is what I did :

Quote:
new Handle:g_hIsIlluminatedByFlashlight = INVALID_HANDLE;

public OnPluginStart()
{
g_hToolsGameConfig = LoadGameConfigFile("plugin.predatormod");

StartPrepSDKCall(SDKCall_Player);
PrepSDKCall_SetFromConf(g_hToolsGameConfig, SDKConf_Virtual, "IsIlluminatedByFlashlight");
PrepSDKCall_SetReturnInfo(SDKType_Bool, SDKPass_ByValue);
PrepSDKCall_AddParameter(SDKType_CBaseEntity, SDKPass_Pointer);
PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Pointer);
g_hIsIlluminatedByFlashlight = EndPrepSDKCall();
}

bool IsIlluminatedByFlashlight(client)
{
SDKCall(g_hIsIlluminatedByFlashlight, *client, 0.0);
}
First I supposed that the function return a boolean but I am not sure.
Second, I don't know if my declarations are good but at the end, I got an error in the declaration : "error 010: invalid function or declaration"
Is the first argument (CBaseEntity*) the entity or client to check if it's illuminated or not ? What is the float in the second argument ? And why do they use pointers ?
I don't know where I can find the documentation...

Last edited by Paaf; 12-27-2011 at 05:29.
Paaf is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 12-27-2011 , 12:28   Re: Check Flashlight
Reply With Quote #6

Hum this works for me.

PHP Code:
                //Set Ent Data:
                
GetEntProp(ClientProp_Data"m_fEffects"); 
__________________
Master(d)



Master53 is offline
Paaf
Member
Join Date: Dec 2010
Old 12-27-2011 , 12:44   Re: Check Flashlight
Reply With Quote #7

Do you use it to know if a player is illuminated by a flashlight or to know if the flashlight is ON or OFF ? Because I need the first use.

Last edited by Paaf; 12-27-2011 at 12:45.
Paaf is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 12-27-2011 , 12:54   Re: Check Flashlight
Reply With Quote #8

well "m_fEffects" you can ether set or get the values which it contains if "m_fEffects" is set to 0 that will turn the flashlight of but if its set to 4 the flashlight will turn on.
not sure i've explainded it well...
__________________
Master(d)



Master53 is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 12-27-2011 , 13:00   Re: Check Flashlight
Reply With Quote #9

is there any way to detect if someone is illuminated by a flashlight?
__________________

Last edited by zipcore; 12-27-2011 at 13:15.
zipcore is offline
Paaf
Member
Join Date: Dec 2010
Old 12-27-2011 , 13:24   Re: Check Flashlight
Reply With Quote #10

Yes Yes I understand but that's not what I need actually. I need to detect when a player is illuminated by a flashlight. That's why I am interested by this function
Quote:
CBasePlayer::IsIlluminatedByFlashlight(CBaseE ntity*, float*)
but I don't know how to declare it and what arguments and parameters does it use...
Paaf is offline
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 07:32.


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