Raised This Month: $ Target: $400
 0% 

use_buttons_once error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BeeT
Junior Member
Join Date: Aug 2010
Old 08-16-2010 , 07:08   use_buttons_once error
Reply With Quote #1

Hello,
i would like to ask about use_buttons_once plugin.
I often have error:
Code:
L 08/16/2010 - 11:03:19: Player 2 is not ingame
L 08/16/2010 - 11:03:19: [AMXX] Displaying debug trace (plugin "use_button_once.amxx")
L 08/16/2010 - 11:03:19: [AMXX] Run time error 10: native error (native "player_menu_info")
L 08/16/2010 - 11:03:19: [AMXX]    [0] use_button_once.sma::show_menu_ (line 580)
How to i can fix this error?
Thanks for help.
BeeT is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-16-2010 , 07:17   Re: use_buttons_once error
Reply With Quote #2

Make sure player is ingame when using the native player_menu_info. ( is_user_connected or is_user_alive depending your need )
__________________
Arkshine is offline
BeeT
Junior Member
Join Date: Aug 2010
Old 08-16-2010 , 07:27   Re: use_buttons_once error
Reply With Quote #3

It's looks like this?:

Code:
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 );
	// Only display menu if another isn't shown
	if ( iTeam && (menuUp <= 0 || menu_id < 0) ){
		new iTime=get_pcvar_num(gcvarFRVoteTime);
		new iOffset=get_systime()-giVoteStart;
		iTime-=iOffset;
		new szMenu[128];
		formatex(szMenu, 127, "\y%L^n^n\w1. %L^n2. %L",id,"FREERUN_VOTEMENU",id,"FREE",id,"NORMALUS");
		show_menu(id, KeysFFVote, szMenu, iTime, "FRVote");
	}else
		set_task(1.0, "show_menu_", tid);
}

public eventInGame(id){
	if(giVotes[id][VOTE_ON] || giVotes[id][VOTE_OFF])
		return;
	if(gbVote)
	if (is_user_connected(id) && is_user_alive(id) && !is_user_bot(id))
		set_task(1.0, "show_menu_", id+TASK_SHOWMENU);
}
BeeT is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-16-2010 , 07:42   Re: use_buttons_once error
Reply With Quote #4

Do the check in show_menu_() after the first line. And you need only is_user_connected() or is_user_alive ( depending if you want the menu to be showed on dead player or not )
__________________
Arkshine is offline
BeeT
Junior Member
Join Date: Aug 2010
Old 08-16-2010 , 08:06   Re: use_buttons_once error
Reply With Quote #5

Thanks for help.
Last question it's looks like this?:

Code:
public show_menu_(tid){
	new id=tid-TASK_SHOWMENU;
	if (is_user_alive(id) && !is_user_bot(id)) {
	new iTeam=get_user_team(id);
	new menu_id, keys;
	new menuUp = player_menu_info( id, menu_id, keys );
	// Only display menu if another isn't shown
	if ( iTeam && (menuUp <= 0 || menu_id < 0) ){
		new iTime=get_pcvar_num(gcvarFRVoteTime);
		new iOffset=get_systime()-giVoteStart;
		iTime-=iOffset;
		new szMenu[128];
		formatex(szMenu, 127, "\y%L^n^n\w1. %L^n2. %L",id,"FREERUN_VOTEMENU",id,"FREE",id,"NORMALUS");
		show_menu(id, KeysFFVote, szMenu, iTime, "FRVote");
	}else
		set_task(1.0, "show_menu_", tid);
	}
}
BeeT is offline
Reply


Thread Tools
Display Modes

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:00.


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