Server admin name change - Cubescripting
#1
Ok so I have been sitting here messing in menus_multilayer.cfg try to get this new script that if your admin it sets $curname or $arg1 to 'administrator'. I don't really know cubescript but I have this which probably is not even close to being right.

alias adminname [ if (currole 1) [ $arg1 "administrator" ] [ $curname "administrator" ] ]

If anyone could help me, that would be great.I don't know its even possible but if not it was worth a try.Thanks
Thanks given by:
#2
so basically, you want it to detect which player has admin?
Without testing it, this will probably do the trick:
alias findadmin [
loop i 21 [
if (= (currole $i) 1) [alias adminname (findpn $i)] []
]]
Any time you enter the command /findadmin, it stores the admin's name in adminname.
Other scripts will also need to be used to make this more efficient.

Edit: Hm, looks like currole doesn't have the extended function I thought it did. This script will not do the job, but in that case, I don't know if any will.



A partial solution will detect if anyone claims admin, using tools.cfg:
add2conloop [
if_conline_has " claimed admin status" [alias adminname (at $conline 0)] []
]
But if you join a server where someone already has admin, it won't store their name.
Thanks given by:
#3
Er...
Dont listen to V-Man unless that is what you were wanting.
I have a couple special keybinds for something that you were describing.
alias sa [old_name = $curname, setadmin 1 $adpass; sleep 100 [name Admin]] //super admin
alias nu [setadmin 0; name $old_name] //normal user
bind "K" [sa]
bind "L" [nu]
To install, you would put the first two lines into your autoexec.cfg, and if you wanted them binded, add the second two. Replace $adpass with your admin password, and replace Admin with the name you want (with no spaces).

What this will do is when you use this script to claim admin, it will replace your current name with Admin, and when you use this script to un-claim admin, it will go back to your previous name.
The keybinds are:
K - Claims admin
L - Unclaims admin

If you want a menu item doing this, then add this into your menus_multiplayer.cfg.
Right under the line starting with "menuitemtextinput "Nickname: "
and right under the line starting with "newmenu "In-game admin""
add this code.
menuitem "Toggle admin" [if (= (currole) 1) [nu] [sa]]

Now back to your question, I gave you something that I thought superior. However, if you just want changing names quickly (and only if admin), add this to your autoexec.cfg.
alias adminname [ if (= (currole) 1) [ name "Administrator" ] [ name INSERTNAMEHERE ] ]
Now, I have little idea of what you wanted that script to do, however it acts like a name toggle. So type it if you are a admin, you will change your name to Administrator, type it when you are in normal player, you will change your name to INSERTNAMEHERE.

Go to #cubescript on irc.gamesurge.net to get more help :)
Thanks given by:
#4
Oh... To change your name when you claim admin?
Just get grenadier's claimadmin script and modify it to change your name when it successfully executes!
setadmin 1 (at $admin_pwd_list ...); alias old_name $curname; name Administrator
...
setadmin 0; name $old_name
Heh.
Thanks given by: