03.02.2015, 23:00
(
Последний раз редактировалось Luca12; 04.02.2015 в 09:53.
)
I was add one command /saverace and yini should save everything in file but I opet the file and it's empty
pawn Код:
CMD:racesave(playerid, params[])
{
if(RaceCreation[playerid] == 1)
{
new string[256];
new kod,naziv[128],krugova,vozila;
if(sscanf(params,"is[128]ii",kod,naziv,krugova,vozila)) return SCM(playerid,COLOR_GRAD2,"Usage: /saverace [security code?] [fileName] [circles] [Vehicles? 1-yes 0-no]");
if(kod != 2011001){ return 1; }
if(strlen(naziv) < 6) return SCM(playerid,COLOR_ZUTA,"*To short file title!");
if(strlen(naziv) > 128) return SCM(playerid,COLOR_ZUTA,"*To long file title!");
if(krugova > 100) return SCM(playerid,0xadaeadFF,"circles??!! 0, <=100!");
if(krugova < 0) return SCM(playerid,0xadaeadFF,"circles??!! 0, <=100!");
if(vozila > 1) return SCM(playerid,0xadaeadFF,"Vehicles??!! 1-YES, 0-NO!");
if(vozila < 0) return SCM(playerid,0xadaeadFF,"Vehicles??!! 1-YES, 0-NO!");
new utrkaf[256];
format(racef,sizeof(racef),"/Races/%s.ini",naziv);
new INI:File = INI_Open(racef);
UtrkaInfo[utrkaRekordMinuti] = 59;
UtrkaInfo[utrkaRekordSekunde] = 59;
INI_WriteString(File,"Ime_Utrke",ImeUtrke);
INI_WriteInt(File,"BrojCP",UtrkaInfo[utrkaBrojCP]);
INI_WriteString(File,"Rekorder","Nema");
INI_WriteInt(File,"RekordMinuti",UtrkaInfo[utrkaRekordMinuti]);
INI_WriteInt(File,"RekordSekunde",UtrkaInfo[utrkaRekordSekunde]);
INI_WriteInt(File,"Krugova",krugova);
INI_WriteInt(File,"Vozila",vozila);
for(new cp = 1; cp < UtrkaInfo[utrkaBrojCP]+1; cp++)
{
new cpid[124];
format(cpid,64,"CP_%d_PosX",cp);
INI_WriteFloat(File,cpid,CPInfo[cp][cpX]);
format(cpid,64,"CP_%d_PosY",cp);
INI_WriteFloat(File,cpid,CPInfo[cp][cpY]);
format(cpid,64,"CP_%d_PosZ",cp);
INI_WriteFloat(File,cpid,CPInfo[cp][cpZ]);
format(cpid,64,"CP_%d_Prolaz",cp);
INI_WriteInt(File,cpid,CPInfo[cp][utrkaProlaz]);
format(string,sizeof(string),"CP_%d_Krug",cp);
INI_WriteInt(File,cpid,CPInfo[cp][utrkaKrug]);
}
INI_WriteInt(File,"Zadnji_CP",UtrkaInfo[utrkaZadnjiCP]);
INI_WriteFloat(File,"CP_Radius",UtrkaInfo[CPRadius]);
INI_Close(File);
format(string,sizeof(string),"Utrka Spremljena | Ime utrke fajla: %s, Krugova: %d, Vozila: %d",naziv,krugova,vozila);
SCM(playerid,COLOR_ZUTA,string);
UtrkaIzrada[playerid] = 0;
}
else return SendClientMessage(playerid,COLOR_GRAD2,"{FFFFFF}[{48E31C}G-Protect{FFFFFF}] {C3C3C3}ODBIJENO!");
return 1;
}