AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check boolean (https://forums.alliedmods.net/showthread.php?t=316618)

undead52 06-01-2019 07:40

Check boolean
 
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")
    } 


thEsp 06-01-2019 07:53

Re: Check boolean
 
Add boolean tag to the variable. ( new bool:g_bAwpRound )

<VeCo> 06-01-2019 07:55

Re: Check boolean
 
it's an else if, probably some previous expression already got evaluated as true and the code never reached this one

undead52 06-01-2019 07:56

Re: Check boolean
 
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")
    } 


<VeCo> 06-01-2019 08:02

Re: Check boolean
 
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


All times are GMT -4. The time now is 11:35.

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