Raised This Month: $ Target: $400
 0% 

Weird behavior of '?' operator..


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 08-20-2013 , 04:23   Weird behavior of '?' operator..
Reply With Quote #1

So i tried using '?' operator in normal public functions ( previously i was using in formatex only )

DOESNT COMPILES ( error below from the return line to the '?' operator line )
Code:
error 029: invalid expression, assumed zero
PHP Code:
public SomeFunction(player)
{
    if(!
IsPlayer(player))
        return 
PLUGIN_HANDLED
        
    
(gi_PlayerMoney[player] < 3000) ? (gi_PlayerItem[player] = false) : (gi_PlayerMoney[player] -= 3000)
    
    ..... 
some more code

COMPILES AND WORKS

PHP Code:
public SomeFunction(player)
{
    if(!
IsPlayer(player))
    {
        return 
PLUGIN_HANDLED
    
}
    
    (
gi_PlayerMoney[player] < 3000) ? (gi_PlayerItem[player] = false) : (gi_PlayerMoney[player] -= 3000)
    
    ..... 
some more code

I dont usually put { } for 1 line like return , and never got that prob ...
Its a bug or something ?
__________________
Preparing to release my plugins..

Last edited by r0ck; 08-20-2013 at 04:24.
r0ck is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:52.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode