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

Solved [FUN] Player out of range (0) with health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 04-18-2020 , 12:28   [FUN] Player out of range (0) with health
Reply With Quote #1

So I made a system of battles like Duel an option to choose from the HP menu
As soon as I click on the battle it gives me SLAY
Code:
L 04/18/2020 - 17:13:41: [AMXX] Run time error 10: native error (native "set_user_health")
L 04/18/2020 - 17:13:41: [AMXX]    [0] jb_lr_contest.sma::StartGame (line 424)
L 04/18/2020 - 17:13:41: [AMXX]    [1] jb_lr_contest.sma::TaskCountdown (line 298)
Code:
native jb_is_lr_running(&guard = 0, &prisoner = 0, &game = 0);
that what i did in my include jb_lastrequest.inc
Line: 424
Code:
StartGame(iGameId)
{
	g_iCountdown = -1;

	new pGuard, pPrisoner;
	jb_is_lr_running(pGuard, pPrisoner);

	set_user_health(pGuard, 100);
	set_user_health(pPrisoner, 100);

	switch (iGameId)
	{
		case GAME_TRANSLATE:
		{
			new szTranslate[70];

			//g_iCountdown = 30;

			ArrayGetString(g_hTranslate, random(ArraySize(g_hTranslate)), szTranslate, charsmax(szTranslate));
			parse(szTranslate, g_szTranslateWord, charsmax(g_szTranslateWord), g_szGameString, charsmax(g_szGameString));
		
			jb_client_print(pGuard, "^4Contest Question:^1 which is the^3 translation^1 of^4 %s^1?", g_szGameString);
			jb_client_print(pPrisoner, "^4Contest Question:^1 which is the^3 translation^1 of^4 %s^1?", g_szGameString);
			//jb_client_print(0, "^4Contest Question:^1 which is the^3 translation^1 of^4 %s^1?", g_szGameString);
		}
Line: 298
Code:
public TaskCountdown(iTaskId)
{
	if (!g_iCountdown)
	{
		g_iCurrentGame = g_iChosenGame;

		StartGame(g_iCurrentGame);
		return;
	}

	new szCountdown[15];

	num_to_word(g_iCountdown, szCountdown, charsmax(szCountdown));
	
	client_cmd(0, "spk ^"\vox/%s^"", szCountdown);

	set_hudmessage(0, 60, 150, -1.0, 0.4, 2, 0.02, 1.0, 0.01, 0.1);
	ClearSyncHud(0, g_hSyncHud);
	ShowSyncHudMsg(0, g_hSyncHud, "The ^"%s^" will start in^n[ %d seconds ]", g_szGameNames[g_iChosenGame], g_iCountdown);

	g_iCountdown--;
}
Code:
new g_iCurrentGame;

Last edited by Fuck For Fun; 05-05-2020 at 20:45.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-18-2020 , 13:01   Re: [FUN] Player out of range (0) with health
Reply With Quote #2

Show code for jb_is_lr_running(). pGuard is assigned a value by-reference and it's likely not happening.

Maybe jb_is_lr_running() returns false if pGuard and pPrisoner do not get set?
If so, you could do something like
PHP Code:
if ( !jb_is_lr_running(pGuardpPrisoner) )
  return; 
If not, you could do:
PHP Code:
jb_is_lr_running(pGuardpPrisoner);

if ( !
pGuard || !pPrisoner )
   return; 
__________________

Last edited by Bugsy; 04-18-2020 at 13:02.
Bugsy is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 04-20-2020 , 08:06   Re: [FUN] Player out of range (0) with health
Reply With Quote #3

@Bugsy Thanks a lot for the explanation was FALSE on Prisoner's review.

SLAY's problem is solved and everything works.
Now just need to check why it doesn't run my new .ini

I will respond or send you in steam if I have another problem

Last edited by Fuck For Fun; 04-20-2020 at 08:16.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
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 12:50.


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