10.03.2016, 17:32
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
I tried a lot of things already, but i can't seem to find a way to do this correct.
Thanks in advance, TheGamer
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 }
Thanks in advance, TheGamer