Problem selecting mission which is over a set distance
#1

Hi,

I am having a little problem with my mission script.
I need to find all missions which are over a set distance, in this case it's over 500. (which isn't what my problem is)
But my problem is, selecting a random missions of those missions.

The missions are being loaded in the mInfo using an enum
The suitedmission[p] is where i tried to save the suited missions in, which i'm sure of that isn't the way to do it.
And before people tell me to save the missions in the gamemode itself, it's being loaded from the database
Код:
stock GetNextMissionCheckpoint(playerid)
{
    new msg[50];
	new Float:distance = 1000000.0, nearestID = -1;
	for(new p = 0; p < sizeof(mInfo); p++)
	{
	    if(mInfo[p][mID] != 0)
	    {
	    	distance = GetPlayerDistanceFromPoint(playerid, mInfo[p][mX], mInfo[p][mY], mInfo[p][mY]);
	    	if(distance > 500)
	    	{
				suitedmission[p] = mInfo[p][mID];
			}
		}
	} // problem down here
	new i = random(
	format(msg,sizeof(msg), "Mission ID %i, X: %f, Y: %f, Z: %f", mInfo[i][mID], mInfo[i][mX], mInfo[i][mY], mInfo[i][mZ]);
	SendClientMessage(playerid, COLOR_WHITE, msg);
	nearestID = i;
	return nearestID; // problem up here
}
I tried a lot of things already, but i can't seem to find a way to do this correct.

Thanks in advance, TheGamer
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)