Raised This Month: $51 Target: $400
 12% 

How to register a bool variable to catch flashlight on


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-09-2013 , 13:10   How to register a bool variable to catch flashlight on
Reply With Quote #1

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)

}

public function() {
    new 
bool:IsFlashLightOn
    IsFlashLightOn 
= ???
    
    if ( 
bool:IsFlashLightOn == true ) { 
        
client_cmd (31"impulse 100")
    }
    else {
        
// Do nothing
    
}
}} 
I just started to learn pawn as I'm free in this summer,
I know this is a total mess ..Just doing it for learning purposes, but how to catch the player when his flashlight is on ?

Last edited by Moody92; 06-09-2013 at 13:25.
Moody92 is offline
President
Member
Join Date: May 2013
Old 06-09-2013 , 13:21   Re: How to register a bool variable to catch flashlight on
Reply With Quote #2

register_impulse(100, "HookFlashlight");

Last edited by President; 06-09-2013 at 13:30.
President is offline
Smatify
Senior Member
Join Date: Nov 2012
Location: Where ever you want
Old 06-09-2013 , 13:22   Re: How to register a bool variable to catch flashlight on
Reply With Quote #3

PHP Code:
public plugin_init()
{
    
register_impulse(100"your_function")
}

public 
your_function(id)
{    
    
client_cmd (id,"impulse 100"

__________________
Selling Hosting stuff such as Webspace and Game- & VoiceServer

I'm also selling Steam Keys.
For more informations, contact me.

(Homepage is under development)

Last edited by Smatify; 06-09-2013 at 13:24.
Smatify is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-09-2013 , 13:25   Re: How to register a bool variable to catch flashlight on
Reply With Quote #4

Quote:
Originally Posted by Smatify View Post
PHP Code:
public plugin_init()
{
    
register_impulse(100"your_function")
}

public 
your_function()
{    
    
client_cmd (31,"impulse 100"

So this is going to close the flashlight once it's ON.

Thanks alot. but the thing is no such a thing called register_impulse..

EDIT: Nvm, didn't include engine

Last edited by Moody92; 06-09-2013 at 13:32.
Moody92 is offline
President
Member
Join Date: May 2013
Old 06-09-2013 , 13:29   Re: How to register a bool variable to catch flashlight on
Reply With Quote #5

Quote:
Originally Posted by Smatify View Post
PHP Code:
public plugin_init()
{
    
register_impulse(100"your_function")
}

public 
your_function(id)
{    
    
client_cmd (id,"impulse 100"

-->
PHP Code:
#include <amxmodx>
#include <engine>

public plugin_cfg() register_impulse(100"HookFlashlight");
public 
HookFlashlight(id) return PLUGIN_HANDLED

Last edited by President; 06-09-2013 at 13:31.
President is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-09-2013 , 13:32   Re: How to register a bool variable to catch flashlight on
Reply With Quote #6

Quote:
Originally Posted by President View Post
-->
PHP Code:
#include <amxmodx>
#include <engine>

public plugin_cfg() register_impulse(100"HookFlashlight");
public 
HookFlashlight(id) return PLUGIN_HANDLED
I get it now. thanks
Moody92 is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 06-09-2013 , 13:32   Re: How to register a bool variable to catch flashlight on
Reply With Quote #7

Quote:
. but the thing is no such a thing called register_impulse..
Quote:
register_impulse
Engine (engine.inc)

Description

register_impulse - Registers a client impulse to a function.

Syntax

register_impulse ( impulse, function[] )

Type

Forward

Notes

When an impulse is started on a client, the client's id is forwarded to the named function.

This is a blocking forward (PLUGIN_HANDLED will block the operation).
__________________

Last edited by Kia; 06-09-2013 at 13:33.
Kia is offline
a7811311622
Member
Join Date: Apr 2010
Old 06-09-2013 , 23:40   Re: How to register a bool variable to catch flashlight on
Reply With Quote #8

register_event("Flashlight", ...) and read_data(1).
__________________
a7811311622 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-09-2013 , 23:45   Re: How to register a bool variable to catch flashlight on
Reply With Quote #9

Quote:
Originally Posted by a7811311622 View Post
register_event("Flashlight", ...) and read_data(1).
That event only updates the HUD. This will not do any good if you want to modify the how the flashlight works.
__________________
fysiks is offline
a7811311622
Member
Join Date: Apr 2010
Old 06-10-2013 , 00:51   Re: How to register a bool variable to catch flashlight on
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
That event only updates the HUD. This will not do any good if you want to modify the how the flashlight works.
Sorry, I'm confused about topic name, it looks like get but his code is set...
__________________
a7811311622 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 17:22.


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