Raised This Month: $51 Target: $400
 12% 

Check boolean


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
undead52
Senior Member
Join Date: Dec 2016
Old 06-01-2019 , 07:40   Check boolean
Reply With Quote #1

why this isn't work even if boolean true, i tried g_bAwpRound == 1 too
PHP Code:
    else if(g_iRound 10 == || g_bAwpRound)
    {
        
give_item(id"weapon_awp")
    } 
undead52 is offline
thEsp
BANNED
Join Date: Aug 2017
Old 06-01-2019 , 07:53   Re: Check boolean
Reply With Quote #2

Add boolean tag to the variable. ( new bool:g_bAwpRound )
thEsp is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-01-2019 , 07:55   Re: Check boolean
Reply With Quote #3

it's an else if, probably some previous expression already got evaluated as true and the code never reached this one
__________________
<VeCo> is offline
undead52
Senior Member
Join Date: Dec 2016
Old 06-01-2019 , 07:56   Re: Check boolean
Reply With Quote #4

This how code looks. the problem i set boolean true but it doesnt works
PHP Code:
new bool:g_bAwpRound;

public 
func(id)
{
    if(
g_iRound 10 != 0)
        return 
PLUGIN_HANDLED;
    else if(
g_iRound 10 == || g_bAwpRound)
    {
        
give_item(id"weapon_awp")
    }


Ok i see it now. because it is about that return.
changed to now.
PHP Code:
    if(g_iRound 10 == || g_bAwpRound)
    {
        
give_item(id"weapon_awp")
    } 

Last edited by undead52; 06-01-2019 at 08:01.
undead52 is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-01-2019 , 08:02   Re: Check boolean
Reply With Quote #5

that doesn't make much sense, the first check will fail regardless, you probably want it like this

PHP Code:
    if(g_iRound 10 != && !g_bAwpRound
        return 
PLUGIN_HANDLED
    else
    { 
        
give_item(id"weapon_awp"
    } 
but yeah, no need for that return block structure
__________________

Last edited by <VeCo>; 06-01-2019 at 08:03.
<VeCo> is offline
Reply



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 23:24.


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