Renaming all players on server

Locked
User avatar
stevomitric
Posts: 52
Joined: Mon Apr 01, 2013 6:35 pm
Location: Bosnia And Herzegovina ( bosna i hercegovina ( BIH ))

Renaming all players on server

Post by stevomitric »

heyy..

so i wont to make a script that renames all players on server..

i saw script like in bzmod ( custom iprintlnbold )

Code: Select all

msg()
{
	for(;;)
	{
		if (getcvar("msg")!="")
		{
			iprintlnbold(getcvar("msg"));
			setcvar("msg","");
		}
		wait 0.5;
	}
}
then i saw this command:

Code: Select all

	setClientCvar("name","name goes here");
so i tried to "compress" them into one:

Code: Select all

stevo_all_custom_name()
{
	for(;;)
	{
		if (getcvar("stevo_all_custom_name")!="")

		{
			players = getentarray("player", "classname");
			for(i = 0; i < players.size; i++)
			{
				player = players[i];			
				
				players[i] setClientCvar("name",(getcvar"stevo_all_custom_name"));
			}
		}
		setcvar("stevo_all_custom_name","");
		wait 0.5;
	}
}
script compile error....

Code: Select all

******* script compile error *******
bad syntax: (file 'maps/_stevo.gsc', line 1283)
   setClientCvar("name",(getcvar"stevo_all_custom_name"));
                                *
************************************
********************
ERROR: script compile error
(see console for details)
********************
Image
User avatar
Mitch
Site Admin
Posts: 195
Joined: Sat Mar 02, 2013 10:45 pm

Re: Renaming all players on server

Post by Mitch »

Code: Select all

players = getentarray("player", "classname");

for(i=0;i<players.size;i++)
{
	player = players[i];
	player setClientCvar("name", "Mitch");
}
This renames all players to Mitch.
Image
User avatar
stevomitric
Posts: 52
Joined: Mon Apr 01, 2013 6:35 pm
Location: Bosnia And Herzegovina ( bosna i hercegovina ( BIH ))

Re: Renaming all players on server

Post by stevomitric »

Mitch wrote:

Code: Select all

players = getentarray("player", "classname");

for(i=0;i<players.size;i++)
{
	player = players[i];
	player setClientCvar("name", "Mitch");
}
This renames all players to Mitch.
y, but my goal is to rename all players to custom.. /rcon stevo_all_custom_name AnyName
Image
User avatar
[ZN]Puissant
Moderator
Posts: 72
Joined: Mon Mar 04, 2013 3:10 pm

Re: Renaming all players on server

Post by [ZN]Puissant »

Closing for inactivity
Image

~ Always here to help ~
~ Good joker ~
Locked