AlliedModders

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

MspoR 12-25-2015 16:58

Team Menu
 
Hello, I need help with one little think. I'm really bad at only team view name menu. So I need to make this code to work. If you are T, it will show menu of your team mates. If you are CT, it will show you CT Players.


PHP Code:

public cmd_transfermenu(id)
{
static 
opcion[64]

formatex(opcioncharsmax(opcion),"Choose player")
new 
iMenu menu_create(opcion"cmd_transfermenu_handler")

new 
players[32], pnumtempid
new szName[32], szTempid[10]

{
if(
get_user_team(id) == 2)
{
static 
iPlayers[32], iNumiiPlayer;
get_playersiPlayersiNum"ae""CT" );
tempid players 
get_user_name
(tempidszName31)
num_to_str(tempidszTempid9)

formatex(opcioncharsmax(opcion), "\w%s \y- \r[Points: %d]"szNamejbm_get_user_points(tempid))
menu_additem(iMenuopcionszTempid0)
}

else 
{
static 
iPlayers[32], iNumiiPlayer;
get_playersiPlayersiNum"ae""TERRORIST" ); 

tempid players

get_user_name
(tempidszName31)
num_to_str(tempidszTempid9)

formatex(opcioncharsmax(opcion), "\w%s \y- \r[Points: %d]"szNamejbm_get_user_points(tempid))
menu_additem(iMenuopcionszTempid0)
}

menu_display(idiMenu)

}
return 
PLUGIN_HANDLED




Thank you.

redivcram 12-25-2015 17:58

Re: Team Menu
 
Put code between [php] tags

MspoR 12-26-2015 02:56

Re: Team Menu
 
Done and sorry :)

siriusmd99 12-26-2015 10:50

Re: Team Menu
 
PHP Code:

public cmd_transfermenu(id

static 
opcion[64

formatex(opcioncharsmax(opcion),"Choose player"
new 
iMenu menu_create(opcion"cmd_transfermenu_handler"

static 
iPlayers[32], iNumitempidteamid 

teamid 
cs_get_user_team(id)
get_playersiPlayersiNum); 

   for(
0i<iNumi++ )
   {
       
tempid iPlayers[i
       if(
cs_get_user_team(tempid) == teamid){ 
            
get_user_name(tempidszName31
            
num_to_str(tempidszTempid9

            
formatex(opcioncharsmax(opcion), "\w%s \y- \r[Points: %d]"szNamejbm_get_user_points(tempid)) 
            
menu_additem(iMenuopcionszTempid0
       }
    }

   
menu_display(idiMenu)  


At the top of the plugin don't forget to add:
#define <cstrike>

Because function cs_get_user_team requires module cstrike to be defined.

MspoR 12-26-2015 16:54

Re: Team Menu
 
Great. Thanks


All times are GMT -4. The time now is 17:50.

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