Problem selecting mission which is over a set distance
#4

Quote:
Originally Posted by thegamer355
Посмотреть сообщение
For some reason that code always ends up with mission ID 0, which doesn't exist, so it's point is at 0.0 0.0 0.0
But once i remove the mission ID checker so it can be mission id 0, then it's always comes up with mission ID 1
It could be possible that no matches were found ?
Because there shouldn't be an id 0

PHP код:
stock GetNextMissionCheckpoint(playerid) {
    
#define SIZE 64
    #if sizeof mInfo > SIZE
        #undef SIZE
        #define SIZE sizeof mInfo
    #endif
    
new
        
count,
        
= -1,
        
tmp[SIZE]
    ;
    while(++
sizeof mInfo) {
        if(
mInfo[p][mID] != 0) { // \/ changed second mY to mZ
            
if(500.0 GetPlayerDistanceFromPoint(playeridmInfo[p][mX], mInfo[p][mY], mInfo[p][mZ])) {
                
tmp[count++] = mInfo[p][mID];
            }
        }
    }
    if(
count == 0) {
        return 
printf("No mission found!");
    }
    
printf("count %d"count); // add some debug prints
    
for(new icount; ++iprintf("%d - %d"itmp[i]);
    
tmp[random(count)];
    
format(tmpsizeof tmp"Mission ID %i, X: %f, Y: %f, Z: %f"mInfo[p][mID], mInfo[p][mX], mInfo[p][mY], mInfo[p][mZ]);
    
SendClientMessage(playeridCOLOR_WHITEtmp);
    return 
p;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)