Raised This Month: $ Target: $400
 0% 

2 error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragos
Senior Member
Join Date: Oct 2018
Location: Romania
Old 05-26-2019 , 12:22   2 error
Reply With Quote #1

hi i make a hud team score [i know it on network]
and i get 1 error when i copiled it work but i dont want to have error
PHP Code:
#include <amxmodx>  
#include <engine>  

new const PLUGIN[] =    "Team_Score"
new const VERSIUNE[] =    "1.0"

#define TOP_INFO 1.0

new ctterrorist;


public 
plugin_init( )  
{  
    
set_task(TOP_INFO,"top_info",_,_,_,"b")
    
    
    
register_pluginPLUGIN,VERSIUNE,"AMG" );  
    
    
    
register_event"TeamScore","ev_TeamScore","a" );   
}  

public 
ev_TeamScore( )  
{    
    new 
team[32];
    
read_data(1,team,31);
    if (
equal(team,"CT"))
    {
        
ct read_data(2);
    }
    else if (
equal(team,"TERRORIST"))
    {
        
terroristread_data(2);
    }
}

public 
top_info()  
{
             new 
currentMap[32]
             
get_mapname(currentMap,charsmax(currentMap))
        
             
set_hudmessage(1270255, -1.00.006.012.0);
        
show_hudmessage(0,"| | T  %d | |     %s      | |  CT  %d | |",terrorist,currentMap,ct)    

__________________
sup

Last edited by Dragos; 05-26-2019 at 12:27.
Dragos is offline
Dragos
Senior Member
Join Date: Oct 2018
Location: Romania
Old 05-26-2019 , 12:26   Re: 2 error
Reply With Quote #2

1 error*
__________________
sup
Dragos is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 05-26-2019 , 12:32   Re: 2 error
Reply With Quote #3

What's the error?
__________________








CrazY. is offline
Dragos
Senior Member
Join Date: Oct 2018
Location: Romania
Old 05-26-2019 , 12:38   Re: 2 error
Reply With Quote #4

Warning: Loose indentation on line 43
__________________
sup
Dragos is offline
Dragos
Senior Member
Join Date: Oct 2018
Location: Romania
Old 05-26-2019 , 12:42   Re: 2 error
Reply With Quote #5

PHP Code:
set_hudmessage(25500, -1.00.006.012.0); 
__________________
sup
Dragos is offline
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 05-26-2019 , 12:44   Re: 2 error
Reply With Quote #6

An indent error. You can ignore it or show_hudmessage tab once.
__________________

Last edited by SomewhereLost; 05-26-2019 at 12:45.
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 05-26-2019 , 12:45   Re: 2 error
Reply With Quote #7

Hello there and welcome to the AMX Mod X Scripting world. It's fun, but hard if you're a beginner. That's why we're here to help as long as you provide enough information about your code.

I did not get any error, only 1 warning which is "Loose indentation". Warnings are not Errors and will not affect how your plugins work. You can ignore Warnings but I would recommend fixing them.
"Loose indentation" means that you have bad spacing in your code. For example:
PHP Code:
  if(condition == true)
 {
doSomething();
    }
else
 {
doSomethingElse();
 } 
As you can see it looks weird and disorienting if it were a bigger code. I would recommend hitting TAB on your keyboard instead of using spaces, usually almost every IDE would do that for you after you enter a new line. A properly indented code would look like this:

PHP Code:
    if(condition == true)
    {
        
doSomething();
    }
    else
    {
        
doSomethingElse();
    } 
Also one thing I would improve in your code would be: (They won't cause errors when done your way, but are still better ways to do), everything else is just fine as long as you like it.

PHP Code:
set_task(TOP_INFO,"top_info",_,_,_,"b"

PHP Code:
set_task(TOP_INFO,"top_info", .flags "b"); 
This is how you can skip to the last parameter just by using dot with its name. Also put the set_task function to be last in your plugin_init().
redivcram is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 05-26-2019 , 12:45   Re: 2 error
Reply With Quote #8

This is not a error

Code:
public top_info()  
{
             new currentMap[32]
             get_mapname(currentMap,charsmax(currentMap))
        
             set_hudmessage(127, 0, 255, -1.0, 0.0, 0, 6.0, 12.0);
        show_hudmessage(0,"| | T  %d | |     %s      | |  CT  %d | |",terrorist,currentMap,ct)    
}
to

Code:
public top_info()  
{
             new currentMap[32]
             get_mapname(currentMap,charsmax(currentMap))
        
             set_hudmessage(127, 0, 255, -1.0, 0.0, 0, 6.0, 12.0);
             show_hudmessage(0,"| | T  %d | |     %s      | |  CT  %d | |",terrorist,currentMap,ct)    
}
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
Dragos
Senior Member
Join Date: Oct 2018
Location: Romania
Old 05-26-2019 , 12:48   Re: 2 error
Reply With Quote #9

now its good THx
T/C
__________________
sup
Dragos is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-26-2019 , 12:50   Re: 2 error
Reply With Quote #10

Quote:
Originally Posted by redivcram View Post
Warnings are not Errors and will not affect how your plugins work. You can ignore Warnings but I would recommend fixing them.
That is not true. Not all warning can be ignored if you want your plugin to work correctly. It depends on what exactly the warning is. In the case of indentation, yes, it can be ignored. There are many cases where warnings can occur that notify the coder that it might cause issues when running but will still compile.
__________________
fysiks 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 07:13.


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