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

Boolean Issue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 06-20-2009 , 22:59   Boolean Issue
Reply With Quote #1

I did my search already, found nothing.

PHP Code:
new bool:TimerActive[64]

public 
OnClientPutInServer(client) {
     ...
     
TimerActive[client] = false
     
return Plugin_Continue
}

public 
Action:PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) {
     if(
TimerActive[client] == false) {
        ...
        }
        
TimerActive[client] = true
     
}
     return 
Plugin_Continue;
}

public 
PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) {
     ...
     if(
Timer5Active[victim] == true) {
        
Timer5Active[victim] = false
     
}
     return 
Plugin_Continue

For some reason when I spawn in the game, PlayerSpawn does not do what it should.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 06-20-2009 , 23:01   Re: Boolean Issue
Reply With Quote #2

for bools im pretty sure you dont do == false or == true.

lets say i got a bool called Statement.

if(Statement)
{
...
}

that would run when its true

if(!Statement)
{
....
}

that runs when its false
almcaeobtac is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 06-20-2009 , 23:02   Re: Boolean Issue
Reply With Quote #3

Quote:
Originally Posted by almcaeobtac View Post
for bools im pretty sure you dont do == false or == true.

lets say i got a bool called Statement.

if(Statement)
{
...
}

that would run when its true

if(!Statement)
{
....
}

that runs when its false

I'm pretty sure thats how you do it aswell.
Dragonshadow is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 06-20-2009 , 23:03   Re: Boolean Issue
Reply With Quote #4

I know how bools work, they work both ways last I checked, but as you two suggested, that was the first way I did it, but no luck so then I changed it.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 06-20-2009 , 23:07   Re: Boolean Issue
Reply With Quote #5

Did you declare who the client was in the events?
almcaeobtac is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 06-20-2009 , 23:07   Re: Boolean Issue
Reply With Quote #6

Yes.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 06-20-2009 , 23:08   Re: Boolean Issue
Reply With Quote #7

can you post the full code?
almcaeobtac is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 06-20-2009 , 23:23   Re: Boolean Issue
Reply With Quote #8

Thanks for the help, but I figured it out just now.
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 06-20-2009 , 23:34   Re: Boolean Issue
Reply With Quote #9

What was the problem? Im curious
__________________
almcaeobtac is offline
allenwr
Veteran Member
Join Date: Jan 2006
Location: The place where the karm
Old 06-20-2009 , 23:44   Re: Boolean Issue
Reply With Quote #10

Bad
PHP Code:
     if(!Timer5Active[client]) {
        new 
teamnum GetClientTeam(client)
        if((
teamnum == || teamnum == 3) && IsPlayerAlive(client)) {
            
CreateTimer(1.0RegenTimerDoclient)
        }
        
PrintToServer("valid bool and bool set to true")
        
Timer5Active[client] = true
    

Good
PHP Code:
    if((teamnum == || teamnum == 3) && IsPlayerAlive(client)) {
        if(!
Timer5Active[client]) {
            
CreateTimer(1.0RegenTimerDoclient)
            
Timer5Active[client] = true
            PrintToServer
("valid bool and bool set to true")
        }
    } 
__________________
Don't ever place an order with Vee Servers. This is why.
allenwr is offline
Send a message via ICQ to allenwr Send a message via Yahoo to allenwr
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 08:46.


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