AlliedModders

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

ironskillz1 05-24-2013 12:19

Menu
 
When i Choose 0 it only starts 0.
But when i start 1 it starts 0 and 1
Why?

Code:
Code:

public TeamMenu( id )
{
 new szText[ 555 char ]
 formatex( szText, charsmax( szText ), "Team Menu")
 new menu = menu_create( szText, "TeamMenu_Handler" )
 
 menu_additem( menu, "\rT VS T", "0", 0 )
 
 menu_additem( menu, "\rCT VS T", "1", 0 )
 
 menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
 menu_display( id, menu, 0 )
}
public TeamMenu_Handler( id, menu, item )
{
 if( item == MENU_EXIT )
 {
  menu_destroy( menu )
  return PLUGIN_HANDLED
 }
 new data[ 6 ], iName[ 64 ], access, callback
 menu_item_getinfo( menu, item, access, data, charsmax( data ), iName, charsmax( iName ), callback )
 
 Team = str_to_num( data )
 
 set_task( 0.1,"StartGames", Team );
 
 return PLUGIN_HANDLED
}
public StartGames( )
{
 if( 1 <= Team )
 {
  ColorChat(id, GREY, "Started 1", Team)
 }
 
 if( 0 <= Team )
 {
  ColorChat(id, GREY, "Started 0", Team)
 }
}


akcaliberg 05-24-2013 17:21

Re: Menu
 
Did you try to compile your code ? First fix the errors

ironskillz1 05-25-2013 05:32

Re: Menu
 
Quote:

Originally Posted by akcaliberg (Post 1957797)
Did you try to compile your code ? First fix the errors

There are no errors..

Decompiler 05-25-2013 06:58

Re: Menu
 
Maybe because of this:

Quote:

if( 1 <= Team )
.

Remove the < sign and see if that helps.

ironskillz1 05-27-2013 13:57

Re: Menu
 
Quote:

Originally Posted by Decompiler (Post 1958064)
Maybe because of this:

.

Remove the < sign and see if that helps.

i dont think that will help at all..

simanovich 05-27-2013 15:47

Re: Menu
 
PHP Code:

public TeamMenuid )
{
    new 
menu menu_create("Team Menu""TeamMenu_Handler" )
 
    
menu_additemmenu"\rT VS T""0")
 
    
menu_additemmenu"\rCT VS T""1")
 
    
menu_setpropmenuMPROP_EXITMEXIT_ALL )
    
menu_displayidmenu)
}

public 
TeamMenu_Handleridmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
         return 
1
    
}
 
    
ColorChat(idGREY"Started %i",item)
    

    
menu_destroymenu )
     return 
1



ironskillz1 05-28-2013 12:21

Re: Menu
 
that was not what i asked for

YamiKaitou 05-28-2013 13:52

Re: Menu
 
You are giving your task an ID but your function header doesn't have one

ironskillz1 06-02-2013 10:40

Re: Menu
 
Still problems

T vs T works it only shows T vs T hud message

but when i start CT vs T it shows CT vs T and T vs T hud message


Code:
PHP Code:

ublic TeamMenuid )

 new 
szText555 char ]
 
formatexszTextcharsmaxszText ), "\r%s\w by %s^n\y-Choose Team"PREFIXAUTHOR )
 new 
menu menu_createszText"TeamMenu_Handler" )
 
 
menu_additemmenu"\rT VS T""0")
 
 
menu_additemmenu"\rCT VS T""1")
 
 
menu_setpropmenuMPROP_EXITMEXIT_ALL )
 
menu_displayidmenu)
}
public 
TeamMenu_Handleridmenuitem )
{
 if( 
item == MENU_EXIT )
 {
  
menu_destroymenu )
  return 
PLUGIN_HANDLED
 
}
 new 
data], iName64 ], accesscallback
 menu_item_getinfo
menuitemaccessdatacharsmaxdata ), iNamecharsmaxiName ), callback )
 
 new 
Team str_to_numdata 
 
 
set_task0.1,"StartGames"Team );
 
 return 
PLUGIN_HANDLED
}
public 
StartGamesTeam )

 static 
players32 ], numid;
 
get_playersplayersnum"a" );
 
 for( new 
0numi++ )
 {
  
id players];
  
  if( 
<= Team 
  {   
   
show_dhudmessage0"[CT VS T] Started" )
   
set_dhudmessage25500, -1.00.0201.07.00.11.0 
  }
  if( 
<= Team 
  { 
   
show_dhudmessage0"[T VS T] Started" )
   
set_dhudmessage25500, -1.00.0201.07.00.11.0 
  }   
 }



wickedd 06-02-2013 11:40

Re: Menu
 
This should help .

Code:

0 - UNASSIGNED
1 - TERRORIST
2 - CT
3 - SPECTATOR



All times are GMT -4. The time now is 16:27.

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