AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   need help with my plugin... (https://forums.alliedmods.net/showthread.php?t=95548)

HLM 06-24-2009 15:50

need help with my plugin...
 
im getting these errors, I dont know how to fix them.. im not exactly 'intelligent' about these things.. im one day old to (trying) to script

Code:

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


//// cloak.sma
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(22) : warning 217:
loose indentation
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(27) : warning 217:
loose indentation
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(27) : error 001: ex
pected token: ";", but found "{"
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(32) : warning 217:
loose indentation
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(37) : warning 217:
loose indentation
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(37) : error 001: ex
pected token: ";", but found "{"
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(42) : warning 217:
loose indentation
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(49) : error 001: ex
pected token: ";", but found "{"
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(53) : warning 217:
loose indentation
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(57) : warning 209:
function "give_invis" should return a value
// C:\Program Files\AMX Mod X\files\base\scripting\cloak.sma(80) : error 010: in
valid function or declaration
//
// 4 Errors.
// Could not locate output file compiled\cloak.amx (compile failed).
//
// Compilation Time: 0.64 sec
// ----------------------------------------

Press enter to exit ...

PHP Code:

#include <amxmodx>
#include <fun>
#include <amxmisc>
#define PLUGIN "Cloak"
#define VERSION "1.0"
#define AUTHOR "Master A.K.A. HLM"

#define INVIS_LEVEL ADMIN_KICK        

public plugin_init() {
         
register_plugin(PLUGINVERSIONAUTHOR)
         
register_clcmd("amx_cloak","give_invis",INVIS_LEVEL,"<name|#userid|steamid> <alpha> <on/off> ")
}

public 
give_invis(id,level,cid) {
    if(!
cmd_access(id,level,cid,3))
        return 
PLUGIN_HANDLED
            
    
new name[33]
    
get_user_name(id,name,32)
        
    new 
command1[33], command2[33], command3[33]
    
read_argv(1,command1,32)
    
read_argv(2,command2,32)
    
read_argv(3,command3,32)
        
            new 
usr1 cmd_target(id,command1,2) {
            
client_print(usr1,print_chat"[AMXX] %s is now cloaked. "name)
            
set_user_rendering(usr1,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,0)
        
    
    if(
is_user_alive(usr1))
    
set_user_rendering(usr1,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,0
    
//this line of code will refresh the cloak on user when user is alive again
}
        
        new 
usr2 cmd_target(id,command2,2) {
            
client_print(usr2,print_chat"[AMXX] %s is no longer cloaked. "name)
            
set_user_rendering(usr2,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255)
        

    if(
is_user_alive(usr2))
    
set_user_rendering(usr2,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255
    
//I doubt I actually need this, but its better to be safe rather than *CRASH*
    
}


        
        new 
usr3 cmd_target(id,command3,2) { 
            
client_print(usr3,print_chat"[AMXX] %s is now semi-cloaked. "name)
            
set_user_rendering(usr3,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,128)
        
    if(
is_user_alive(usr3))
    
set_user_rendering(usr3,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,128
    
//this line of code will refresh the cloak on user when user is alive again
}
}
         
/*    new szarg1[33], szalpha[8], szarg3[8], bool:mode
    read_argv(1,szarg1,32)
    read_argv(2,szalpha,7)
    read_argv(3,szarg3,7)
    new ialpha = str_to_num(szalpha)
    if(equal(szarg3,"on"))
        mode = true
        
        new pid = cmd_target(id,szarg1,2)
        if(pid > 0) {
            hasinvis[pid] = mode
            if(mode) {
                        client_print(pid,print_chat,"-[EVIL]- %s is now cloaked ",name)
                        set_user_rendering(pid,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,ialpha)
            }
            else {
                       client_print(pid,print_chat,"-[EVIL]- %s is no longer  ",name)
                       set_user_rendering(pid,kRenderFxNone,0,0,0,kRenderNormal,ialpha)
            }
        }
    }*/
    
    
return PLUGIN_HANDLED
}



HLM 06-24-2009 17:53

Re: need help with my plugin...
 
cant someone tell me anything? I dont know how to fix this!!!

-Acid- 06-24-2009 18:06

Re: need help with my plugin...
 
wat the hell is all this??
Code:

/*    new szarg1[33], szalpha[8], szarg3[8], bool:mode
read_argv(1,szarg1,32)
read_argv(2,szalpha,7)
read_argv(3,szarg3,7)
new ialpha = str_to_num(szalpha)
if(equal(szarg3,"on"))
    mode = true

new pid = cmd_target(id,szarg1,2)
if(pid > 0) {
    hasinvis[pid] = mode
    if(mode) {
        client_print(pid,print_chat,"-[EVIL]- %s is now cloaked ",name)
        set_user_rendering(pid,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,ialpha)
    }
    else {
        client_print(pid,print_chat,"-[EVIL]- %s is no longer  ",name)
        set_user_rendering(pid,kRenderFxNone,0,0,0,kRenderNormal,ialpha)
    }
}
}*/


HLM 06-24-2009 18:35

Re: need help with my plugin...
 
that is the old code that would work, but you would need to set the alpha value, I keep that as a reference to what I can try to do... eveything else is the part that doesnt work..

fysiks 06-24-2009 18:49

Re: need help with my plugin...
 
What do you use to code with? I think you might need a better program like Notepad++, it might help you with your programming.

-Acid- 06-24-2009 18:49

Re: need help with my plugin...
 
u have "}" everywhere lol!!!

HLM 06-24-2009 18:52

Re: need help with my plugin...
 
I use pawn studio..

I am new to coding, I was block coding everything, because I want to all to be together

Arkshine 06-24-2009 18:53

Re: need help with my plugin...
 
Start to indent properly your code and you will see better.

fysiks 06-24-2009 18:55

Re: need help with my plugin...
 
It compiles but I am completely baffled as to what in the world you are doing.

PHP Code:

#include <amxmodx>
#include <fun>
#include <amxmisc>
#define PLUGIN "Cloak"
#define VERSION "1.0"
#define AUTHOR "Master A.K.A. HLM"

#define INVIS_LEVEL ADMIN_KICK

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("amx_cloak","give_invis",INVIS_LEVEL,"<name|#userid|steamid> <alpha> <on/off> ")
}

public 
give_invis(id,level,cid)
{
    if(!
cmd_access(id,level,cid,3))
        return 
PLUGIN_HANDLED

    
new name[33]
    
get_user_name(id,name,32)

    new 
command1[33], command2[33], command3[33]
    
read_argv(1,command1,32)
    
read_argv(2,command2,32)
    
read_argv(3,command3,32)

    new 
usr cmd_target(id,command1,2)
    
client_print(usr,print_chat"[AMXX] %s is now cloaked. "name)
    
set_user_rendering(usr,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,0)

    if(
is_user_alive(usr))
    {
        
set_user_rendering(usr,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,0)
    }
    
//this line of code will refresh the cloak on user when user is alive again

    
usr cmd_target(id,command2,2)
    
client_print(usr,print_chat"[AMXX] %s is no longer cloaked. "name)
    
set_user_rendering(usr,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255)


    if(
is_user_alive(usr))
    {
        
set_user_rendering(usr,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255)
    }
    
//I doubt I actually need this, but its better to be safe rather than *CRASH*

    
usr cmd_target(id,command3,2)
    
client_print(usr,print_chat"[AMXX] %s is now semi-cloaked. "name)
    
set_user_rendering(usr,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,128)

    if(
is_user_alive(usr))
    {
        
set_user_rendering(usr,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,128)
    }
    
//this line of code will refresh the cloak on user when user is alive again
    
    
return PLUGIN_HANDLED
}

/*
    new szarg1[33], szalpha[8], szarg3[8], bool:mode
    read_argv(1,szarg1,32)
    read_argv(2,szalpha,7)
    read_argv(3,szarg3,7)
    new ialpha = str_to_num(szalpha)
    if(equal(szarg3,"on"))
        mode = true

        new pid = cmd_target(id,szarg1,2)
        if(pid > 0) {
            hasinvis[pid] = mode
            if(mode) {
                        client_print(pid,print_chat,"-[EVIL]- %s is now cloaked ",name)
                        set_user_rendering(pid,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,ialpha)
            }
            else {
                      client_print(pid,print_chat,"-[EVIL]- %s is no longer  ",name)
                      set_user_rendering(pid,kRenderFxNone,0,0,0,kRenderNormal,ialpha)
            }
        }
    }

    return PLUGIN_HANDLED
}
}
*/ 

This is your supposed arguments: ,"<name|#userid|steamid> <alpha> <on/off>"
yet you use all three as if they are all player names/userids/steamids.

You technically are only requiring two of the three arguments too.

HLM 06-24-2009 18:55

Re: need help with my plugin...
 
seeing is my current problem, my problem right now is finding out why it doesnt work.. this plugin is simply making a user 'cloaked' by setting the rendering to either on half or off... but I dont know how to do that..


All times are GMT -4. The time now is 15:37.

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