Problem selecting mission which is over a set distance
#2

Normally you would do it like that, create an array, save all ids and use random afterwards
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];
            }
        }
    }
    
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: 2 Guest(s)