AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Block Flashlight For T (https://forums.alliedmods.net/showthread.php?t=208202)

clementj626 02-10-2013 23:03

[HELP] Block Flashlight For T
 
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.

YamiKaitou 02-10-2013 23:19

Re: [HELP] Block Flashlight For T
 
You are missing a } somewhere. If you indent your code properly you will find it

Unkolix 02-11-2013 00:32

Re: [HELP] Block Flashlight For T
 
Quote:

Originally Posted by YamiKaitou (Post 1892097)
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-"

YamiKaitou 02-11-2013 02:00

Re: [HELP] Block Flashlight For T
 
Quote:

Originally Posted by Unkolix (Post 1892133)
You are right, but why!? Maybe he don't understand english?

Sorry, I do not understand the point of your post

Unkolix 02-11-2013 02:11

Re: [HELP] Block Flashlight For T
 
What not to understand here:
PHP Code:

expected token"}" but found "-end of file-" 


leonardo_ 02-11-2013 02:11

Re: [HELP] Block Flashlight For T
 
Quote:

Originally Posted by clementj626 (Post 1892094)
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;
    }



clementj626 02-11-2013 04:50

Re: [HELP] Block Flashlight For T
 
Quote:

Originally Posted by leonardo_ (Post 1892162)
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(28) : 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.

hleV 02-11-2013 07:45

Re: [HELP] Block Flashlight For T
 
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;



clementj626 02-11-2013 09:08

Re: [HELP] Block Flashlight For T
 
Quote:

Originally Posted by hleV (Post 1892292)
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?

hleV 02-11-2013 10:20

Re: [HELP] Block Flashlight For T
 
Try doing
PHP Code:

entity_set_int(clientEV_INT_impulse0); 

when the player's team changes.


All times are GMT -4. The time now is 20:33.

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