Raised This Month: $ Target: $400
 0% 

Admin / Freeslot Rename + Announce


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Sleepwalker
Member
Join Date: Dec 2006
Old 12-12-2006 , 10:43   Re: Admin / Freeslot Rename + Announce
Reply With Quote #7

The Code Now looks like this.
Two problems left.

1. it's changeing the name of the admin 2 times.
first to: <name> - Admin
then to: <name> - Admin - Admin

2. It dosn't write out when a person comes online.

Code:

#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Admin Connect"
#define VERSION "0.8"
#define AUTHOR "Sleepwalker"
new g_iMsgSayText;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
g_iMsgSayText = get_user_msgid("SayText");
}
public client_authorized(id)
{
if (get_user_flags(id) != ADMIN_USER) {
new szAuthID[33], szUserName[33]
get_user_authid(id , szAuthID, 32)
get_user_name(id, szUserName, 32)
if (get_user_flags(id) & ADMIN_ADMIN) {
client_cmd(id, "setinfo name ^"%s - TOO.Admin^"", szUserName)
}else{
client_cmd(id, "setinfo name ^"%s - TOO.Freeslot^"", szUserName)
}
}else{
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public client_putinserver(id){
new iPlayers2[32], iNum2, i2
get_players(iPlayers2, iNum2)
for(i2 = 0; i2 <= iNum2; i2++)
{
new x2 = iPlayers2[i2]
if (!is_user_connected(x2) || is_user_bot(x2) || is_user_hltv(x2)) continue;
if (get_user_flags(id) != ADMIN_USER) {
new szMessage[164]
new szAuthID2[33], szUserName2[33]
get_user_authid(x2 , szAuthID2 , 32)
get_user_name(x2, szUserName2, 32)
format(szMessage, 163, "^x04%s connected", szUserName2 , szAuthID2)
message_begin( MSG_ONE, g_iMsgSayText, {0,0,0}, x2 )
write_byte ( x2 )
write_string( szMessage )
message_end ()
}else{
return PLUGIN_CONTINUE
}
}
return PLUGIN_CONTINUE
}
public client_infochanged(id){
new newname[32],oldname[32]
get_user_info(id,"name",newname,31)
get_user_name(id,oldname,31)
if (!equal(newname,oldname)){ // make sure name was changed
if (get_user_flags(id) != ADMIN_USER) {
if (get_user_flags(id) & ADMIN_ADMIN) {
client_cmd(id, "setinfo name ^"%s - TOO.Admin^"", newname)
client_print(id,print_chat,"Your name has been changed to '%s - TOO.Admin'",newname)
}else{
client_cmd(id, "setinfo name ^"%s - TOO.Freeslot^"", newname)
client_print(id,print_chat,"Your name has been changed to '%s - TOO.Freeslot'",newname)
}
}else{
client_print(id,print_chat,"Your name has been changed to '%s'",newname)
}
}
return PLUGIN_CONTINUE
}
Sleepwalker is offline
 



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 06:53.


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