Raised This Month: $ Target: $400
 0% 

Compile help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Stickreid
Junior Member
Join Date: Jul 2006
Old 07-16-2006 , 13:02   Compile help
Reply With Quote #1

I'm new to this stuff so please dont flame... I'm trying to compile my first plugin that I made following this tutorialhttp://wiki.alliedmods.net/index.php...od_X_Scripting I save it as an .sma file and run AMXXPC compile.exe all the .sma files that came with amx compile fine but this one gets like 5 errors... i followed evertything on the intro fine but now it wont compile. Heres my code
Code:
#include <amxmodx> #include <amxmisc> #include <fun> #define PLUGIN "life" #define VERSION "1.0" #define AUTHOR "Stickreid" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_concmd("amx_life", "cmd_life", "<target>") } public cmd_life(id, level, cid) {     if (!cmd_access(id, level, cid, 3))        return PLUGIN_HANDLED         new arg1[24]     new arg2[4]         read_argv(1, arg1, 23)     read_argv(2, arg1, 3)         new Health = str_to_num(arg2)         if (arg1[0] == '@')     {         new team = 0         if (equali(arg[1], "T"))         {             Team = 2         else if (equali(arg[2], "CT")) {             Team = 1         }         new players[32], num         get_players(players, num)         new i         for (i=0 i<num; i++)         {             if (!team)             {                 set_user_health(players[i], Health)             } else {                  if (get_user_team(players[i]) == Team)                  {                        set_user_health(players[i], Health)                  }             }         }        } else {            new player = cmd_target(id, Arg1, 1)         if (!player)         {              console_print(id, "Nigga... PLZ %s is not on t3h server!", Arg1)              return PLUGIN_HANDLED         } else {             set_user_health(player, Health)         }     }         return PLUGIN_HANDLED }
Please tell me what's wrong..

Last edited by Stickreid; 07-16-2006 at 13:08.
Stickreid is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 07-16-2006 , 15:40   Re: Compile help
Reply With Quote #2

register_concmd("amx_life", "cmd_life", "<target>")
Compiler thinks that the value <target> defines the needed access for the command,
not a description for amx_help. I did not find a way to make a command not need
any rights AND have a description in amx_help at the same time, yet, if it is possible at all.
Have a look: http://www.amxmodx.org/funcwiki.php?...ncmd&go=search
Replace the above with:
register_concmd("amx_life", "cmd_life")

EDIT: I found way to make it accessable to everyone AND have amx_help entry!
Use:

register_concmd("amx_life", "cmd_life", 0, "<target>")
"0" is the tricky number that allows everyone access

Second problem: As it stands there you read the first argument (arg1) two times.
Replace


read_argv(1, arg1, 23)
read_argv(2, arg1, 3)



with


read_argv(1, arg1, 23)
read_argv(2, arg2, 3)




Then you read wrong arguments again:


if (equali(arg[1], "T")) {
Team = 2
else if (equali(arg[2], "CT")) {
Team = 1
}



Replace it with:


if (equali(arg2[1], "T")) {
Team = 2
else if (equali(arg2[2], "CT")) {
Team = 1
}




I think that was it.
__________________
EAT YOUR VEGGIES

Last edited by Silencer123; 07-17-2006 at 07:45.
Silencer123 is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 07-16-2006 , 22:34   Re: Compile help
Reply With Quote #3

Quote:
Originally Posted by Silencer123
EDIT: I found way to make it accessable to everyone AND have amx_help entry!
Use:

register_concmd("amx_life", "cmd_life", 1, "<target>")
"1" is the tricky number that allows everyone access
actually "1" would be ADMIN_IMMUNITY and "0" is for everyone (as it says in amxconst.inc)
__________________
plop
p3tsin is offline
Silencer123
Veteran Member
Join Date: Jul 2006
Old 07-17-2006 , 07:45   Re: Compile help
Reply With Quote #4

I see, you are right *edits*
__________________
EAT YOUR VEGGIES
Silencer123 is offline
TheNewt
Donor
Join Date: Jun 2006
Location: Where I live.
Old 07-17-2006 , 14:51   Re: Compile help
Reply With Quote #5

ADMIN_ALL works too, +)
__________________
Quote:
toe3_ left the chat room. (G-lined (AUTO Excessive connections from a single host.))
TheNewt is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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