Raised This Month: $ Target: $400
 0% 

Checking player's name?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arion
Senior Member
Join Date: Mar 2007
Old 07-16-2007 , 13:44   Re: Checking player's name?
Reply With Quote #1

Thank you stupok69, things are a little more clear now..

But (always have a "but") how to make to execute a command on client of his name is, for example, L0Lo?


Code:
        for (i = 0; i < 32; i++)
            {
                if (name[0] == 'L' &&
                    name[1] == '0' &&
                    name[2] == 'L' &&
                    name[3] == 'o')
            
                    {
                        client_cmd (id, "name Arion")
                    }
            }
This "32" is number of players, which I don't know how to get

How to make the "for" to run on every player connected?




PS: I'd already read these two tutorials but I still have difficulty to understand commands that have lots of arguments
command (id, name, 1, et cetera)

o.O

Last edited by Arion; 07-16-2007 at 13:46.
Arion is offline
Send a message via MSN to Arion
stupok
Veteran Member
Join Date: Feb 2006
Old 07-16-2007 , 15:18   Re: Checking player's name?
Reply With Quote #2

The plugin below will check if a player's name is "Lol0". It will only check the player's name when he joins the server or changes his name. If it's "Lol0" then it will change his name to "Arion".

PHP Code:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "stupok69"


public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
}

public 
client_infochanged(id)
// This is called whenever a client changes an "info"
// the client's name is an "info"

// Store which client caused client_infochanged()
// in the variable id
{
    new 
name[32]
    
    
get_user_info(id"name"name31)
    
// Call this function for client #id
    
    // Get "name" info
    
    // Store the result in the name array
    
    // The last element of name is 31
    
    
if(equal(name"Lol0"))
    
// Compare the contents of name with "Lol0"
    
{
        
client_cmd(id"name Arion")
        
// Call this function for client #id
        
        // Execute this command: "name Arion"
    
}


Last edited by stupok; 07-16-2007 at 15:21.
stupok 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 21:28.


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