AlliedModders

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

jacksmoke2345 06-29-2006 04:27

Bug
 
I'm a new coder, and well the plugin I made (all it does is render someone a new color and change the persons model / name) works on my friends Dedicated Server, but does not work on my dedicated server, or listen server.

I made the plugin for The Specialists just to test some things out. Does anyone have an idea why it does not work on my servers?

strikerx22 06-29-2006 16:01

Re: Bug
 
David, give them the code for it.

jacksmoke2345 06-29-2006 19:23

Re: Bug
 
1 Attachment(s)
Okay the code is

Code:

#include <amxmodx>
#include <fun>

new isninja[33] = 0
public plugin_init() {
        register_plugin("WcW's Silent Plugin","1.0","WhoCaresWho")
        register_concmd("amx_silent","do_si",ADMIN_KICK,"Makes User Silent")
       
}
public do_si(id) {
        if (!(get_user_flags(id) &ADMIN_KICK) ) {
                console_print(id, "You have no access to that command!")
                return PLUGIN_HANDLED
        }
        if (read_argc () == 0) {
                console_print (id, "Specify a user!")
                return PLUGIN_HANDLED
        }
        new user[32], uid
        read_argv(1,user,32)
        uid = find_player ("bhl", user)
        if (uid == 0) {
                console_print (id, "Nobody by that name is here")
                return PLUGIN_HANDLED
        }
        else
                {
                isninja[id] = 1
                client_print(0,print_chat,"Someone has become a ninja!",1)
        }
        return PLUGIN_HANDLED
}
public client_PreThink(id){
        if(isninja[id] > 0){
                set_user_noclip(id, 1)
                client_cmd(id,"model ninja")
                client_cmd(id,"name Ninja")
        set_user_rendering(id,kRenderFxGlowShell,255,255,255,kRenderNormal,25)
                return PLUGIN_CONTINUE

        }
        return PLUGIN_CONTINUE
}
public client_disconnect(id) isninja[id] = 0

public plugin_precache( ) {
        precache_model "models/player/ninja/ninja.mdl"
}

The part I bolded is where it seems to not work

jacksmoke2345 06-29-2006 19:45

Re: Bug
 
Okay nevermind fixed that, but using the same code as before, what would I add to disable the above using the same command?

Hawk552 06-30-2006 12:51

Re: Bug
 
This really needs a rewrite, here is a fixed version, it is untested however:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> new isninja[33] public plugin_init() {     register_plugin("WcW's Silent Plugin","1.0","WhoCaresWho")     register_concmd("amx_silent","do_si",ADMIN_KICK,"Makes User Silent")         register_event("ResetHUD","fnSetNinja","be")     } public do_si(id,level,cid) {     if(!cmd_access(id,level,cid,2))         return PLUGIN_HANDLED             new user[32], uid     read_argv(1,user,32)     uid = cmd_target(id,user)     if (!uid)         return PLUGIN_HANDLED     else     {         isninja[uid] = 1                 static szName[33],szAdminName[33]         get_user_name(uid,szName,32)         get_user_name(id,szAdminName,32)                 fnSetNinja(id)                 switch(get_cvar_num("amx_show_activity"))         {             case 1 :                 client_print(0,print_chat,"ADMIN: %s has become a ninja",szName)             case 2 :                 client_print(0,print_chat,"ADMIN %s: %s has become a ninja",szAdminName,szName)         }     }         return PLUGIN_HANDLED } public fnSetNinja(id) {     // I'm going to leave these and not do it the proper way,     // on the off chance that this is actually the proper way     // for your mod.     client_cmd(id,"model ninja")     client_cmd(id,"name Ninja")     set_user_noclip(id,1)     set_user_rendering(id,kRenderFxGlowShell,255,255,255,kRenderNormal,25) } public client_disconnect(id)     isninja[id] = 0 public plugin_precache( )     precache_model("models/player/ninja/ninja.mdl")


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

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