Raised This Month: $32 Target: $400
 8% 

ArrayGetString


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 07-10-2019 , 15:57   ArrayGetString
Reply With Quote #1

PHP Code:
L 07/10/2019 03:05:27Invalid index 919119408 (count0)
L 07/10/2019 03:05:27: [AMXXDisplaying debug trace (plugin "jailbreak_lastrequest.amxx")
L 07/10/2019 03:05:27: [AMXXRun time error 10native error (native "ArrayGetString")
L 07/10/2019 03:05:27: [AMXX]    [0jailbreak_lastrequest.sma::StopLR (line 3682)
L 07/10/2019 03:05:27: [AMXX]    [1jailbreak_lastrequest.sma::TaskStopLR (line 3671
Code:
public TaskStopLR(Data[])
{
	StopLR(Data[0]);
}

StopLR(pWinner = 0)
{
	if (g_iLRRunning)
	{
		if (pWinner != 0)
		{
			new iLen, szSound[64], iMinPlayers;

			ArrayGetString(g_arrayWinSounds, random(ArraySize(g_arrayWinSounds)), szSound, charsmax(szSound)); // here

			iMinPlayers = get_pcvar_num(jb_keys_min_players);
			iLen = strlen(szSound);

			if (szSound[iLen - 3] == 'm' && szSound[iLen - 2] == 'p' && szSound[iLen - 1] == '3')
				client_cmd(0, "mp3 play ^"sound/%s^"", szSound);
			else
				client_cmd(0, "spk ^"%s^"", szSound);

			if (GetPlayersNum("ch") >= iMinPlayers)
			{
				switch(random_num(1, 10))
				{
					case 1:
					{
						g_iKeys[pWinner] += 1;
						jb_client_print(pWinner, "Congrulations! You won^4 1 Key^1 and stayed with^3 %i Key(s)^1.", g_iKeys[pWinner]);
					}
					default:
					{
						jb_client_print(pWinner, "Sorry, you didn't win any Key. Good luck next time!");
					}
				}
			}
			else
			{
				jb_client_print(pWinner, "^4*%d players^1 must be online to get^3 key^1.", iMinPlayers);
			}
		}
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 07-10-2019 , 16:48   Re: ArrayGetString
Reply With Quote #2

Try replacing with random_num(0, ArraySize(g_arrayWinSounds) - 1), also, make sure that the array has size.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 07-10-2019 at 16:49.
EFFx is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-10-2019 , 17:03   Re: ArrayGetString
Reply With Quote #3

The dynamic array is empty.....

Check if it has a size bigger than 0.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-10-2019 at 17:03.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 07-11-2019 , 03:05   Re: ArrayGetString
Reply With Quote #4

Quote:
Originally Posted by EFFx View Post
Try replacing with random_num(0, ArraySize(g_arrayWinSounds) - 1), also, make sure that the array has size.
Quote:
Originally Posted by Natsheh View Post
The dynamic array is empty.....

Check if it has a size bigger than 0.
that the array of sound, And maybe the problem is that I'm using a low SIZE
Code:
PrecacheSoundArray(Array:arrayHandle)
{
	if (arrayHandle == Invalid_Array)
		return;

	new i, iSoundCount, szSound[16];

	iSoundCount = ArraySize(arrayHandle);

	for (i = 0; i < iSoundCount; i++)
	{
		ArrayGetString(arrayHandle, i, szSound, charsmax(szSound));
		precache_sound(szSound);
	}
}
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
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:08.


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