Down - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Down (
/showthread.php?tid=633096)
Down -
Loinal - 25.04.2017
PHP код:
//OnPlayerSpawn
new hour,minute,seconds,year,day,month;
gettime(hour,minute,seconds);
getdate(day,month,year);
new NewLog[100+1000];
format(NewLog,sizeof(NewLog),"%s - Level: %d (Last logged in %d/%d/%d %d:%d:%d)",GetName(playerid), pData[playerid][Admin], year, month, day, hour, minute, seconds);
LogInLog(NewLog);
ForEach(i, MAX_PLAYERS)
{
if(pData[playerid][Admin] >= 3)
{
SendClientMessage(i, 0x00FF0054, NewLog);
}
}
When player spawn the server get down why? i mean server automaticly stops
Re: Down -
Kane - 25.04.2017
What's
ForEach(i, MAX_PLAYERS)?
Re: Down -
jlalt - 25.04.2017
probably its crashing so use crashdetect plugin with third debug value on your script and tell us what being printed in server.log after the shut down / crash.
Crashdetect:
https://sampforum.blast.hk/showthread.php?tid=262796
third debug:
https://github.com/Zeex/samp-plugin-...ith-debug-info
Re: Down -
Loinal - 25.04.2017
Quote:
Originally Posted by jlalt
probably its crashing so use crashdetect plugin with third debug value on your script and tell us what being printed in server.log after the shut down / crash.
Crashdetect:
https://sampforum.blast.hk/showthread.php?tid=262796
PHP код:
[11:30:12] [join] Martex has joined the server (0:127.0.0.1)
[11:30:20] [debug] Server crashed while executing ZoneX.amx
[11:30:20] [debug] AMX backtrace:
[11:30:20] [debug] #0 native fwrite () from samp-server.exe
[11:30:20] [debug] #1 0004d844 in public LogInLog (NewLog[]=@00c24ff0 "Martex - Level: 10 (Last logged in 25/4/2017 11:30:20)") at D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn:3757
[11:30:20] [debug] #2 0004e910 in public OnPlayerSpawn (playerid=0) at D:\samp folder\ZoneX - ZX\gamemodes\ZoneX.pwn:3846
[11:30:21] [debug] Native backtrace:
[11:30:21] [debug] #0 77ae7322 in ?? () from C:\Windows\SYSTEM32\ntdll.dll
[11:30:21] [debug] #1 00498bb8 in ?? () from samp-server.exe
[11:30:21] [debug] #2 0040531e in ?? () from samp-server.exe
third debug:
https://github.com/Zeex/samp-plugin-...ith-debug-info
|
Quote:
Originally Posted by Arthur Kane
What's ForEach(i, MAX_PLAYERS)?
|
Код:
#define ForEach(%0,%1) \
for(new %0 = 0; %0 != %1; %0++) if(IsPlayerConnected(%0) && !IsPlayerNPC(%0))
Re: Down -
jlalt - 25.04.2017
PHP код:
LogInLog(NewLog);
->
PHP код:
[11:30:20] [debug] #0 native fwrite () from samp-server.exe
You're trying to write inside a file which doesn't exist!
https://sampwiki.blast.hk/wiki/Fwrite
Quote:
Using an invalid handle will crash your server! Get a valid handle by using fopen or ftemp.
|
so go on LogInLog function and see which file it writes on it and create it manually!
Re: Down -
Loinal - 25.04.2017
so should i type the folder name InLog or the file which inside the folder wish is logs.log
Re: Down -
jlalt - 25.04.2017
Quote:
Originally Posted by Loinal
so should i type the folder name InLog or the file which inside the folder wish is logs.log
|
the file which this function writes in it seems to be not created yet so all you have to do it creating it. [ ex create .txt file then change its name extension ]
Re: Down -
Loinal - 25.04.2017
Quote:
Originally Posted by jlalt
the file which this function writes in it seems to be not created yet so all you have to do it creating it. [ ex create .txt file then change its name extension ]
|
PHP код:
forward LogInLog(NewLog[]);
public LogInLog(NewLog[])
{
new Log[100+1000];
format(Log,sizeof(Log),"%s", NewLog);
new File:hFile;
hFile = fopen("InLogs/login.log");
fwrite(hFile, Log);
fclose(hFile);
}
Re: Down -
jlalt - 25.04.2017
go to script files folder see if there's a folder called InLogs if no then create it and also be sure login.log file exist inside it.
Re: Down -
Loinal - 25.04.2017
Thanks