Hi! Ich wollte auf meinem Server Autorennen einbauen mit einer Highscore Liste! Aber immer wenn ich compilen will, bekomme ich die Meldung: error 090: public functions may not return arrays (symbol "ReadHighScoreList"). In diesem Code ist der Error in Zeile 59. Ich weiß absolut nicht, wie ich das wegbekomme.
public ReadHighScoreList(track[256], display, playerid, all) //READ and DISPLAY Highscorelist
{
new HSList[HIGH_SCORE_SIZE][rStats]; //Takes params trackname, if it is to be displayed on screen
new FiPo[255]; //the player requesting the displaying and if it is to be
new himsg[255]; //displayed to all clients
if(strcmp(track, "", true ) ) { //if a parameter isn't passed
track = gTrackName[gTrack]; //use current track
}
format(FiPo, sizeof(FiPo), "%s/%s.txt", track);
if(fexist(FiPo)) {
new File: hsfile = fopen(FiPo, io_read);
new line[256];
new temp[256];
new idx;
if (display) {
format(himsg, sizeof(himsg),"Current Highscorelist for %s\n", track);
if(playerid==-1 || IsPlayerAdmin(playerid) && all) {
SendClientMessageToAll(COLOR_KHAKI, himsg); //Sweet khaki color... :D
} else {
SendClientMessage(playerid, COLOR_YELLOW, himsg);
}
}
for(new i = 0; i <= sizeof(HSList)-1; i++) {
fread(hsfile, line, sizeof(line));
temp = strtok(line, idx);
strmid(HSList[i][rName], temp, 0, strlen(temp), 255); //read racename (to be compatible
temp = strtok(line, idx); //
HSList[i][rTime] = strval(temp); //convert record to int
temp = strtok(line, idx);
strmid(HSList[i][rRacer], temp, 0, strlen(temp), 255);
idx = 0; //reset idx to read more highscores
if (HSList[i][rTime] == 0) { //check if record is not set (0) previously
}
if (display) {
new Minutes, Seconds, MSeconds, sSeconds[5], sMSeconds[5];
timeconvert(HSList[i][rTime], Minutes, Seconds, MSeconds);
if (Seconds < 10)format(sSeconds, sizeof(sSeconds), "0%d", Seconds);
else format(sSeconds, sizeof(sSeconds), "%d", Seconds);
if (MSeconds < 100)format(sMSeconds, sizeof(sMSeconds), "0%d", MSeconds);
else format(sMSeconds, sizeof(sMSeconds), "%d", MSeconds);
if (Minutes != 50)
format(himsg, sizeof(himsg),"%d - %d:%s.%s by %s\n", i+1, Minutes, sSeconds, sMSeconds, HSList[i][rRacer]);
else format(himsg, sizeof(himsg),"\n");
if(playerid==-1 || IsPlayerAdmin(playerid) && all) {
SendClientMessageToAll(COLOR_KHAKI, himsg); //Sweet khaki color... :D
} else {
SendClientMessage(playerid, COLOR_YELLOW, himsg);
}
}
}
fclose(hsfile);
} else { //if client passed as param a race that doesn't exist
format(himsg, sizeof(himsg),"The track '%s' doesn't exist.\n", track);
SendClientMessage(playerid, COLOR_YELLOW, himsg); //Send errormsg privately even if admin
}
if(!display) { //No need to return if it is being displayed
return (HSList); //so warning 209 can be ignored.
}
return (HSList);
}
"public functions may not return arrays" wie bekomme ich das weg?
- Sim
- Geschlossen
- Erledigt
Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!
Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
-
-
stock ReadHighScoreList(track[256], display, playerid, all)
? -
was meinst du?
-
Das hier:
public ReadHighScoreList(track[256], display, playerid, all)
in das hier ändern:
stock ReadHighScoreList(track[256], display, playerid, all) -
Tatsächlich.. und ich hab ne Woche rumprobiert und nix hat geholfen. Danke!!
-
public kann nur Falsch und Wahr zurückgeben also return 0; oder return 1;
-
breadfish.de
Hat das Thema geschlossen.