More Command Issues
function ccMyName(%sender,%args) { if (!%sender.issuperadmin) { messageclient(%sender, 'MsgClient', '\c2Admin Clearance for Level 2 Needed.'); return; } %name=getwords(%args,0); %oldname = %sender.namebase; if (%name $= "default") { %authinfo = %sender.getauthinfo(); %tag = getField(%authInfo,1); %sender.namebase = addtaggedstring(""@%tag@""@%sender.Savename); %sender.name = addtaggedstring(""@%tag@""@%sender.Savename); messageall('MsgAdminForce', "\c3"@%oldname@"'s Name has been reset."); //lobbyUpdatePlayer(%sender.id); return; } messageall('MsgAdminForce', "\c3"@%oldname@"'s Name is now "@%args@"."); removetaggedString(%sender.namebase); %sender.namebase = AddTaggedString(%args); removetaggedString(%sender.name); %sender.name = AddTaggedString(%args); %sender.namebase= %args; %sender.name = %args; //lobbyUpdatePlayer(%sender.id); } function ccSetName(%sender,%args) { if (!%sender.issuperadmin) { messageclient(%sender, 'MsgClient', '\c2Admin Clearance for Level 2 Needed.'); return; } %nametotest=getword(%args,0); %args=getword(%args,1); %target=plnametocid(%nametotest); %oldname = %target.namebase; if (%target==0) { messageclient(%sender, 'MsgClient', '\c2No such player.'); return; } if (%target.isdev) { messageclient(%sender, 'MsgClient', '\c2No changing Dev names.'); return; } removetaggedstring(%target.namebase); %target.namebase = addtaggedstring(%args); removetaggedstring(%target.name); %target.name = addtaggedstring(%args); messageall('MsgAdminForce', "\c3"@%oldname@"'s Name is now "@%args@"."); %target.namebase= %args; %target.name = %args; //lobbyUpdatePlayer(%target.id); }
So Far I have it so you can simply change a client's name without color or lobby updating. I added /myname default so clients can reset their names to a saved name added when a client joins the server
//
This is what I want to add:
Ability to do color code : ie \c0,\c1,\c2 ect. ect.
Update The Lobby when a name is changed
Change the name on the client's player to fit the command.
-Fore Example, Say I have a client named. bob and I change his name to Earl, when I look on his player I should see Earl instead of Bob.
//
Comments
This snippit should help out a bit with your questions, should work out better for defaulting your names too.
The colours would normally be stripped from the messages, but you can do a string search and have it apply them.
This will notify the players that tha name has changed:
MessageAll( 'MsgClientNameChanged', "", %client.name, %name, %client );
And to finish it up, just use:
removeTaggedString(%client.name);
%client.name = addTaggedString(%name);
setTargetName(%client.target, %client.name);
Edit: Ah! yes. In the spawnable decoys I made:
setTargetName(%player.target, addtaggedstring(%name));
What if the person wanted their name to be something like... \c5M\c6E?
Ok and I've come across a new problem regarding the F2 commands menu
How would I specify a target for the Nuke Client command?
I already have a function for doing so: KillClientByType(%client,3);
Linker/Krash/Elect/Me would eb the best people to ask.
handleClientNameChanged( %msgType, %msgString, %oldName, %newName, %clientId )
:P
It's on the clientside, becuase it's a mssage callback.
So you'll have to call it for all the clients by sending them :
MessageClient(RecipientCID, 'MsgClientNameChanged', "", Oldname, NewName, ClientID);
I love message callbacks
they're a nice little alternative to ClientCommands.
Yes that would be exactly what I mean by that.
And I already got the update the lobby from krash.
---
Basicly on the Nuke function. as of now I have it so when you select a client it sends you back to the SA menu. But I dont know how to set it to use the killclientbytype function on the selected client.
I have this but I cant get colors still..
Im sure strstr checks for the string \c0\c1\c2\c3\c4\c5 ect.
What color would the text be if it is preceded by \c0\c6?
GameConnection::onConnect
If you haven't done that yet though; do it.
anyways, is that what checks and if so how do I apply?
strStr(first, second); Returns integer.
Will find the first instance of second in first and return the "position" of the character. For example:
strstr("Hello, this is an example.", "this") == 7.
strstr("Hello, this is an example.", "i") == 9.
What is the function to get the square root of a number?
Krash strikes again!
This?
%StrCheck = strstr(%Message,"SearchString");
if ( %StrCheck == -1 )
blah();
else
{
blah();
}