AlliedModders

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

Nutu_ 11-18-2018 11:41

loose indentation
 
PHP Code:

public msgHealth(msgiddestid)
{
if(!
g_isAlive[id])
    return 
PLUGIN_CONTINUE;
    static 
hp;
    
hp get_msg_arg_int(1);
    if(
hp 255 && (hp 256) == 0)
        
set_msg_arg_int(1ARG_BYTE, ++hp);
    
    return 
PLUGIN_CONTINUE;


loose indentation error on line
Code:

        static hp;
and

PHP Code:

static player
for (player 1player <= g_iMaxPlayersplayer++)
{
    
// Not connected
    
if (!g_isConnected[player])
        continue;
        
// Remember changed arguments
        
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
        
changedcount 0
        
// Replace LANG_PLAYER with player id
        
for (2argscounti++)
        {
            if (
getarg(i) == LANG_PLAYER)
            {
                
setarg(i0player)
                
changed[changedcount] = i
                changedcount
++
            }
        }
        
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
        
write_byte(player)
        
write_string(buffer)
        
message_end()
        
        
// Replace back player id's with LANG_PLAYER
        
for (0changedcounti++)
            
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }


loose indentation error on line :
Code:

        static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
I am wondering why do i get that? i haven't left any space and i've used amxmodx indenter. any help?

Airkish 11-18-2018 12:25

Re: loose indentation
 
You simply have bad indentation.

PHP Code:

public msgHealth(msgiddestid

    if(!
g_isAlive[id]) 
        return 
PLUGIN_CONTINUE

    static 
hp
    
hp get_msg_arg_int(1);
     
    if(
hp 255 && (hp 256) == 0
        
set_msg_arg_int(1ARG_BYTE, ++hp); 
     
    return 
PLUGIN_CONTINUE


This code bit isn't correct actually:

PHP Code:

static player 
for (player 1player <= g_iMaxPlayersplayer++) 

    
// Not connected 
    
if (!g_isConnected[player]) 
        continue;

    
// Remember changed arguments 
    
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies 
    
changedcount 
    
// Replace LANG_PLAYER with player id 
    
for (2argscounti++) 
    { 
        if (
getarg(i) == LANG_PLAYER
        { 
            
setarg(i0player
            
changed[changedcount] = 
            changedcount
++ 
        } 
    } 
         
    
// Format message for player 
    
vformat(buffercharsmax(buffer), message3
         
    
// Send it 
    
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player
    
write_byte(player
    
write_string(buffer
    
message_end() 
         
    
// Replace back player id's with LANG_PLAYER 
    
for (0changedcounti++) {
        
setarg(changed[i], 0LANG_PLAYER
    }
    
    
// Send to specific target 
    
else 
    {
        
// Format message for player 
        
vformat(buffercharsmax(buffer), message3
         
        
// Send it 
        
message_begin(MSG_ONEg_msgSayText_target
        
write_byte(target
        
write_string(buffer
        
message_end() 
    } 




All times are GMT -4. The time now is 07:32.

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