Raised This Month: $ Target: $400
 0% 

My first plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
SpArTaNN
New Member
Join Date: Jul 2009
Old 08-01-2009 , 08:52   Re: My first plugin
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
To make the disconnected player see some info you need to use the Half-Life engine command "kick" with a reason.

Also, very important, Learn to indent your code. It makes it much more easy for us (or anyone) to read and understand code.

Here ya go, try this:

PHP Code:
/*This plugin was made by SpArTaNN !
*With this plugin you can disconnect a specified player !
*Command: amx_disconnect
HF*/

#include <amxmodx>
#include <amxmisc>
public plugin_init()
{
    
register_plugin("Disconnect Player","1.0","SpArTaNN");
    
register_concmd("amx_disconnect","disconnect_ cmd",ADMIN_KICK,"- <jucator>");
}
public 
disconnect_cmd(id,level,cid)
{
    if(!
cmd_access(id,level,cid,2))
        return 
PLUGIN_HANDLED;

    new 
arg[32];
    
read_argv(1,arg,31);

    new 
player cmd_target(id,arg,9);
    if(!
player)
        return 
PLUGIN_HANDLED;

    new 
adminname[32],playername[32];
    
get_user_name(id,adminname,31);
    
get_user_name(player,playername,31);
    new 
userid_target get_user_userid(player)

    
// client_cmd(player,"disconnect");
    
server_cmd("kick #%d ^"%s^""userid_target"You have been kicked by an admin")
    
client_print(0,print_chat,"Admin %s: l-a deconnect pe %s",adminname,playername);

    return 
PLUGIN_HANDLED;

I added the "server_cmd()" command and commented your client_cmd() command. Oh, and indented your code .
Thanks Now I know some function
Thanks everybody for help
SpArTaNN is offline
 



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 18:19.


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