Aso..ja sry mein Fehler..hatte mich verlesen ![]()
Hier, probiers mal so:
C
new File:f = fopen("logs/Bugreports.txt",io_read);
if(!f) return 1; //Keine Berechtigung
const rows = 10; //Wie viele Namen du angezeigt bekommen möchtest
new buffer[256],tmp[128],stack[MAX_PLAYER_NAME*rows],x,y,counter,n[16];
while(fread(f, buffer))
{
x = strfind(buffer,"]"), y = strfind(buffer,":",false,x);
strmid(tmp,buffer,x+1,y,sizeof(tmp));
strcat(tmp,"\n"),strcat(stack, tmp);
strmid(tmp,buffer,y+2,strlen(buffer),sizeof(tmp));
format(n,sizeof(n),"bug_%d",counter++);
SetPVarString(playerid,n,tmp);
}
SetPVarInt(playerid,"bug_length",counter);
fclose(f);
ShowPlayerDialog(playerid,DIALOG_BUSREPORTS,DIALOG_STYLE_LIST,"Log",stack,"Bestätigen","");
//Und dann unter OnDialogResponse
if(dialogid == DIALOG_BUSREPORTS)
{
if(!response) return DeleteBugCache(playerid);
new string[128],n[16];
format(n,sizeof(n),"bug_%d",listitem);
GetPVarString(playerid,n,string,sizeof(string));
ShowPlayerDialog(playerid,999,DIALOG_STYLE_MSGBOX,"Log",string,"Bestätigen","");
DeleteBugCache(playerid);
return 1;
}
//Und unten ganz wichtig:
stock DeleteBugCache(playerid)
{
new max=GetPVarInt(playerid,"bug_length");
for(new i,n[16]; i<max; i++)
{
format(n,sizeof(n),"bug_%d",i);
DeletePVar(playerid, n);
}
DeletePVar(playerid,"bug_length");
return 1;
}
Alles anzeigen
