[Ajuda] Sisteminha de race
Boa noite.

Bom, esse sistema de race ta me tirando do serio glr, fiz ele 100% mas nгo sei o que estб a acontecer pois chega no penъltimo CP e ele paulea, parece que nгo й criado mais nenhum CP, fica travado.

pawn Код:
`new Float:RaceCP[15][3] = {{2428.4199,1170.1619,10.2457},{2215.3130,1193.3645,10.2275},{2088.8975,1035.9341,10.2885},{1980.1074,851.2938,6.2877},{1585.2473,801.0934,10.3297},{1551.0294,653.9646,10.2312},{1349.1274,702.5684,10.2452},{1368.3394,737.6558,10.3827},{1313.1904,876.3162,6.3732},{1226.7970,1050.8186,6.3775},{1232.3336,2164.3264,6.2955},{1339.7229,2313.4922,14.4902},{753.3605,2654.1423,17.0243},{258.9140,2740.5674,59.4049},{-240.4675,2652.2322,62.3000}};new CountRace[MAX_PLAYERS];#define RACESCP 16 public OnPlayerEnterRaceCheckpoint(playerid){    printf("Player %d entered a race checkpoint!",playerid);    if(CountRace[playerid] != RACESCP) SetPlayerRaceCheckpoint(playerid,0,RaceCP[CountRace[playerid]][0],RaceCP[CountRace[playerid]][1],RaceCP[CountRace[playerid]][2],RaceCP[CountRace[playerid]+1][0],RaceCP[CountRace[playerid]+1][1],RaceCP[CountRace[playerid]+1][2],10);    else if(CountRace[playerid] == RACESCP)    {        SetPlayerRaceCheckpoint(playerid,1,RaceCP[CountRace[playerid]][0],RaceCP[CountRace[playerid]][1],RaceCP[CountRace[playerid]][2],RaceCP[CountRace[playerid]+1][0],RaceCP[CountRace[playerid]+1][1],RaceCP[CountRace[playerid]+1][2],10);    }    CountRace[playerid] ++;    return 1;}`
Resumindo, o ъltimo CP nгo й criado (O da bandeirinha).
Coloque sempre 1 a mais!
Como o edu33 disse... a array tem a necessidade de ter reserva +1 pra ela ser fechada(que й nulo), por isso o cp 15 nгo vai aparecer pois a array ta usando ele como nulo.

Acho que й isto...
Se tem 16 no racescp , pq nгo definiu encima tb?
pawn Код:
`new Float:RaceCP[16][3] = {{2428.4199,1170.1619,10.2457},{2215.3130,1193.3645,10.2275},{2088.8975,1035.9341,10.2885},{1980.1074,851.2938,6.2877},{1585.2473,801.0934,10.3297},{1551.0294,653.9646,10.2312},{1349.1274,702.5684,10.2452},{1368.3394,737.6558,10.3827},{1313.1904,876.3162,6.3732},{1226.7970,1050.8186,6.3775},{1232.3336,2164.3264,6.2955},{1339.7229,2313.4922,14.4902},{753.3605,2654.1423,17.0243},{258.9140,2740.5674,59.4049},{-240.4675,2652.2322,62.3000}};new CountRace[MAX_PLAYERS];#define RACESCP 16public OnPlayerEnterRaceCheckpoint(playerid){    printf("Player %d entered a race checkpoint!",playerid);    if(CountRace[playerid] != RACESCP) SetPlayerRaceCheckpoint(playerid,0,RaceCP[CountRace[playerid]][0],RaceCP[CountRace[playerid]][1],RaceCP[CountRace[playerid]][2],RaceCP[CountRace[playerid]+1][0],RaceCP[CountRace[playerid]+1][1],RaceCP[CountRace[playerid]+1][2],10);    else if(CountRace[playerid] == RACESCP)    {        SetPlayerRaceCheckpoint(playerid,1,RaceCP[CountRace[playerid]][0],RaceCP[CountRace[playerid]][1],RaceCP[CountRace[playerid]][2],RaceCP[CountRace[playerid]+1][0],RaceCP[CountRace[playerid]+1][1],RaceCP[CountRace[playerid]+1][2],10);    }    CountRace[playerid] ++;    return 1;}`
Quote:
 Originally Posted by dPlaYer_ Se tem 16 no racescp , pq nгo definiu encima tb? pawn Код: `new Float:RaceCP[16][3] = {{2428.4199,1170.1619,10.2457},{2215.3130,1193.3645,10.2275},{2088.8975,1035.9341,10.2885},{1980.1074,851.2938,6.2877},{1585.2473,801.0934,10.3297},{1551.0294,653.9646,10.2312},{1349.1274,702.5684,10.2452},{1368.3394,737.6558,10.3827},{1313.1904,876.3162,6.3732},{1226.7970,1050.8186,6.3775},{1232.3336,2164.3264,6.2955},{1339.7229,2313.4922,14.4902},{753.3605,2654.1423,17.0243},{258.9140,2740.5674,59.4049},{-240.4675,2652.2322,62.3000}};new CountRace[MAX_PLAYERS];#define RACESCP 16public OnPlayerEnterRaceCheckpoint(playerid){    printf("Player %d entered a race checkpoint!",playerid);    if(CountRace[playerid] != RACESCP) SetPlayerRaceCheckpoint(playerid,0,RaceCP[CountRace[playerid]][0],RaceCP[CountRace[playerid]][1],RaceCP[CountRace[playerid]][2],RaceCP[CountRace[playerid]+1][0],RaceCP[CountRace[playerid]+1][1],RaceCP[CountRace[playerid]+1][2],10);    else if(CountRace[playerid] == RACESCP)    {        SetPlayerRaceCheckpoint(playerid,1,RaceCP[CountRace[playerid]][0],RaceCP[CountRace[playerid]][1],RaceCP[CountRace[playerid]][2],RaceCP[CountRace[playerid]+1][0],RaceCP[CountRace[playerid]+1][1],RaceCP[CountRace[playerid]+1][2],10);    }    CountRace[playerid] ++;    return 1;}`
Problema resolvido com ajuda do BlueX, bastava duplicar a ъltima coordenada para que tenha uma coordenada final. No ъltimo CP ele estava a usar o valor 17, mas como ele nгo existe, o CP nгo era criado =D

Ainda existem outros bugs no code, mas estes ja estou a resolver solamente =)

Forum Jump:

Users browsing this thread: 1 Guest(s)