Quote:
Originally Posted by Tigairius
PHP Code:
//#CLIENTSIDE
function onPlayerChats() {
player.chat == "stealth" ? onTimeout() : (player.chat == "nostealth" ? setTimer(0) : NULL);
}
function onTimeout() {
hideplayer(0.1);
setTimer(0.1);
}
|
Can't say I'm a huge fan of that usage of
?:. It should be used when you are actually doing something with the returned value, like
temp.x = player.chat == "test" ? 132 : 22;. This way the operator maintains some semantic meaning.
In the case you have a statement where you don't intend on returning anything (like here), that seems like the perfect usage for a full
if statement.
Your usage of it seems more like golfing.
Quote:
Originally Posted by Emera
Who scripted that twaina?
|
Quote:
Originally Posted by Emera
Couldn't you have put that in the post?
|
As much as Twaina
really should have attributed whoever wrote the script, I feel like things are getting a little too confrontational.
The calmer the environment, the greater chance for productive conversation.