Player.name help

Started by Shovon^, Sep 29, 2016, 10:05 AM

Previous topic - Next topic

Shovon^

I want a help about this
if ( player.name !== Shovon^ )   MessagePlayer("u r not authorized ",player); Now I want this to be two or more names how do I do it??
Iam the best and i only believe in Allah

Conatact me here on IRC:  #shovon^ @LUnet

Anik

#1
@Shovon^ the thing you are doing is going to give error. Your name needs to be a string. and its player.Name not player.name.
Use like this
example:
if ( player.Name != "Shovon^" ||  player.Name != "[DS]Anik" ||  player.Name != "Anik" ||  player.Name != "Another_name_here" ||  player.Name != "Just_repeat_like_this")   MessagePlayer("u r not authorized ",player);

Shovon^

Thnx Anik my problem solved
Iam the best and i only believe in Allah

Conatact me here on IRC:  #shovon^ @LUnet

KAKAN

#3
Another problem is that you were using !== mark teh 2nd =, in JS, it is an alias for equality check In squirrel, idk what it does.
:edit: Thanks to Thijn, I've corrected it. In squirrel too, it does the same.
oh no

Kewun

you shouldnt be using if player.Name security
what if someone joins as your nick and uses your commands

Cool

Quote from: Kewun on Sep 29, 2016, 02:00 PMyou shouldnt be using if player.Name security
what if someone joins as your nick and uses your commands
Wrong every server has security no server allow cmd using if he is not login

Kewun

Did not understand your english but i think you do not know what i mean.

KAKAN

Quote from: Kewun on Sep 29, 2016, 02:11 PMDid not understand your english but i think you do not know what i mean.
Two players can't join with the same nick. And don't you think he would have something to do? Like changing the name...
oh no

Kewun

but i mean when he leaves the server, other troll can join with his name, and troll plrs

Thijn

Quote from: KAKAN on Sep 29, 2016, 01:19 PMAnother problem is that you were using !== mark teh 2nd =, in JS, it is an alias for instanceof. In squirrel, idk what it does.
!== most certainly does not mean instanceof in any language, including JS.

For weakly typed languages (like JS and squirrel, but also PHP) the === operator means equal value AND equal type.

For example:
if ( "1" == 1 ) will return true
if ( "1" === 1) will return false, since the type (string vs int) does not match.

KAKAN

#10
Quote from: Thijn on Sep 29, 2016, 04:38 PM
Quote from: KAKAN on Sep 29, 2016, 01:19 PMAnother problem is that you were using !== mark teh 2nd =, in JS, it is an alias for instanceof. In squirrel, idk what it does.
!== most certainly does not mean instanceof in any language, including JS.
Oh yeah, I forgot, it was something like equality check :D
But, still then do you think someone would care for it?
oh no