AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   what's wrong with the plugin ? (https://forums.alliedmods.net/showthread.php?t=206192)

revo4cs 01-19-2013 14:24

what's wrong with the plugin ?
 
I just modified the [Admin check plugin] but the plugin have a bug when i just use the slash.amxx plugin, the check admin plugin did not show me the result of the plugin, but when i recompile i got errors. :cry:

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

/*---------------EDIT ME------------------*/
#define ADMIN_CHECK ADMIN_KICK

static const COLOR[] = "^x04" //green
static const CONTACT[] = "^x04"
/*----------------------------------------*/

new maxplayers
new gmsgSayText
new pcvar_Display


public plugin_init() {
        register_plugin("Admin Online", "0.1a", "R3VO")
        maxplayers = get_maxplayers()
        gmsgSayText = get_user_msgid("SayText")
        register_concmd("say /whoadmin", "handle_say")
        register_concmd("say /admin", "handle_say")
        register_concmd("say /admins", "handle_say")
        register_cvar("amx_contactinfo", CONTACT, FCVAR_SERVER)
        pcvar_Display = register_cvar("sv_aodisplay", "0")
}

public handle_say(id)
 {
        if(get_pcvar_num(pcvar_Display) == 1)
        {
                client_print(0, print_adminlist,)
        }
        else
        {
                client_print(id, print_adminlist)
        }
        return PLUGIN_HANDLED
}

public print_adminlist(user)
{
        new adminnames[33][32]
        new message[256]
        new contactinfo[256], contact[112]
        new id, count, x, len
       
        for(id = 1 ; id <= maxplayers ; id++)
                if(is_user_connected(id))
                        if(get_user_flags(id) & ADMIN_CHECK)
                                get_user_name(id, adminnames[count++], 31)

        len = format(message, 255, "%s ADMINS ONLINE: ",COLOR)
        if(count > 0) {
                for(x = 0 ; x < count ; x++) {
                        len += format(message[len], 255-len, "%s%s ", adminnames[x], x < (count-1) ? ", ":"")
                        if(len > 96 ) {
                                print_message(user, message)
                                len = format(message, 255, "%s ",COLOR)
                        }
                }
                print_message(user, message)
        }
        else {
                len += format(message[len], 255-len, "No admins online.")
                print_message(user, message)
        }
       
        get_cvar_string("amx_contactinfo", contact, 63)
        if(contact[0])  {
                format(contactinfo, 111, "%s Contact Server Admin -- %s", COLOR, contact)
                print_message(user, contactinfo)
        }
}

print_message(id, msg[]) {
        message_begin(MSG_ONE, gmsgSayText, {0,0,0}, id)
        write_byte(id)
        write_string(msg)
        message_end()
}

Errors:

Code:

//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// admin_on.sma
// C:\Program Files (x86)\Steam\steamapps\revoportal1\dedicated server\cstrike\addons\amxmodx\scripting\admin_on.sma(33) : error 029: invalid expression, assumed zero
// C:\Program Files (x86)\Steam\steamapps\revoportal1\dedicated server\cstrike\addons\amxmodx\scripting\admin_on.sma(37) : error 029: invalid expression, assumed zero
//
// 2 Errors.
// Could not locate output file C:\Program Files (x86)\Steam\steamapps\revoportal1\dedicated server\cstrike\addons\amxmodx\scripting\compiled\admin_on.amx (compile failed).
//
// Compilation Time: 0.08 sec
// ----------------------------------------

// File not found.

:crab


revo4cs 01-19-2013 17:07

Re: what's wrong with the plugin ?
 
No one wants to help me ? this is important for me :(

AngeIII 01-19-2013 18:58

Re: what's wrong with the plugin ?
 
you have a Unnecessary "," at line: 30+
PHP Code:

if(get_pcvar_num(pcvar_Display) == 1

        
client_print(0print_adminlist,)
}
else
{
         
client_print(idprint_adminlist)


client_print(0, print_adminlist,)
-> wrong ","
and also wrong usage of function.
client_print(id,type,Message[],arg[]);

revo4cs 01-20-2013 08:47

Re: what's wrong with the plugin ?
 
Thanks AngeIII, i try now
like this maybe ?
PHP Code:

if(get_pcvar_num(pcvar_Display) == 1

        
client_print(0print_chatprint_adminlist);
}
else
{
        
client_print(idprint_chatprint_adminlist);



AngeIII 01-20-2013 08:55

Re: what's wrong with the plugin ?
 
your print_adminlist is just function. so you can call it like this:

PHP Code:

if(get_pcvar_num(pcvar_Display) == 1

        
print_adminlist(0)
}
else
{
        
print_adminlist(id)



revo4cs 01-20-2013 09:03

Re: what's wrong with the plugin ?
 
It's work. thank you AngeIII. I'm still beginner in amxx programming


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

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