Vpr 1 Odesláno: 3. Únor, 2017 Share Odesláno: 3. Únor, 2017 Čáu lidi jsem tady zas mám problěm že tento kod nevytváří složku,potřeboval bych aby vytvořil složku a zapsal výsledky. KOD zde stock WriteLog(){ new st[128]; new Year, Month, Day; getdate(Year, Month, Day); format(st,128,"cw/%s.vs.%s.%d.%d.%d.txt",TeamName[TEAM_HOME],TeamName[TEAM_AWAY],Day,Month,Year); if(!fexist(st)){ fcreate(st); } new File:f = fopen(st,io_append); format(st,128,"%s vs %s - %d. round\r\n",TeamName[TEAM_HOME],TeamName[TEAM_AWAY],TeamRounds[TEAM_HOME]+TeamRounds[TEAM_AWAY]); fwrite(f,st); fwrite(f,"==============================================\r\nTeam Home\r\n"); ForPlayers(i){ if(Team[i] == TEAM_HOME){ new Float:ratio; if(Deaths[i] == 0) ratio = Kills[i]; else ratio = float(Kills[i])/float(Deaths[i]); format(st,128,"%s > Kills: %02d | Deaths: %02d | TeamKills: %02d | Ratio: %0.2f\r\n",Jmeno(i),Kills[i],Deaths[i],TeamKills[i],ratio); fwrite(f,st); } } fwrite(f,"Team Away\r\n"); ForPlayers(i){ if(Team[i] == TEAM_AWAY){ new Float:ratio; if(Deaths[i] == 0) ratio = Kills[i]; else ratio = float(Kills[i])/float(Deaths[i]); format(st,128,"%s > Zabiti: %02d | Smrti: %02d | TeamKilly: %02d | Ratio: %0.2f\r\n",Jmeno(i),Kills[i],Deaths[i],TeamKills[i],ratio); fwrite(f,st); } } fwrite(f,"==============================================\r\n"); format(st,128,"Kolo: %02d:%02d | Celkove: %02d:%02d : Kola: %02d:%02d\r\n",TeamScore[TEAM_HOME],TeamScore[TEAM_AWAY],TeamTotal[TEAM_HOME],TeamTotal[TEAM_AWAY],TeamRounds[TEAM_HOME],TeamRounds[TEAM_AWAY]); fwrite(f,st); fwrite(f,"==============================================\r\n\r\n\r\n"); fclose(f); } Díky za pomoc,zatím čáu. Link to comment Share on other sites More sharing options...
0 Hlavní moderátor vEnd 279 Odesláno: 3. Únor, 2017 Hlavní moderátor Share Odesláno: 3. Únor, 2017 Složku ti to nevytvoří, složku si musíš vytvořit sám. Link to comment Share on other sites More sharing options...
0 Vpr 1 Odesláno: 4. Únor, 2017 Author Share Odesláno: 4. Únor, 2017 Když vytvořím složku tak to nezapíše výsledky to právě nechápu Link to comment Share on other sites More sharing options...
0 ATomas 286 Odesláno: 9. Únor, 2017 Share Odesláno: 9. Únor, 2017 (upraveno) pokud pouzivas io_append tak io_append Appends (adds) to file, write-only. If the file does not exist, it is created. http://wiki.sa-mp.com/wiki/Fopen tj fcreate tam mit nemusis (jen pripominka k optimalizaci, kod ti to neopravi ) A co se stane? Predpokladam ze ti crashne server ze? Protoze nikde nevidim podminku o tom jestli si obdrzel pristup k souboru. (neco jako if(!f) return print("naser si"); ). A jak uz bylo receno pawn funkce neumi vytvaret slozky, ty uz musis mit pred zapisem vytvorene. Edited 9. Únor, 2017 by ATomas Link to comment Share on other sites More sharing options...
Dotaz
Vpr 1
Čáu lidi jsem tady zas mám problěm že tento kod nevytváří složku,potřeboval bych aby vytvořil složku a zapsal výsledky. KOD zde
Díky za pomoc,zatím čáu.
Link to comment
Share on other sites
3 odpovědí na tuto otázku
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now