Raised This Month: $ Target: $400
 0% 

Checking player's name?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stupok
Veteran Member
Join Date: Feb 2006
Old 07-16-2007 , 01:09   Re: Checking player's name?
Reply With Quote #1

Here's the code:

Code:
#include <amxmodx>

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

public plugin_init() // This is executed when the plugin starts, typically on a mapchange.
{
	register_plugin(PLUGIN, VERSION, AUTHOR) // This let's AMXX know some information about the plugin.
}

public client_putinserver(id)
// id is a number that identifies a user in your server
// if the maximum number of players in your server is 32, then id can be from 1 to 32
// this function is generally executed after client_connect() and client_authorized()
{
	new name[32]
	// this is an array, the typical way to store strings in AMXX
	
	get_user_name(id, name, 31)
	// this function grabs the name of the client who has caused
	// client_putinserver() to be executed
	
	// id is the client's identifying number, so the function knows
	// which client to get the name of
	
	// 31 is the last slot of the array "name"
	// the function will only get the first 32 characters of the user's name
	
	
	// let's say the client's name is "Gaben the Turtle"
	// in this case, name would look like this:
	//
	// name[0] = 'G'
	// name[1] = 'a'
	// name[2] = 'b'
	// name[3] = 'e'
	// name[4] = 'n'
	// name[5] = ' '
	// name[6] = 't'
	// name[7] = 'h'
	// name[8] = 'e'
	// name[9] = ' '
	// name[10] = 'T'
	// name[11] = 'u'
	// name[12] = 'r'
	// name[13] = 't'
	// name[14] = 'l'
	// name[15] = 'e'
	// name[16] = 0
	
	
	client_print(0, print_chat, "%s is connecting", name)
	
	// this function is used to send text messages to clients
	
	// id is 0 here, which means that no client is specified, so all clients
	// will receive the text message
	
	// print_chat means that the message will look like a chat message
	
	// "%s is connecting" is the message that will be sent
	// %s is used as a placeholder for a string, in this case for the array "name"
	
	// finally, name is put after the message so %s can be replaced with the contents
	// of the array "name"
}
I suggest that you read these:

http://wiki.alliedmods.net/index.php/Pawn_Tutorial

http://wiki.alliedmods.net/index.php...od_X_Scripting
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