04.08.2016, 09:22
You can use this as non stable way to check stream_distance vaule at the moment until this bug gets fixed.
how it works?
Sending rcon command varlist by the script then by a help from FileManager plugin move server log to scriptfiles folder then read last lines and get stream_distance vaule.
FileManager Plugin:
http://www.jatochnietdan.com/project/sa-mp/filemanager
Script:
Usage example:
how it works?
Sending rcon command varlist by the script then by a help from FileManager plugin move server log to scriptfiles folder then read last lines and get stream_distance vaule.
FileManager Plugin:
http://www.jatochnietdan.com/project/sa-mp/filemanager
Script:
PHP Code:
#include a_samp
#include filemanager
#pragma dynamic 18000
Float:GetServerVarAsFloat(var[])
{
new Handle[5500];
if(!strcmp(var,"stream_distance", true))
{
strcat(Handle, GetServerLog());
new where = strfind(Handle, "stream_distance", true, 0);
strdel(Handle, 0, where);
strdel(Handle, 0, strfind(Handle,"=", true, 0)+2);
where = strfind(Handle,"(float)", true, 0);
if(where != -1)
{
strdel(Handle, where, strlen(Handle));
}
fremove("server_log.txt");
}
else
{
Handle = "0.0";
}
return floatstr(Handle);
}
GetServerLog()
{
SendRconCommand("varlist");
file_copy("server_log.txt", "scriptfiles/server_log.txt");
new File:handle = fopen("server_log.txt", io_read);
new Handle[5500];
if(handle)
{
fseek(handle, -5000, seek_end);
new buf[350];
while(fread(handle, buf))
{
strcat(Handle, buf);
}
new where = strfind(Handle,"Console Variables:", true, where)+1;
while(strlen(Handle) && strfind(Handle,"Console Variables:", true, where))
{
where = strfind(Handle,"Console Variables:", true, where)+1;
strdel(Handle, 0, where-1);
}
fclose(handle);
}
else
{
Handle = "stream_distance = 301.000000";
}
return Handle;
}
PHP Code:
public OnFilterScriptInit()
{
new str[128];
format(str, sizeof str,"stream_distance Vaule is: %f", GetServerVarAsFloat("stream_distance"));
SendClientMessageToAll(-1, str);
}