View Single Post
  #12  
Old 05-05-2011, 08:26 PM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Quote:
Originally Posted by Tigairius View Post
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 View Post
Who scripted that twaina?
Quote:
Originally Posted by Emera View Post
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.
Reply With Quote