AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_task loose indentation (https://forums.alliedmods.net/showthread.php?t=325760)

supertrio17 07-05-2020 13:36

set_task loose indentation
 
Hey, so I tried to find some plugins with set_task and find my mistake, but I can't find any.
I get loose indentation message when compiling.
Here is my code:
PHP Code:

set_task0.2 "team_check" "b" ); 


alferd 07-05-2020 14:08

Re: set_task loose indentation
 
This error is not a problem

test:
PHP Code:

set_task(0.2,"team_check",0,"b"); 


OciXCrom 07-05-2020 14:09

Re: set_task loose indentation
 
Indent your code properly.

Code:
if something    {   bla bla }

=>

Code:
if something {     bla bla }

@alferd - stop trying to help if you have no clue what's going on.

alferd 07-05-2020 14:11

Re: set_task loose indentation
 
Quote:

Originally Posted by OciXCrom (Post 2708757)
@alferd - stop trying to help if you have no clue what's going on.

ok

Xalus 07-05-2020 14:34

Re: set_task loose indentation
 
PHP Code:

native set_task(Float:time, const function[], id 0, const any:parameter[] = ""len 0, const flags[] = ""repeat 0);

set_task0.2 "team_check" , .flags="b" ); 

And for compiling check what OciXCrom said.

supertrio17 07-05-2020 14:42

Re: set_task loose indentation
 
Quote:

Originally Posted by OciXCrom (Post 2708757)
Indent your code properly.

PHP Code:

public team_check()
{
    new 
iPlayers[32], iPnum;
    
get_players(iPlayersiPnum);

    for(new 
iidsiPnumi++)
    {
        
ids iPlayers[i];
        
g_TeamId[ids] = get_user_team(ids);
    }


I see no indentation problems...

thEsp 07-05-2020 14:47

Re: set_task loose indentation
 
After telling others to post their source code, tell yourself the exact same thing.

HamletEagle 07-05-2020 15:19

Re: set_task loose indentation
 
Are you mixing tabs and spaces?

supertrio17 07-05-2020 15:44

Re: set_task loose indentation
 
PHP Code:

#include <amxmodx>
#include <nvault>

#define VERSION "0.1"

new g_TeamId[33];
new 
g_szAuthID[33][35];
new 
g_Vault;

public 
plugin_init() 
{
    
register_plugin("Reconnect Blocker"VERSION"Mr. Boopsy");
    
set_task(0.2"team_check"0, .flags="b");
}

public 
plugin_cfg()
{
    
g_Vault nvault_open"Reconnect_Blocker" );

    if ( 
g_Vault == INVALID_HANDLE )
        
set_fail_state"Error opening nVault" );
}

public 
client_authorized(id)
{
    
register_event("TextMsg""EVENT_PlayerJoinCT""a""2&#Game_join_ct");
    
register_event("TextMsg""EVENT_PlayerJoinTT""a""2&#Game_join_terrorist");

    
get_user_authid(idg_szAuthID[id], charsmax(g_szAuthID[]));
}

public 
EVENT_PlayerJoinCT(id)
{
    new 
szKey[40];
    
formatex(szKeycharsmaxszKey ), "%sTEAM"g_szAuthID[id]);

    new 
iTeam nvault_get(g_VaultszKey );
    if(
iTeam == 2)
    {
        new 
ip[32];
        
get_user_ip(id,ip,31,1);
        
server_cmd("amx_addban %s 2"ip)
    }
}

public 
EVENT_PlayerJoinTT(id)
{
    new 
szKey[40];
    
formatex(szKeycharsmaxszKey ), "%sTEAM"g_szAuthID[id]);

    new 
iTeam nvault_get(g_VaultszKey );
    if(
iTeam == 1)
    {
        new 
ip[32];
        
get_user_ip(id,ip,31,1);
        
server_cmd("amx_addban %s 2"ip)
    }
}

public 
team_check()
{
    new 
iPlayers[32], iPnum;
    
get_players(iPlayersiPnum);

    for(new 
iidsiPnumi++)
    {
        
ids iPlayers[i];
        
g_TeamId[ids] = get_user_team(ids);
    }
}

#if AMXX_VERSION_NUM < 190
public client_disconnect(id)
#else
public client_disconnected(id)
#endif
{
    new 
szTeam[20];
    new 
szKey[40];

    
formatex(szKeycharsmaxszKey ), "%sTEAM"g_szAuthID[id]);
    
formatex(szTeamcharsmaxszTeam ), "%d"g_TeamId[id]);

    
g_TeamId[id] = 0;
    
server_print("reached")
}

public 
plugin_end()
{
    
nvault_closeg_Vault );


I know that it won't work as it is, it just a test code.

OciXCrom 07-05-2020 15:57

Re: set_task loose indentation
 
The code compiles without any warning or errors. If you mixed tabs and spaces in your text editor, that's the problem. The forum supports only spaces so the tabs would have automatically be changed to spaces.


All times are GMT -4. The time now is 17:11.

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