AlliedModders

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

r00ted 12-14-2014 08:31

warning plugin
 
As i said, from unknow reason the plugin is not displaying reason why i warned someone, here is the code and sample what say

Code:
Code:

#include <amxmodx>
#include <amxmisc>

public plugin_init()
{
        register_plugin("Warning","1.2","r00ted")
        register_concmd("amx_givewarn","cmd_givewarn", ADMIN_RCON, "<userid><reason> - Give warn to player/admins")
}

public cmd_givewarn(id, level, cid)
{
        if(!cmd_access(id, level, cid,2)) {
                return PLUGIN_HANDLED
        }
        else {
                new igrac[32]
                read_argv(1, igrac, 31)
                new player = cmd_target(id, igrac, CMDTARGET_ALLOW_SELF || CMDTARGET_NO_BOTS)
               
                if (!player) {
                        return PLUGIN_HANDLED
                }
               
               
                new admin[32]
                read_argv(2, admin, 31)
                get_user_name(id, admin, 30)
                new reason[32];
                read_argv(3, reason, 31)
                client_print(id,print_console,"You give warn to %s",player)
                client_print(player,print_chat,"Admin %s give warn to you. reason: %s",admin, reason)
                client_print(0,print_chat,"Admin%s give warn to %s. reason: %s",admin, player, reason)
                return PLUGIN_HANDLED
        }
        return PLUGIN_HANDLED
}

Example what says:
Code:

Admin r00ted give warn to you.reason:
I been write amx_givewarn r00ted "rules" as reason, but not working... I'm thinking why?

zmd94 12-14-2014 08:49

Re: warning plugin
 
You have to write amx_givewarn in the console as your code:
Code:

register_concmd("amx_givewarn","cmd_givewarn", ADMIN_RCON, "<userid><reason> -
By the way, are you the author of this code?

r00ted 12-14-2014 08:49

Re: warning plugin
 
Yes, i know but not working, now showing "reason", if you understand me.

zmd94 12-14-2014 09:28

Re: warning plugin
 
1 Attachment(s)
AMX Warn 2.0

How to use it?

Just open your console, then write amx_warn Fateh94 "Server rules!".

amx_warn = The command.
Fateh94 = Player name.
"Server rules!" = The reason. Please write the reason in " ".

Screenshots:

http://img.ctrlv.in/img/14/12/14/548d9e586302c.jpg

http://img.ctrlv.in/img/14/12/14/548d9e684320c.jpg

fysiks 12-14-2014 12:29

Re: warning plugin
 
You must use a bitwise OR for the cmd_target() flags, not a logical OR.

zmd94 12-14-2014 12:36

Re: warning plugin
 
May you explain a little bit about it?

Edit: Nevermind, I got it. ;)
Code:

#define CMDTARGET_OBEY_IMMUNITY (1<<0)
#define CMDTARGET_ALLOW_SELF    (1<<1)
#define CMDTARGET_ONLY_ALIVE    (1<<2)
#define CMDTARGET_NO_BOTS        (1<<3)

I will update the code.


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

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