AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved Scan_Say Plugin Debug Trace [Need Help For Fix] (https://forums.alliedmods.net/showthread.php?t=324293)

Alber9091 05-11-2020 14:07

Scan_Say Plugin Debug Trace [Need Help For Fix]
 
AMXMODX 1.90 [5249] Local Compiler.

Error:
PHP Code:

L 05/11/2020 05:45:42: [AMXXDisplaying debug trace (plugin "scan_say.amxx"version "31/08/2019")
L 05/11/2020 05:45:42: [AMXXRun time error 10native error (native "get_user_flags")
L 05/11/2020 05:45:42: [AMXX]    [0scan_say.sma::fwSayHandle (line 53)
L 05/11/2020 05:45:44Invalid player id 16 

Plugin:
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Scan_Say"
#define VERSION "31/08/2019"
#define AUTHOR "General Memer"

new Float:g_fCooldown[33];


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say""fwSayHandle");
}


public 
client_connect(iClient)
{
    
g_fCooldown[iClient] = 0.0;
}


public 
client_disconnected(iClient)
{
    
g_fCooldown[iClient] = 0.0;
}


public 
fwSayHandle(const iClient)
{
    new 
sArg[194];
    
    
read_argssArgcharsmax(sArg) );
    
remove_quotes(sArg);
    
    new 
sCmd[32];
    
argbreaksArgsCmdcharsmax(sCmd), sArgcharsmax(sArg) );

    if( 
equali(sCmd"/scan") )
    {
        static 
Float:fGametime
        
fGametime get_gametime();
        
        if( 
g_fCooldown[iClient] > fGametime 
            return 
PLUGIN_HANDLED;
        
        if( 
sArg[0] )
        {
            new 
sName[32];
            
get_user_nameiClientsNamecharsmax(sName) );
                        
            for(new 
i33i++)
                if( 
get_user_flags(i) & ADMIN_CHAT && != )
                    
client_print_color(iprint_team_default"^4[PSL] A Scan From (%s)^1: '%s'"sNamesArg);
                
            
client_print_color(iClientprint_team_default"^4[PSL] ^3Your message has been sent.");
        }
        
        
g_fCooldown[iClient] = fGametime 2.0;
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;


May be this is line 53:
PHP Code:

                if( get_user_flags(i) & ADMIN_CHAT && != 


OciXCrom 05-11-2020 14:29

Re: Small Plugin Debug Trace [Need Help For Fix]
 
Code:
for(new i; i < 33; i++)     if( get_user_flags(i) & ADMIN_CHAT && i != 0 )         client_print_color(i, print_team_default, "^4[PSL] A Scan From (%s)^1: '%s'", sName, sArg);

=>

Code:
new iPlayers[32], iPnum; get_players(iPlayers, iPnum); for(new i, iPlayer; i < iPnum; i++) {     iPlayer = iPlayers[i];     if( get_user_flags(iPlayer) & ADMIN_CHAT )     {         client_print_color(iPlayer, print_team_default, "^4[PSL] A Scan From (%s)^1: '%s'", sName, sArg);     } }

Alber9091 05-11-2020 16:44

Re: Small Plugin Debug Trace [Need Help For Fix]
 
Can you fix these warnings & error please?

https://i.ibb.co/WPdhRv2/IMG-20200512-014005.jpg

Just to quickly Escalate to lines numbers:
https://pastebin.com/YhPNmyJA

PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Scan_Say"
#define VERSION "12/May/2020"
#define AUTHOR "General Memer"

new Float:g_fCooldown[33];


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say""fwSayHandle");
}


public 
client_connect(iClient)
{
    
g_fCooldown[iClient] = 0.0;
}


public 
client_disconnected(iClient)
{
    
g_fCooldown[iClient] = 0.0;
}


public 
fwSayHandle(const iClient)
{
    new 
sArg[194];
    
    
read_argssArgcharsmax(sArg) );
    
remove_quotes(sArg);
    
    new 
sCmd[32];
    
argbreaksArgsCmdcharsmax(sCmd), sArgcharsmax(sArg) );

    if( 
equali(sCmd"/scan") )
    {
        static 
Float:fGametime
        
fGametime get_gametime();
        
        if( 
g_fCooldown[iClient] > fGametime 
            return 
PLUGIN_HANDLED;
        
        if( 
sArg[0] )
        {
            new 
sName[32];
            
get_user_nameiClientsNamecharsmax(sName) );
                        
new 
iPlayers[32], iPnum;
get_players(iPlayersiPnum;

for(new 
iiPlayeriPnumi++)
{
    
iPlayer iPlayers[i];

    if( 
get_user_flags(iPlayer) & ADMIN_CHAT )
    {
        
client_print_color(iPlayerprint_team_default"^4[PSL] A Scan From (%s)^1: '%s'"sNamesArg);
    }
}            
            
client_print_color(iClientprint_team_default"^4[PSL] ^3Your message has been sent.");
        }
        
        
g_fCooldown[iClient] = fGametime 2.0;
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;



OciXCrom 05-11-2020 17:21

Re: Small Plugin Debug Trace [Need Help For Fix]
 
Indent the code properly and close the parantheses at "get_players".

Alber9091 05-11-2020 20:26

Re: Small Plugin Debug Trace [Need Help For Fix]
 
Thanks. Compiled Properly.

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Scan_Say" #define VERSION "12/May/2020" #define AUTHOR "General Memer" new Float:g_fCooldown[33]; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say", "fwSayHandle"); } public client_connect(iClient) {     g_fCooldown[iClient] = 0.0; } public client_disconnected(iClient) {     g_fCooldown[iClient] = 0.0; } public fwSayHandle(const iClient) {     new sArg[194];         read_args( sArg, charsmax(sArg) );     remove_quotes(sArg);         new sCmd[32];     argbreak( sArg, sCmd, charsmax(sCmd), sArg, charsmax(sArg) );     if( equali(sCmd, "/scan") )     {         static Float:fGametime;         fGametime = get_gametime();                 if( g_fCooldown[iClient] > fGametime )             return PLUGIN_HANDLED;                 if( sArg[0] )         {             new sName[32];             get_user_name( iClient, sName, charsmax(sName) );             new iPlayers[32], iPnum;             get_players(iPlayers, iPnum);         for(new i, iPlayer; i < iPnum; i++)         {             iPlayer = iPlayers[i];         if( get_user_flags(iPlayer) & ADMIN_CHAT )         {             client_print_color(iPlayer, print_team_default, "^4[PSL] A Scan From (%s)^1: '%s'", sName, sArg);         }     }                             client_print_color(iClient, print_team_default, "^4[PSL] ^3Your message has been sent.");         }                 g_fCooldown[iClient] = fGametime + 2.0;         return PLUGIN_HANDLED;     }     return PLUGIN_CONTINUE; }


All times are GMT -4. The time now is 00:49.

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