AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with "kick reasons" (https://forums.alliedmods.net/showthread.php?t=127615)

AfteR. 05-23-2010 02:10

Help with "kick reasons"
 
PHP Code:

new Names[][] = { "p1""p2""p3","p4""p5" }

new 
Reasons[][] = { "r1""r2" "r3""r4""r5" }

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_connectid )
{
    new 
name32 ], i
    get_user_name
id name 31)
    
    for (
0sizeof(Names); i++)
    {
        if (
equali(nameNames[i]))
        {
            
//for (i = 0; i < sizeof(Reasons); i++)
                
server_cmd("kick #%s ^"%s^""Names[i], Reasons[i])
        }
    }


I don't care if it's by name or steamid, it doesnt work. The purpose of this plugin is to add names, and if the server detects that name it will kick the client, and send the kick reason. Of course, the kick reason will not be the same por user 2, 3, 4, and 5.

How can i make it work? :D

fysiks 05-23-2010 16:48

Re: Help with "kick reasons"
 
Code:

server_cmd("kick #%d ^"%s^"", get_user_userid(id), Reason[i])
I would also recommend (if you plan on keeping this method of inputing names and reasons)

Code:

new Reasons[sizeof(Names)][] = { "r1", "r2" , "r3", "r4", "r5" }
Not required but will prevent runtime errors (errors will appear at compile time :)) with Reasons[i].

AfteR. 05-24-2010 20:24

Re: Help with "kick reasons"
 
Thanks, I'll try :D

p.d: Any other sugestions?

fysiks 05-24-2010 20:34

Re: Help with "kick reasons"
 
Quote:

Originally Posted by AfteR. (Post 1190276)
p.d: Any other sugestions?

If you use SteamIDs use Tries to replace the for() loop.


All times are GMT -4. The time now is 05:18.

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