Forum

> > CS2D > Scripts > Rename after join
Forums overviewCS2D overview Scripts overviewLog in to reply

English Rename after join

2 replies
To the start Previous 1 Next To the start

old Rename after join

limonata
User Off Offline

Quote
Hello all I did this lua in this lua when the player joins the server him name changes to [YDE] (playerName) but it didnt work when I joined server my name sets to "Player" where is my mistake?

1
2
3
4
5
6
7
8
9
10
tag = "[YDE]"
addhook("join","tagg")
function tagg(id)
if player(id,"exists") then
for i = 1,32 do
parse("setname "..i.. "[YDE]" ..player(id,"name"))
return 1
end
end
end

old Re: Rename after join

EngiN33R
Moderator Off Offline

Quote
Seriously?

Here's what's wrong:
• You set the name of every existing player on the server to [YDE] %name of the newly joined player%
• You declare the variable tag which is never used.
• You check if the player exists, which is redundant.
• To go back to point one, you use a loop that's absolutely unnecessary.

Also, why do you return 1? Functions with the join hook don't return anything.

1
2
3
4
5
tag = "[YDE]"
addhook("join","tagg")
function tagg(id)
	parse("setname "..id.." "..tag..player(id,"name"))
end
edited 1×, last 20.02.13 04:54:54 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview