Raised This Month: $ Target: $400
 0% 

Name assign


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-06-2007 , 17:23   Name assign
Reply With Quote #1

Hi.I want to make a plugin that assign to a steam id an registerd name ! Blah blah you are on server type /namereg and in a file write
Code:
STEAM_0:0:123456 ; Alka
and i want when connect on server check for steam id and change player name from that line ;)(assigned name).If you enter with that registerd name and don't have that steam id assigned kick!

Thanks
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-06-2007 , 20:15   Re: Name assign
Reply With Quote #2

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
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-06-2007 , 20:31   Re: Name assign
Reply With Quote #3

I think you'r idea is good but!
1.Is spam my chat with messages : "Say '/namereg name' to register your name with your STEAMID!" but i already registerd.
2.I register with Alka and i enter on server with LoL with same steamid and nothing happens!
3.If i type twice with same name "/namereg" is not showing ("You may not register with this name, it has already been used.")
__________________
Still...lovin' . Connor noob! Hello

Last edited by Alka; 07-06-2007 at 20:33.
Alka is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-06-2007 , 21:51   Re: Name assign
Reply With Quote #4

Well, oops. I just wrote it up real quick, it'll give you an idea of how to do it anyways.

I've never actually used nvault in one of my plugins .

I'm pretty sure I'm using nvault_lookup improperly, I don't know for sure though. I'll look at again later and try testing it.

Last edited by stupok; 07-06-2007 at 21:54.
stupok is offline
Old 07-06-2007, 22:16
organizedKaoS
This message has been deleted by organizedKaoS.
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 07-07-2007 , 04:43   Re: Name assign
Reply With Quote #6

Yeah...is the same thing! I know how to make "kick thing"...
Thanks.

@stupok69 you can give a try if you want.I'd like to see you'r version.
__________________
Still...lovin' . Connor noob! Hello
Alka 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