Wo soll ich da bitte etwas returen ?
public OnPlayerEnterCheckpoint(playerid)
{
new veh = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && !strcmp(SpawnCar_Type[veh], "Straßenreinigung", true))
{
DisablePlayerCheckpoint(playerid);
DestroyRubbish(MuellObject[playerid]);
new id = GetNearestRubbishID(GetPlayerVehicleID(playerid));
MuellObject[playerid] = id;
return SetPlayerCheckpoint(playerid, SRubbishInfo[id][RposX], SRubbishInfo[id][RposY], SRubbishInfo[id][RposZ], 4.5);
}
return 1;
}
stock GetNearestRubbishID(veh, Float:MAX_DISTANCE = 500.0){
new Float:Distance[2]={-1.0,-1.0}, index = -1;
for(new i; i != MAX_RUBBISH; ++i){
if(!SRubbishInfo[i][RubbishObject])continue;
Distance[0] = GetVehicleDistanceFromPoint(veh, SRubbishInfo[i][RposX], SRubbishInfo[i][RposY], SRubbishInfo[i][RposZ]);
if((Distance[1] == -1 || Distance[0] < Distance[1]) && Distance[0] < MAX_DISTANCE){
Distance[1] = Distance[0];
index = i;
}
}
return index;
}
stock DestroyRubbish(index){
DestroyDynamicObject(SRubbishInfo[index][RubbishObject]);
SRubbishInfo[index][RubbishObject] = 0;
return 1;
}
Bei jeder Funktion wird doch ein Wert zurück gegeben