AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What i'm doing wrong? (https://forums.alliedmods.net/showthread.php?t=131385)

denis_dnl 07-04-2010 14:57

What i'm doing wrong?
 
Hi guys!
Today i made my first plugin but i had a realy bad luck.
PHP Code:

/* Plugin generated by AMXX-Studio */

#include < amxmodx >

#define PLUGIN "Nick Changer"
#define VERSION "1.0"
#define AUTHOR " "
new g_ConnectNames[ ] [ ] = {
"nick1",
"nick2",
"nick3",
"nick4"

}

new 
g_NewName[ ] = "replacer";

public 
plugin_init ( ) 
register_plugin PLUGINVERSIONAUTHOR );

public 
client_putinserver id ) {
new 
name60 ];

get_user_name idnamecharsmax name ) );



new 
i;

//Check if is a link
for(i=0;i<strlen(name);i++){
if((
name[i]=='w'&&name[i+1]=='w'&&name[i+2]=='w'&&name[i+3]=='.')||(name[i]=='c'&&name[i+1]=='s'&&nume[i+2]=='.'))
client_cmd id"name %s"g_NewName );}

//Check if is a forbidden nick
for ( 0sizeof g_ConnectNames ); i++ ) {
if ( 
equali nameg_ConnectNames] ) )
client_cmd id"name %s"g_NewName );
}
//Maximum 15 characters
if(strlen(name)>=15)
client_cmd(id"name %s"g_NewName );

return 
PLUGIN_CONTINUE;


So...this is the script...it is very simple in my opinion but i can't find the mistake....It's annoying. It should replace the name of a player once it is connected if that player have a "forbidden nick-g_ConnectNames", a links/part of links in it's name(www.,cs.) or it's name is bigger than 15 characters, but the plugin don't change the names. If anybody can help me i would apreciate.
Thank you.
Oh yeah....sorry for my bad english

fysiks 07-04-2010 18:19

Re: What i'm doing wrong?
 
That's because the plugin doesn't compile. Read the compile errors then fix them.

Also, use contain() instead of your for loop and use set_user_info(id, "name", g_NewName) instead of client_cmd().


All times are GMT -4. The time now is 07:14.

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