This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

player class menu


Post New Thread Reply   
 
Thread Tools Display Modes
drop
Member
Join Date: Oct 2010
Location: my room
Old 01-18-2012 , 08:30   Re: player class menu
Reply With Quote #11

Whoaa nicee , the menu showed up

one last thing I need and every thing will be just PERFECT.

now let's take an exaple :
I have a server with auto respawn every time you die. So I picked one of these menu options (it gave me a gun or sothing like that) so I died , but then in a few seconds i respawn , menu wont show up.

The thing I need is that this menu can show up every time a player respawns (no matter of a new round)... I tried to add
Quote:
if(is_user_alive(id))
But nothing...

This is what my menu looks now:
Quote:
#include <amxmodx>
#include <fun>
#include <hamsandwich>

#define TASK_SHOWMENU 12000

public plugin_init()
{
register_clcmd( "menu","menu");
RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1)
}

public fwHamPlayerSpawnPost(id)
{
if (is_user_alive(id))
{
client_cmd(id, "menu")
}
}

public client_putinserver(id)
set_task(1.0, "show_menu_", id+TASK_SHOWMENU);

public show_menu_(tid){
new id=tid-TASK_SHOWMENU;
new iTeam=get_user_team(id);

new menu_id, keys;
new menuUp = player_menu_info( id, menu_id, keys );

if ( iTeam && (menuUp <= 0 || menu_id < 0) )
menu(id)
else
set_task(1.0, "show_menu_", tid);
}


public menu(id)
{
new menu = menu_create("\rCOLL CLASS:", "menu_handler")
menu_additem(menu, "\wS", "1", 0)
menu_additem(menu, "\wA", "2", 0)
menu_additem(menu, "\wD", "3", 0)
menu_additem(menu, "\wC", "4", 0)

menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}

public menu_handler(id, menu, item)
{

if( item == MENU_EXIT )
{
menu_destroy(menu)
return PLUGIN_HANDLED
}

new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
client_print(id, print_chat, "some text");
set_user_health(id, 100)
set_user_maxspeed(id, 230.0)
give_item(id,"weapon_mp5navy")
give_item(id,"weapon_p228")
}
case 2:
{
client_print(id, print_chat, "some text");
set_user_health(id, 200)
set_user_maxspeed(id, 200.0)
give_item(id,"weapon_m249")
give_item(id,"weapon_p228")
}
case 3:
{
client_print(id, print_chat, "some text");
set_user_health(id, 65)
set_user_maxspeed(id, 300.0)
give_item(id,"weapon_mp5navy")
give_item(id,"weapon_xm1014")
give_item(id,"weapon_p228")
}
case 4:
{
client_print(id, print_chat, "some text");
set_user_health(id, 100)
set_user_maxspeed(id, 230.0)
give_item(id,"weapon_awp")
give_item(id,"weapon_p228")
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
BTW I tried found this tut.
http://forums.alliedmods.net/showthread.php?t=42159

But cant understad if this is the right code and where to put it , when i tried to add id , when compileing im getting errors...

Last edited by drop; 01-19-2012 at 09:16.
drop is offline
Send a message via Skype™ to drop
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 18:59.


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