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

bracket error?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
infek
Senior Member
Join Date: May 2009
Location: Behind you
Old 04-04-2010 , 04:43   bracket error?
Reply With Quote #1

invalid expression assumed zero
error on "else"
Code:
ActionPoop(id, ent)
{
 static property1[5];
 GetProperty(ent, 1, property1);
 new Float:team = str_to_float(property1);
 {
  if(team <= 1.0)
  {
                     set_task(0.5, "Poop", id, _, _, "b");
  }
  else if(team == 2.0)
  {
   if(get_user_team(id) == 1)
   {
                                set_task(0.5, "Poop", id, _, _, "b");
   }
   else if(get_user_team(id) == 2)
   {
    set_hudmessage(255, 0, 0, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
    show_hudmessage(id, "Chachaaaaaa");
   }
  }
  else if(team == 3.0)
  {
   if(get_user_team(id) == 2)
   {
                                set_task(0.5, "Poop", id, _, _, "b");
   }
   else if(get_user_team(id) == 1)
   {
  set_hudmessage(255, 0, 0, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
  show_hudmessage(id, "Chacha!");
   }
  }
 }
 else <-- THIS IS THE ERROR
 {
  set_hudmessage(255, 0, 0, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);
  show_hudmessage(id, "Chachaaaaa");
 }
}
__________________
"Domo Arigato, Mr. Roboto!"
PM me if you want to know a secret
infek is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-04-2010 , 04:53   Re: bracket error?
Reply With Quote #2

You are wrong.
Ident properly your code and you can directly see where is the error.

Code:
ActionPoop(id, ent) {     static property1[5];     GetProperty(ent, 1, property1);     new Float:team = str_to_float(property1);
    { // USELESS BRACKET
    if(team <= 1.0)     {         set_task(0.5, "Poop", id, _, _, "b");     }     else if(team == 2.0)     {         if(get_user_team(id) == 1)         {             set_task(0.5, "Poop", id, _, _, "b");         }         else if(get_user_team(id) == 2)         {             set_hudmessage(255, 0, 0, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);             show_hudmessage(id, "Chachaaaaaa");         }     }     else if(team == 3.0)     {         if(get_user_team(id) == 2)         {             set_task(0.5, "Poop", id, _, _, "b");         }         else if(get_user_team(id) == 1)         {             set_hudmessage(255, 0, 0, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);             show_hudmessage(id, "Chacha!");         }     }
    } // <-- THIS IS THE ERROR
    else     {         set_hudmessage(255, 0, 0, gfTextX, gfTextY, gHudEffects, gfHudFxTime, gfHudHoldTime, gfHudFadeInTime, gfHudFadeOutTime, gHudChannel);         show_hudmessage(id, "Chachaaaaa");     } }
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 04-04-2010 , 20:15   Re: bracket error?
Reply With Quote #3

People don't indent their code properly, then they wonder why they have trouble finding the problem. -_-
Spunky is offline
Send a message via AIM to Spunky
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 04-04-2010 , 20:30   Re: bracket error?
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod View Post
You are wrong.
Ident properly your code and you can directly see where is the error.

Code:
code code code
That shouldn't be an error... nevermind, I miscounted the scope level.

BTW, @@ inside code tags highlights the line!!1! cool!

Last edited by Seta00; 04-04-2010 at 20:37.
Seta00 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-04-2010 , 20:31   Re: bracket error?
Reply With Quote #5

His indentation looks uniform. I'm guessing he copied the code from someone else's source and did his own editing and didn't get rid of the brackets.

Edit: I was looking at Connors code post.
__________________

Last edited by Bugsy; 04-04-2010 at 20:52.
Bugsy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-05-2010 , 04:49   Re: bracket error?
Reply With Quote #6

Quote:
Originally Posted by Seta00 View Post
[s]BTW, @@ inside code tags highlights the line!!1! cool!
Doesn't work with php tag, works with small and pawn tags, but then if you make a copy/paste from the begining to the end code can be messed up (1 line for all code)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 22:10.


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