Raised This Month: $ Target: $400
 0% 

How all array set to FALSE when all are true?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
spag
Junior Member
Join Date: Feb 2013
Old 01-08-2014 , 15:47   How all array set to FALSE when all are true?
Reply With Quote #1

How all array set to FALSE when all are true?

My code: when start Show_Question random get number from MAX_NUM_OF_QUESTIONS, of total is 3 number, and then check if that number is false, he gives true and print that number question... when all 3 number are true i need set all to false, because my code stop work when all num are true..

This code didnt' work.. help.. And sorry for my bad english..



Code:
#define TASKID_QUESTION 33523

#define MAX_NUM_OF_CHAR 190

#define MAX_NUM_OF_QUESTIONS 3

new const Questions[MAX_NUM_OF_QUESTIONS][] =
{
	"Lietuvos sostine?",
	"Laikinoji Lietuvos sostine?",
	"Dabartiniai metai?"
}

new const Answers[][] =
{
	"Vilnius",
	"Kaunas",
	"2014"
}

new bool: AlreadyUsed[MAX_NUM_OF_QUESTIONS]

new Used_Question[1][MAX_NUM_OF_CHAR]
new Used_Answer[1][MAX_NUM_OF_CHAR]
new bool:reset = true;


public Show_Question()
{
	new Num = random_num(0, MAX_NUM_OF_QUESTIONS - 1);
 
	for (new i; i < sizeof(AlreadyUsed); i++)
	{
		if (!AlreadyUsed[i])
		{
			reset = false;
			server_print("[Debug] AlreadyUsed[%d] = false", i);
 
			break;
		}
	}
 
	if (reset)
		arrayset(AlreadyUsed, false, sizeof(AlreadyUsed));
	
	if (!AlreadyUsed[Num])
	{
		AlreadyUsed[Num] = true

		copy(Used_Question[0], MAX_NUM_OF_CHAR - 1, Questions[Num])
		copy(Used_Answer[0], MAX_NUM_OF_CHAR - 1, Answers[Num])

		set_hudmessage(0, 255, 0, -1.0, 0.35, 0, 6.0, 10.0, 0.1, 0.2, 4);
		ShowSyncHudMsg(0, g_SyncHudMsg, "%s Klausimas: %s", g_szPrefix, Used_Question[0]);
		ColorChat(0, NORMAL, "!g%s!n Klausimas: !t%s", g_szPrefix, Used_Question[0]);

		set_task(10.0, "Show_Question", TASKID_QUESTION)
	}
	else
		set_task(0.1, "Show_Question");

	return PLUGIN_HANDLED
}

Last edited by spag; 01-08-2014 at 15:47.
spag is offline
 



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


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