Raised This Month: $ Target: $400
 0% 

Name assign


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
stupok
Veteran Member
Join Date: Feb 2006
Old 07-06-2007 , 20:15   Re: Name assign
Reply With Quote #1

I think this will work, I haven't tested it or tried to compile it:

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

#include <amxmodx>
#include <nvault>

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

#define VAULT_NAME "alka_name_steamid"

public plugin_init()
{
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	register_clcmd("say /namereg", "register_name", _, "registers your name with your STEAMID")
}

public client_putinserver(id)
{
	set_task(1.0, "check_name", id)
}

public client_infochanged(id)
{
	set_task(1.0, "check_name", id)
}

public check_name(id)
{
	new name[32], steamid[32]
	
	get_user_name(id, name, 31)
	get_user_authid(id, steamid, 31)
	
	new vault = nvault_open(VAULT_NAME)
	new timestamp
	
	if(!nvault_lookup(vault, name, steamid, 31, timestamp))
	{
		new read_steamid[32]
		
		if(nvault_get(vault, name, read_steamid, 31))
		{
			if(!equal(read_steamid, steamid))
			{
				server_cmd("amx_kick #%i ^"You must change your name to enter this server!^"", get_user_userid(id))
			}
		}
		else
		{
			client_print(id, print_chat, "Say '/namereg name' to register your name with your STEAMID!")
			set_task(30.0, "check_name", id)
		}
	}
	
	nvault_close(VAULT_NAME)
}

public register_name(id)
{
	new name[32], steamid[32]
	
	get_user_name(id, name, 31)
	get_user_authid(id, steamid, 31)
	
	new vault = nvault_open(VAULT_NAME)
	new timestamp
	
	if(!nvault_lookup(vault, name, steamid, 31, timestamp)
	{
		if(!nvault_get(vault, name))
		{
			nvault_set(vault, steamid, name)
			client_print(id, print_chat, "Your name has been registered with you STEAMID successfully.")
		}
		else
		{
			client_print(id, print_chat, "You may not register with this name, it has already been used.")
		}
	}
	else
	{
		client_print(id, print_chat, "You have already registered your name.")
	}
	
	nvault_close(VAULT_NAME)
}
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