Actors are not created correctly.
#1

This code has been deleted.
Reply
#2

Quote:
Код:
if(hour >= 21 && hour <= 00)
Seriously? How can a variable be both greater than 21 and smaller than zero at the same time? The compiler can tell you a lot but it can't fix stupid. Also I'm not sure why you use "else if" there because it is completely unrelated to the above if-statement.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Seriously? How can a variable be both greater than 21 and smaller than zero at the same time? The compiler can tell you a lot but it can't fix stupid. Also I'm not sure why you use "else if" there because it is completely unrelated to the above if-statement.
I'm using that to check whether the time is between 21:00 and 00:00, if so, then spawn the NPC, else if the time is not between 21:00 and 00:00, destroy the NPC IF it exists.
Reply
#4

Quote:
Originally Posted by danielpalade
Посмотреть сообщение
I'm using that to check whether the time is between 21:00 and 00:00, if so, then spawn the NPC, else if the time is not between 21:00 and 00:00, destroy the NPC IF it exists.
yeah you have good logic. i understand.
Reply
#5

A number can't be higher than 21 and lower than 0, it's not logically possible. I think what you're trying to achieve is this:

Код:
if(hour >= 21 && hour <= 24) // 00:00 = 24:00
Or simply..

Код:
if(hour >= 21)
Reply
#6

Quote:
Originally Posted by Marricio
Посмотреть сообщение
A number can't be higher than 21 and lower than 0, it's not logically possible. I think what you're trying to achieve is this:

Код:
if(hour >= 21 && hour <= 24) // 00:00 = 24:00
Or simply..

Код:
if(hour >= 21)
Fixed that, thanks.

Anyways, what could be the problem of all of them despawning?
Reply
#7

Quote:
Originally Posted by danielpalade
Посмотреть сообщение
Fixed that, thanks.

Anyways, what could be the problem of all of them despawning?
Your data structure (the array) is very confusing. Can you show me some more code so I can figure how the data is stored?
Reply
#8

Quote:
Originally Posted by Marricio
Посмотреть сообщение
Your data structure (the array) is very confusing. Can you show me some more code so I can figure how the data is stored?
Well this is the enum:

Код:
enum p_quests
{
	questID,
	questTitle[64],
	questType,
	questObject[10],
	Timer: questTimer
}
new E_QUEST[MAX_QUESTS][p_quests];
MAX_QUESTS = 10.

And this is OnGamemodeInit:

Код:
stock OnQuestsLoad()
{
	new x, hour;
	gettime(hour);

	x = 1;
	E_QUEST[x][questID] = x;
	format(E_QUEST[x][questTitle], 64, "The Chilliad Mystery");
	E_QUEST[x][questType] = 1;
	if(hour >= 21 && hour <= 00)
	{
		E_QUEST[x][questObject][OBJECT_GHOST] = CreateActor(55, -2255.3076,-1749.2554,487.6301,213.9964);
		E_QUEST[x][questObject][OBJECT_SMOKE] = CreateDynamicObject(18735, -2255.370605, -1749.652343, 485.269836, 0.000000, 0.000000, 0.000000);
	}

	x = 2;
	E_QUEST[x][questID] = x;
	format(E_QUEST[x][questTitle], 64, "The Collector");
	E_QUEST[x][questObject][OBJECT_VEHICLE] = INVALID_VEHICLE_ID;
	E_QUEST[x][questType] = 2;

	x = 3;
	E_QUEST[x][questID] = x;
	format(E_QUEST[x][questTitle], 64, "The Racer");
	E_QUEST[x][questObject][OBJECT_NPC] = CreateActor(55, -2127.6614,-452.7275,35.5313,272.9914);
	E_QUEST[x][questType] = 3;


	return 1;
}
Reply
#9

You have the same 00/24 check time problem in OnQuestsLoad you had initially in the timer. About all the actors being deleted I can't seem to figure out the problem. The code is very bad and unreadable, I would recommend you to re-write it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)