AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What did I forget? (https://forums.alliedmods.net/showthread.php?t=2677)

pragma 06-13-2004 10:26

What did I forget?
 
Hi guys, some very simple code here. I didn't bother researching this scripting language all that much as I prefer to jump into things, and I'm allready quite familiar with C/C++. Other than the lack of error checking and loggign, what did I forget here?

Code:

/*
Made by Pragma
Version .9 alpha
*/

#include <amxmod>
#include <amxmisc>


public admin_invis(id,level,cid){
        if (!cmd_access(id,level,cid,3)) {
                return PLUGIN_HANDLED
        }else {
                new invis[3]
                new i_invis
                new name[32]

                read_argv(1,name,32)
                read_argv(2,invis,3)

                i_invis = str_to_num(invis)
                new player = cmd_target(id,name,3)

                if (!player) return PLUGIN_HANDLED

                set_user_rendering(player,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,i_invis)

                get_user_name(player,name,32)
                console_print(id,"[AMX] Client ^"%s^" invis has been set",name)
        }
        return PLUGIN_HANDLED
}

public plugin_init()
{
        register_plugin("Admin Invisibility",".9","Pragmatic Studios")
        register_concmd("amx_invis","admin_invis",ADMIN_SLAY,"<part of nick> <1-255> (1 total invis, 255 total vis)")
        return PLUGIN_CONTINUE
}

Basically I just looked at other scripts and made up what I THOUGHT would work. Now when I type amx_invis with or without arguments in console, I'm told the command doesn't exist. Do i have to create another instance somewhere? I was under the impression that plugin_init handled that... And yes the plugin is being initialized in plugins.ini.

PM 06-13-2004 11:27

First of all, change #include <amxmod> to #include <amxmodx> for us :)
Anyway because admin_invis doesn't seem to return 0/PLUGIN_CONTINUE anywhere, make sure that the plugin is actually running (using amxx plugins).

Burnzy 06-13-2004 11:29

im guessing he took this all from the invis wars thing...

PM 06-13-2004 12:13

Quote:

Originally Posted by Burnzy
im guessing he took this all from the invis wars thing...

And whats the problem with that? I guess he doesn't want to release it; he probably only does it for learning purposes.

pragma 06-13-2004 12:52

Quote:

Originally Posted by Burnzy
im guessing he took this all from the invis wars thing...

Only one line in there is remotely connected to invis wars, and no i don't plan on releasing it as it is.

pragma 06-13-2004 13:21

Changeing the include would be bad, as amxmodx.inc does not contain fuctionality for set_user_rendering. I think I may have found my problem, I'll post here and let you know if I did.

BAILOPAN 06-13-2004 13:41

set_user_rendering is in fun module.

#include <fun> gives you set_user_rendering. #include <amxmod> includes fun automatically for backwards compatibility

pragma 06-13-2004 17:45

yeah, it works now...apparently the compiler for amx (not amxx) is different than the amxx compiler. But yeah anyway, I changed the includes to amxmodx.inc and added fun.inc, compiled with the SC compiler included with amxx and bang it's working. Now I'll just add error checking and logging and whatnot. If anyone wants the plugin when it's complete let me know. Next step is adding a possibility for invisibility in the roll the dice plugin. On that subject, does anyone happen to know if it's possible to call amx commands/plugins etc. from and admin mod plugin?

monkeyj 08-11-2004 20:14

plugin
 
you stated on your post (http://forums.alliedmods.net/showthread.php?t=2677) that if anybody wanted the source, to let you know. TY in adv :roll:

naptor 08-12-2004 10:29

ok
 
ok , i like scripting and i am learning that code will help me learn

i am a noob

http://forums.alliedmods.net/showthread.php?t=2677

cool


All times are GMT -4. The time now is 14:39.

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