Raised This Month: $ Target: $400
 0% 

Help! Im nwbie


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 08-16-2009 , 14:20   Re: Help! Im nwbie
Reply With Quote #1

I started with what you posted but when i compile shows me an error on line 24 (iTarget = cmd_target (id, szArg, CMDTARGET_ALLOW_SELF))
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-16-2009 , 18:09   Re: Help! Im nwbie
Reply With Quote #2

What's the error? It would be much quicker if you post your code .
__________________
fysiks is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 08-17-2009 , 21:51   Re: Help! Im nwbie
Reply With Quote #3

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Obligator"
#define VERSION "1.0"
#define AUTHOR "Mxnn"

public plugin_init()
{
    register_plugin (PLUGIN, VERSION, AUTHOR)
    register_concmd("myfunction", "cmdMyFunction", ADMIN_LEVEL_B, "<name>")
}

public cmdMyFunction(id,level,cid)
{
    if( !cmd_access(id,level,cid,2) ) 
    { 
        return PLUGIN_HANDLED
    }
    
    new szArg[32], iTarget
    read_argv(1, szArg, 31)
    
    iTarget = cmd_target(id, szArg, CMDTARGET_ALLOW_SELF) 
    
    if(iTarget)
    {
        client_cmd (szArg, "say you are the best")
        console_print (id, "[AMXX] Player %s was obligated", iTarget)
        client_print (0, print_chat, "ADMIN %s obligates %s", id, iTarget)
        
    }
    return PLUGIN_HANDLED
}
This is the plugin and.. the errors are "Error: Undefined symbol "CMDTARGET_ALLOW_SELF" on line 24
Error: Argument type mismatch (argument 1) on line 28
Error: Argument type mismatch (argument 1) on line 29

NOTE: I must to define "CMDTARGET_ALLOW_SELF" ? (#define CMDTARGET_ALLOW_SELF) ?
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-17-2009 , 22:16   Re: Help! Im nwbie
Reply With Quote #4

You shouldn't get any errors concerning the defining of CMDTARGET_ALOW_SELF, it's included in <amxmisc>. Instead of it, however, you can use just an integer. Look in your /includes/amxmisc.inc.

As far as the other errors:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Obligator"
#define VERSION "1.0"
#define AUTHOR "Mxnn"

public plugin_init()
{
    
register_plugin (PLUGINVERSIONAUTHOR)
    
register_concmd("myfunction""cmdMyFunction"ADMIN_LEVEL_B"<name>")
}

public 
cmdMyFunction(id,level,cid)
{
    if( !
cmd_access(id,level,cid,2) )
    {
        return 
PLUGIN_HANDLED
    
}

    new 
szArg[32], iTarget
    read_argv
(1szArg31)

    
iTarget cmd_target(idszArgCMDTARGET_ALLOW_SELF)

    if(
iTarget)
    {
        new 
szTargetName[32], szAdminName[32]
        
        
get_user_name(iTargetszTargetName31)
        
get_user_name(idszAdminName31)
        
        
/* this     \/     should be "id" or "iTarget", I don't know what you want */
        
client_cmd(iTarget"say you are the best")
        
        
console_print (id"[AMXX] Player %s was obligated"iTarget)
        
client_print (0print_chat"ADMIN %s obligates %s"szAdminNameszTargetName)

    }
    return 
PLUGIN_HANDLED

__________________
fysiks is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 08-17-2009 , 23:18   Re: Help! Im nwbie
Reply With Quote #5

I have a question.. Why do you put sz in each of the var names? (szAdminName, szTargetName) It's not requiered.. or it is?

And, in the CMDTARGET_ALLOW_SELF the compiler shows me an error yet.. I copy and paste your code, and shows me an error.. It would be the compiler?

Last edited by Mxnn; 08-17-2009 at 23:26.
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-17-2009 , 23:40   Re: Help! Im nwbie
Reply With Quote #6

"sz" is not required. I use it to remind myself that it is a zero-terminated string.

"i" for integer like iTarget.

What compiler are you using? Are you using your own local compiler?

CMDTARGET_ALLOW_SELF is defined in amxmisc.inc
__________________
fysiks is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 08-17-2009 , 23:47   Re: Help! Im nwbie
Reply With Quote #7

Nono, i using the amxx compiler.. Tries to compile and you'll see error.. I wont:
When admin types in his console "amx_obligated <name>" that user says "you are the best"
And in the admin console shows "Player <name> was obligated" and in the server (in the chat) appears "Admin <admin> obligates <name>".. Only that
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-17-2009 , 23:55   Re: Help! Im nwbie
Reply With Quote #8

Either use the webcompiler or replace CMDTARGET_ALLOW_SELF with 2 or use just 0 to not allow using the command on yourself.

Read about cmd_tartget().
__________________
fysiks is offline
Mxnn
Veteran Member
Join Date: Aug 2009
Location: AT MY HOME
Old 08-18-2009 , 00:05   Re: Help! Im nwbie
Reply With Quote #9

I compile and compiles.. But exist other error..

When y put in the console "amx_obligated" the plugin works on me! And i not put any name.. And in the admin console appears "[AMXX] Player MAXIIIIIIIIIII was obligated" (that i was wanted) but in the chat appears "[AMXX] ADMIN" and don't shows the admin name .. I change the szAdminName to id.. It s okey?
Mxnn is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-18-2009 , 01:01   Re: Help! Im nwbie
Reply With Quote #10

Quote:
Originally Posted by Mxnn View Post
I compile and compiles.. But exist other error..
What is the error.

Quote:
Originally Posted by Mxnn View Post
When y put in the console "amx_obligated" the plugin works on me! And i not put any name..
That's not possible with my code.

Quote:
Originally Posted by Mxnn View Post
I change the szAdminName to id.. It s okey?
No, that is not Okay. "id" is an integer not a string.

------------------------------------------

Ok, so you never changed the command name. If you used my code as is there does not exist the function amx_obligated.


I updated the code to match what you believe it actually says:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Obligator"
#define VERSION "1.0"
#define AUTHOR "Mxnn"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("amx_obligated""cmdObligate"ADMIN_LEVEL_B"<name>")
}

public 
cmdObligate(id,level,cid)
{
    if( !
cmd_access(id,level,cid,2) )
    {
        return 
PLUGIN_HANDLED
    
}

    new 
szArg[32], iTarget
    read_argv
(1szArg31)

    
iTarget cmd_target(idszArg1)

    if(
iTarget)
    {
        new 
szTargetName[32], szAdminName[32]
        
        
get_user_name(iTargetszTargetName31)
        
get_user_name(idszAdminName31)
        
        
client_cmd(iTarget"say you are the best")
        
        
console_print(id"[AMXX] Player %s was obligated"szTargetName)
        
client_print(0print_chat"ADMIN %s obligates %s"szAdminNameszTargetName)

    }
    return 
PLUGIN_HANDLED

Tested alone and with part of my name:

Code:
] amx_obligated 
Usage:  amx_obligated <name>
] amx_obligated fys
[AMXX] Player Fysiks was obligated
Fysiks : you are the best
__________________
fysiks 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 15:04.


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