Problem(error/warning): oko ucitavanja samp-server.exe
Deo skripte: :
Pawno Code: [Izaberi] //
Debug iz server_log(ukoliko je u pitanju crashanje servera - crashdetect log): https://pastebin.com/2uFT0uwt ip je tu xd lagano
Pawno Code: [Izaberi]//
//
Slika/video ingame problema(obavezno ako je ingame problem): https://pastebin.com/2uFT0uwt
kada se connecta na server, server se ugasi
[pawn]LogSave (gde[]=@04e6ece4 "Ostalo/LogConnect.log", string[]=@0613dd0c "Igrac: almex | IP: 31.176.169.197 ") at C:\Users\almir\Desktop\VIBE GAMING\gamemodes\VG.pwn:14951[/pawn]
Proveri liniju 14951
Citat: V01D poslato Decembar 06, 2021, 23:43:01 POSLE PODNE
[pawn]LogSave (gde[]=@04e6ece4 "Ostalo/LogConnect.log", string[]=@0613dd0c "Igrac: almex | IP: 31.176.169.197 ") at C:\Users\almir\Desktop\VIBE GAMING\gamemodes\VG.pwn:14951[/pawn]
Proveri liniju 14951
[pawn]stock LogSave( gde[], string[]) {
new entry[ 128 ], s, m, se, day, year, month;
getdate( year, month, day );
gettimeEx( s, m, se );
FixHour( s );
s = shifthour;
format( entry, sizeof( entry ), "%d/%d/%d | %d/%d/%d | %s\r\n", day, month, year, s, m, se, string );
new File:hFile;
hFile = fopen( gde, io_append );
fwrite( hFile, entry );
fclose( hFile );
}[/pawn] ovo je cijeli taj stock
[22:57:39] [debug] #2 006e9b68 in public MP_OPC (playerid=0) at C:\Users\almir\Desktop\VIBE GAMING\gamemodes\VG.pwn:36761
[22:57:39] [debug] #3 native CallLocalFunction () from samp03svr
[22:57:39] [debug] #4 00628ac8 in public _y_utils_OnPlayerConnect (playerid=0) at C:\Users\almir\Desktop\VIBE GAMING\pawno\include\mSelection.inc:432
[22:57:39] [debug] #5 00035a48 in public SSCANF_OnPlayerConnect (playerid=0) at C:\Users\almir\Desktop\VIBE GAMING\pawno\include\YSI\..\YSI_Data\..\YSI_Internal\..\YSI_Core\y_utils.inc:301
[22:57:39] [debug] #6 00023e0c in public WC_OnPlayerConnect (playerid=0) at C:\Users\almir\Desktop\VIBE GAMING\pawno\include\sscanf2.inc:205
[22:57:39] [debug] #7 00007fbc in OnPlayerConnect (playerid=0, ... <1073741822 arguments>) at C:\Users\almir\Desktop\VIBE GAMING\pawno\include\weapon-config.inc:2151
[22:57:39] [debug] #8 0003a5d8 in public OnPlayerConnect (... <1 argument>) at C:\Users\almir\Desktop\VIBE GAMING\pawno\include\YSI\..\YSI_Data\..\YSI_Coding\..\YSI_Internal\y_cgen.inc:114
Provjeri ovu liniju jer od njega krece problem [22:57:39] [debug] #2 006e9b68 in public MP_OPC (playerid=0) at C:\Users\almir\Desktop\VIBE GAMING\gamemodes\VG.pwn:36761
https://open.mp/docs/scripting/functions/fwrite
Using an invalid handle will crash your server! Get a valid handle by using fopen or ftemp.
99% je to da nemas folder/dir "Ostalo" u scriptfiles. Napravi ga.
stock LogSave( gde[], string[]) {
new entry[ 128 ], s, m, se, day, year, month;
getdate( year, month, day );
gettimeEx( s, m, se );
FixHour( s );
s = shifthour;
format( entry, sizeof( entry ), "%d/%d/%d | %d/%d/%d | %s\r\n", day, month, year, s, m, se, string );
new File:hFile;
hFile = fopen( gde, io_append );
if (hFile) { // ako je handle validan tek onda koristis fwrite i fclose
fwrite( hFile, entry );
fclose( hFile );
}
}
@xunder nije 99% nego 100%, xunder je u pravu nemas dir Ostalo napravi to u scriptfiles
Citat: temporaryMember. poslato Decembar 09, 2021, 04:09:56 PRE PODNE
@xunder nije 99% nego 100%, xunder je u pravu nemas dir Ostalo napravi to u scriptfiles
Nisam siguran sta se desava kada pokusas fopen file na kojem nemas permisiju za read, moguce je i da tada crashuje ::)
crasha ti kada skripta pokusava da ucita/spremi nesto iz nekog fajla kojeg nema u scriptfiles u tvome slucaju se radi o upisivanju u fajl koji ne postoji i desava se pad servera
// ovo ce ti crash jer ne provjerava je li validno i da li postoji fajl msm crash ce se desiti ako fajl ne postoji ali ako postoji ono ce izvrsiti radnju bez provjere ali vecinom slucaja se zaboravi napraviti i desi se boom :
[pawn]new File:upis= fopen("upis.txt", io_read);
new buf[128];
fread(upis, buf);
fclose(upis);[/pawn]
ovo ti provjerava je li validno i ako ne moze da otvori ispisat ce da ne postoji:
[pawn]new File:upis = fopen("upisivanje.txt", io_read);
if (upis) {
new buf[128];
fread(upis, buf);
fclose(upis);
} else {
printf("ne moze se otvoriti upisivanje.txt izgleda da ne postoji");
}[/pawn]