16.11.2014, 13:15
Problems:
if(vehicleid < 1 || vehicleid >= 2000) return 0;
Can't vehicle ID be 2000? shouldn't that be vehicleid > 2000
I'm sure vehicle IDs are 1 - 2000 respectively
#2.
What is GetVehicleCab, is it GetVehicleTrailerID or something? Please update the function with a better naming
if(vehicleid < 1 || vehicleid >= 2000) return 0;
Can't vehicle ID be 2000? shouldn't that be vehicleid > 2000
I'm sure vehicle IDs are 1 - 2000 respectively
#2.
What is GetVehicleCab, is it GetVehicleTrailerID or something? Please update the function with a better naming
pawn Код:
// native GetVehicleCab(vehicleid);
static cell AMX_NATIVE_CALL Natives::GetVehicleCab( AMX* amx, cell* params )
{
// If unknown server version
if(!pServer)
return 0;
CHECK_PARAMS(1, "GetVehicleCab");
int vehicleid = (int)params[1];
if(vehicleid < 1 || vehicleid >= 2000) return 0;
if(!pNetGame->pVehiclePool->pVehicle[vehicleid])
return 0;
CVehicle *pVeh;
for(WORD i = 0; i != MAX_VEHICLES; i++)
{
pVeh = pNetGame->pVehiclePool->pVehicle[i];
if(!pVeh) continue;
if(pVeh->wTrailerID != 0 && pVeh->wTrailerID == vehicleid)
return i;
}
return 0;
}