Raised This Month: $ Target: $400
 0% 

[HELP] Block Flashlight For T


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
clementj626
Junior Member
Join Date: Aug 2011
Old 02-10-2013 , 23:03   [HELP] Block Flashlight For T
Reply With Quote #1

Can someone help me with this?

#include <amxmodx>
#include <fakemeta>

public plugin_init( ) {
register_plugin( "Block Flashlight For T", "1.0", "None" );
register_forward( FM_CmdStart, "fwCmdStart" );
}

public fwCmdStart( id, uc_handle, seed ) {
if( get_uc( uc_handle, UC_Impulse ) == 100 ) {
if(get_user_team(id) == 1){
set_uc( uc_handle, UC_Impulse, 0 );
return FMRES_HANDLED;
}
else
{
if (pev(id, pev_effects) & EF_DIMLIGHT)
{
set_pev(id, pev_impulse, 100)

}
}
return FMRES_IGNORED;
}

The error is :

error 001: expected token: "}" but found "-end of file-"

Wth is that? Someone plz help me.
clementj626 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-10-2013 , 23:19   Re: [HELP] Block Flashlight For T
Reply With Quote #2

You are missing a } somewhere. If you indent your code properly you will find it
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-11-2013 , 00:32   Re: [HELP] Block Flashlight For T
Reply With Quote #3

Quote:
Originally Posted by YamiKaitou View Post
You are missing a } somewhere. If you indent your code properly you will find it
You are right, but why!? Maybe he don't understand english?
Code:
expected token: "}" but found "-end of file-"
Unkolix is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-11-2013 , 02:00   Re: [HELP] Block Flashlight For T
Reply With Quote #4

Quote:
Originally Posted by Unkolix View Post
You are right, but why!? Maybe he don't understand english?
Sorry, I do not understand the point of your post
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Unkolix
Veteran Member
Join Date: Sep 2012
Old 02-11-2013 , 02:11   Re: [HELP] Block Flashlight For T
Reply With Quote #5

What not to understand here:
PHP Code:
expected token"}" but found "-end of file-" 
Unkolix is offline
leonardo_
Member
Join Date: Nov 2012
Location: Moscow, right now in Vic
Old 02-11-2013 , 02:11   Re: [HELP] Block Flashlight For T
Reply With Quote #6

Quote:
Originally Posted by clementj626 View Post
Can someone help me with this?

#include <amxmodx>
#include <fakemeta>

public plugin_init( ) {
register_plugin( "Block Flashlight For T", "1.0", "None" );
register_forward( FM_CmdStart, "fwCmdStart" );
}

public fwCmdStart( id, uc_handle, seed ) {
if( get_uc( uc_handle, UC_Impulse ) == 100 ) {
if(get_user_team(id) == 1){
set_uc( uc_handle, UC_Impulse, 0 );
return FMRES_HANDLED;
}
else
{
if (pev(id, pev_effects) & EF_DIMLIGHT)
{
set_pev(id, pev_impulse, 100)

}
}
return FMRES_IGNORED;
}

The error is :

error 001: expected token: "}" but found "-end of file-"

Wth is that? Someone plz help me.
I guess it suppose to be like that:

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init( ) {
    
register_plugin"Block Flashlight For T""1.0""None" );
    
register_forwardFM_CmdStart"fwCmdStart" );
}

public 
fwCmdStartiduc_handleseed 
{
    if( 
get_ucuc_handleUC_Impulse ) == 100 
    {
        if(
get_user_team(id) == 1)
    {
            
set_ucuc_handleUC_Impulse);
            return 
FMRES_HANDLED;
    }
        else
        {
            if (
pev(idpev_effects) & EF_DIMLIGHT)
            {
        
set_pev(idpev_impulse100)
        
            }
        }
        return 
FMRES_IGNORED;
    }

__________________
www.Deagle-Shot.ru - Game Community

Last edited by leonardo_; 02-11-2013 at 02:12.
leonardo_ is offline
Send a message via ICQ to leonardo_ Send a message via Skype™ to leonardo_
clementj626
Junior Member
Join Date: Aug 2011
Old 02-11-2013 , 04:50   Re: [HELP] Block Flashlight For T
Reply With Quote #7

Quote:
Originally Posted by leonardo_ View Post
I guess it suppose to be like that:

PHP Code:
#include <amxmodx>
#include <fakemeta>

public plugin_init( ) {
    
register_plugin"Block Flashlight For T""1.0""None" );
    
register_forwardFM_CmdStart"fwCmdStart" );
}

public 
fwCmdStartiduc_handleseed 
{
    if( 
get_ucuc_handleUC_Impulse ) == 100 
    {
        if(
get_user_team(id) == 1)
    {
            
set_ucuc_handleUC_Impulse);
            return 
FMRES_HANDLED;
    }
        else
        {
            if (
pev(idpev_effects) & EF_DIMLIGHT)
            {
        
set_pev(idpev_impulse100)
        
            }
        }
        return 
FMRES_IGNORED;
    }

Well, I got 1 Errors when compiling..

[PHP]/tmp/textXlqadC.sma(2 : warning 209: function "fwCmdStart" should return a value
Header size: 284 bytes
Code size: 544 bytes
Data size: 176 bytes
Stack/heap size: 16384 bytes; estimated max. usage=42 cells (168 bytes)
Total requirements: 17388 bytes

1 Warning.
Done.
clementj626 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-11-2013 , 07:45   Re: [HELP] Block Flashlight For T
Reply With Quote #8

Add return FMRES_IGNORED; before the last }.

Or use a better code:
PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike>

public plugin_init()
{
    
register_plugin("Block Flashlight for Terrorists""1.1""HLEV");
    
    
register_impulse(100"OnImpulse100");
}

public 
OnImpulse100(client)
{
    
// I guess alive check isn't needed
    
return cs_get_user_team(client) == CS_TEAM_T PLUGIN_HANDLED PLUGIN_CONTINUE;

__________________

Last edited by hleV; 02-11-2013 at 07:48.
hleV is offline
clementj626
Junior Member
Join Date: Aug 2011
Old 02-11-2013 , 09:08   Re: [HELP] Block Flashlight For T
Reply With Quote #9

Quote:
Originally Posted by hleV View Post
Add return FMRES_IGNORED; before the last }.

Or use a better code:
PHP Code:
#include <amxmodx>
#include <engine>
#include <cstrike>

public plugin_init()
{
    
register_plugin("Block Flashlight for Terrorists""1.1""HLEV");
    
    
register_impulse(100"OnImpulse100");
}

public 
OnImpulse100(client)
{
    
// I guess alive check isn't needed
    
return cs_get_user_team(client) == CS_TEAM_T PLUGIN_HANDLED PLUGIN_CONTINUE;

Your plugin was fine. But I found a bug that when CT turn on his flashlight, then he was drag into the T, the flashlight not automatic turn off. And he cant turn off his own flashlight. Can you fix this?
clementj626 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-11-2013 , 10:20   Re: [HELP] Block Flashlight For T
Reply With Quote #10

Try doing
PHP Code:
entity_set_int(clientEV_INT_impulse0); 
when the player's team changes.
__________________
hleV is offline
Reply


Thread Tools
Display Modes

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 20:33.


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