pawn Код:
stock CaricaGare()
{
for(new i=0;i<MAX_GARE;i++)
{
format(stringa,sizeof(stringa),"Stu4Lif/Races/Race%d.txt",i);
format(stringa2,sizeof(stringa2),"Race %d not found. This race cannot be loaded.",i);
if(!fexist(stringa)) return printf(stringa2);
new File:nomegara=fopen(stringa, io_read);
fread(nomegara,stringagara);
fclose(nomegara);
sscanf(stringagara,"p<,>s[50]ddds[24]s[24]d",Gara[i][Nome],Gara[i][Giri],Gara[i][Costo],Gara[i][Record],Gara[i][GiocatoreRecord],Gara[i][Produttore],Gara[i][Inseguimento]);
Gara[i][NumeroCheckpoint]=-1;
format(stringa,sizeof(stringa),"%s,%d,%d$,%d,%s,%s,%d",Gara[i][Nome],Gara[i][Giri],Gara[i][Costo],Gara[i][Record],Gara[i][GiocatoreRecord],Gara[i][Produttore],Gara[i][Inseguimento]);
printf(stringa);
//================CARICAMENTOCHECKPOINT
format(stringagara,sizeof(stringagara),"");
format(stringa,sizeof(stringa),"Stu4Lif/Races/Check%d.txt",i);
format(stringa2,sizeof(stringa2),"Checkpoint list for Race %d not found. This race cannot be loaded.",i);
if(!fexist(stringa)) return printf(stringa2);
nomegara=fopen(stringa, io_read);
print("____________________________________");
for(new j=0;j<MAX_CHECKPOINT;j++)
{
fread(nomegara,stringagara);
sscanf(stringagara,"p<,>fff",CheckpointGara[i][j][CXPos],CheckpointGara[i][j][CYPos],CheckpointGara[i][j][CZPos]);
if(CheckpointGara[i][j][CXPos]==0) {printf("%d checkpoints loaded for Race %d.",Gara[i][NumeroCheckpoint]+1,i);break;}
Gara[i][NumeroCheckpoint]++;
}
fclose(nomegara);
GareCaricate=i;
GareEditor=i;
print("____________________________________");
}
return 1;
}
//====================================================================SALVAGARE
stock SalvaGare()
{
for(new i=0;i<GareCaricate;i++)
{
format(stringa,sizeof(stringa),"Stu4Lif/Races/Race%d.txt",i);
format(stringa2,sizeof(stringa2),"Race %d not found. Failed to save this race.",i);
if(!fexist(stringa)) return printf(stringa2);
new File:nomegara=fopen(stringa, io_write);
format(stringagara,sizeof(stringagara),"%s,%d,%d$,%d,%s,%s,%d",Gara[i][Nome],Gara[i][Giri],Gara[i][Costo],Gara[i][Record],Gara[i][GiocatoreRecord],Gara[i][Produttore],Gara[i][Inseguimento]);
fwrite(nomegara,stringagara);
fclose(nomegara);
}
return 1;
}
//=====================================================================AVVIAGARA
stock AvviaGara(idGara)
{
format(stringa,sizeof(stringa),"[Race]: Race %s has been started!",Gara[idGara][Nome]);
SendClientMessageToAll(COLOR_YELLOW,stringa);
Gara[idGara][Avviata]=1;
foreach(new i : Player)
{
if(Giocatore[i][IdGara]==idGara)
{
TogglePlayerControllable(i,0);
TextDrawShowForPlayer(i,sfondo);
TextDrawShowForPlayer(i,sfondorosso);
TextDrawShowForPlayer(i,sfondogiallo);
TextDrawShowForPlayer(i,sfondoverde);
TextDrawShowForPlayer(i,rossoacceso);
if(Gara[Giocatore[i][IdGara]][Inseguimento])
{
TextDrawShowForPlayer(i,TextSfondoInseguimento);
TextDrawShowForPlayer(i,SfondoInseguimentoRosso);
TextDrawShowForPlayer(i,SfondoInseguimentoGiallo);
TextDrawShowForPlayer(i,SfondoInseguimentoVerde);
TextDrawShowForPlayer(i,SfondoInseguimentoAzzurro);
TextDrawShowForPlayer(i,TextInseguimento);
TextDrawShowForPlayer(i,TextPessimo);
TextDrawShowForPlayer(i,TextMediocre);
TextDrawShowForPlayer(i,TextBuono);
TextDrawShowForPlayer(i,TextOttimo);
TextDrawSetString(TextPunti[i],"Points: 0000");
TextDrawShowForPlayer(i,TextPunti[i]);
}
SetTimerEx("Tre",1000,false,"idx",i);
}
}
return 1;
}
stock LasciaGara(playerid)
{
if(Giocatore[playerid][IdGara]==-1) return 1;
if(Gara[Giocatore[playerid][IdGara]][Avviata]==0)
{
if(Giocatore[playerid][Pronto]==1)
Gara[Giocatore[playerid][IdGara]][PartecipantiPronti]--;
}
KillTimer(TimerPlayers[playerid]);
Giocatore[playerid][Tempo]=0;
GetPlayerName(playerid,nome,sizeof(nome));
format(stringa,sizeof(stringa),"[Race]: %s(%d) quit the race.", GetName(playerid), playerid);
MandaMessaggioPartecipanti(Giocatore[playerid][IdGara],stringa);
//==========TEXTBASE
TextDrawHideForPlayer(playerid,sfondo);
TextDrawHideForPlayer(playerid,TimerText[playerid]);
TextDrawHideForPlayer(playerid,TimerSfondo);
TextDrawHideForPlayer(playerid,sfondorosso);
TextDrawHideForPlayer(playerid,sfondogiallo);
TextDrawHideForPlayer(playerid,sfondoverde);
TextDrawHideForPlayer(playerid,rossoacceso);
TextDrawHideForPlayer(playerid,gialloacceso);
TextDrawHideForPlayer(playerid,verdeacceso);
TextDrawHideForPlayer(playerid,TextGiriSfondo);
//==========TEXTINSEGUIMENTO
TextDrawHideForPlayer(playerid,TextSfondoInseguimento);
TextDrawHideForPlayer(playerid,SfondoInseguimentoRosso);
TextDrawHideForPlayer(playerid,SfondoInseguimentoGiallo);
TextDrawHideForPlayer(playerid,SfondoInseguimentoVerde);
TextDrawHideForPlayer(playerid,SfondoInseguimentoAzzurro);
TextDrawHideForPlayer(playerid,TextInseguimento);
TextDrawHideForPlayer(playerid,TextPessimo);
TextDrawHideForPlayer(playerid,TextMediocre);
TextDrawHideForPlayer(playerid,TextBuono);
TextDrawHideForPlayer(playerid,TextOttimo);
TextDrawHideForPlayer(playerid,TextPunti[playerid]);
TextDrawHideForPlayer(playerid,TextGiriContatore[playerid]);
TextDrawSetString(TimerText[playerid],"00:00");
Giocatore[playerid][Checkpoint]=0;
Gara[Giocatore[playerid][IdGara]][Partecipanti]--;
if(Gara[Giocatore[playerid][IdGara]][PartecipantiPronti]==Gara[Giocatore[playerid][IdGara]][Partecipanti] && Gara[Giocatore[playerid][IdGara]][Partecipanti]!=0 && Gara[Giocatore[playerid][IdGara]][Avviata]==0)
AvviaGara(Giocatore[playerid][IdGara]);
ChiudiGara(Giocatore[playerid][IdGara]);
Giocatore[playerid][IdGara]=-1;
Giocatore[playerid][Pronto]=0;
Giocatore[playerid][Giro]=1;
Giocatore[playerid][Inseguitore]=0;
Giocatore[playerid][Punti]=0;
DisablePlayerRaceCheckpoint(playerid);
return 1;
}
//====================================================================CHIUDIGARA
stock ChiudiGara(idGara)
{
if(Gara[idGara][Partecipanti]==0 && idGara!=-1)
{
format(stringa,sizeof(stringa),"[Race]: Race %s has been ended!",Gara[idGara][Nome]);
SendClientMessageToAll(COLOR_YELLOW,stringa);
Gara[idGara][Podio]=0;
Gara[idGara][Avviata]=0;
Gara[idGara][Partecipanti]=0;
Gara[idGara][PartecipantiPronti]=0;
}
}
ANyways, i also have problem loading races.