Raised This Month: $ Target: $400
 0% 

Plugin autokick players with the nick "Player"


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sysgame
New Member
Join Date: Mar 2010
Old 08-12-2011 , 09:53   Plugin autokick players with the nick "Player"
Reply With Quote #1

Hi all,

I try to create a plugin that will automatically kick players with the nickname "player" or "Player" but I have a little problem with the script ... Actually I started with programming Amx ..

Can someone help me?

Here is the script :

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Player Auto kick"
#define VERSION "1.0"
#define AUTHOR "SysCorp"

new reason;

reason="Merci de changer de pseudo / Please change nickname";

public 
plugin_init()
{
    
register_concmd("amx_kick""cmdKick"ADMIN_KICK"<name or #userid> [reason]")
    
}

public 
auto_kick(id) {
    
    new 
name[32];
    
get_user_name(idname31)
    
    if(
name == "player")
        {
            
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")"namereason)
            
server_cmd("kick #%d %s"namereason)
        }
    

sysgame is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-12-2011 , 11:03   Re: Plugin autokick players with the nick "Player"
Reply With Quote #2

Code:
#include < amxmodx > public client_putinserver( id ) {     new szName[ 8 ];     get_user_name( id, szName, 7 );         if( equali( szName, "player" ) )     {         emessage_begin( MSG_ONE, SVC_DISCONNECT, _, id );         ewrite_string( "Please change your name." );         emessage_end( );     } }
__________________
xPaw is offline
Desikac
Senior Member
Join Date: Apr 2010
Location: Serbia
Old 08-12-2011 , 11:32   Re: Plugin autokick players with the nick "Player"
Reply With Quote #3

Name is a string, not an integer.
Desikac is offline
Send a message via MSN to Desikac Send a message via Skype™ to Desikac
sysgame
New Member
Join Date: Mar 2010
Old 08-12-2011 , 12:07   Re: Plugin autokick players with the nick "Player"
Reply With Quote #4

oki tyvm for your help
sysgame is offline
sysgame
New Member
Join Date: Mar 2010
Old 08-12-2011 , 13:09   Re: Plugin autokick players with the nick "Player"
Reply With Quote #5

Now I have a file that contains all of the nickname and I want to make a loop of this type

This is correct?

PHP Code:
new g_array_created;
// Arrays
new Array:g_spam;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Create the Array
    
g_spam ArrayCreate(321)
    
g_array_created true
    register_dictionary
("nickname.txt")
}

public 
client_connect(id)
{    
    new 
szName];
    
get_user_nameidszName);
   
   for(new 
0ArraySize(g_spam); i++)
        {
    
ArrayGetString(g_spamibuffer31);
    if( 
equaliszNameg_spam[i] ) )
    {
         
emessage_beginMSG_ONESVC_DISCONNECT_id );
         
ewrite_string"Please change your name." );
         
emessage_end( );
    }
        }
        


Last edited by sysgame; 08-12-2011 at 13:28.
sysgame is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 08-12-2011 , 14:51   Re: Plugin autokick players with the nick "Player"
Reply With Quote #6

You don't understand what each function does it seems... and you didn't apply any logic either, where is the array actually assigned to the contents of the file ?

http://www.amxmodx.org/funcwiki.php < start here, all natives and stocks available are listed and briefly explained there... start by inputing register_dictionary to see what it actually does (which is nothing related to your needs).

For file reading functions there are tutorials you know, it wouldn't hurt to read them instead of blindly trying out stuff
__________________
Hunter-Digital 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 03:22.


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