Jump to content

script Info ze server


Ewwe

Recommended Posts

  • Administrátor

Zdravím chtěl bych uvést několik fixů ... Když jsem psal tento script ještě jsem pořádně nechápal funkci HTTP ani jak sní pracovat. Nyní se to změnilo a už vím jaké nedokonalosti v něm jsou...

 

Script takto jak je uveden bude na web odesílat informace jen a pouze pro id 0.

je nutno změnit HTTP(0, na HTTP(playerid, pak bude stačit in string global anemusí se sním nic dělat. K erroru malformed response tento eror neovlivnuje funkčnost scriptu pokud nečekáte odesílání dat z webu na server. V opadčném způsobu tedy v uvedeném výše je bezvýznamný .

Ale způsob jak ho fixnout je to přijímacího scriptu na webu vložit :

header("Content-type:
Link to comment
Share on other sites

  • 2 weeks later...

Urobil som do toho dalšiu kktinku...

do public OnPlayerDeath(playerid, killerid, reason)

 

    gettime(hodina,minuta,vterina),getdate(rok,mesic,den);
    format(Global,256,"server=[%02d:%02d:%02d|%02d/%02d/%d] %s bol zabitý hráčom %s\r",hodina,minuta,vterina,mesic,den,rok,N(playerid),N(killerid));
    HTTP(0, HTTP_POST,URL, Global, "MyHttpResponse");

;)

snád sa zíde

Link to comment
Share on other sites

niečo také:

OnPlayerCommandText:

new bstring[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(fexist("chatlog.txt"))
{
   new File:CL = fopen("chatlog.txt", io_append);
   if(CL)
   {
       new h, m, s, y, mm, d;
       gettime(h, m, s);
       getdate(y, mm, d);
       format(bstring, sizeof(bstring), "[%i/%i/%i] | [%i:%i:%i] %s: %s\r\n", d, mm, y, h, m, s, name, text);
       fwrite(CL, bstring);
       fclose(CL);
   }
}

 

Na stránku s příponou *.php:

<?php
$resource = ftp_connect('ftp.hostname.com');
$login = ftp_login($resource, 'FTP Username', 'FTP Password');
$file = ftp_get($resource, 'chat.txt', '/scriptfiles/chatlog.txt', FTP_BINARY);
$dump = file_get_contents('chat.txt');
print'';
print($dump);
print'';
?>

Link to comment
Share on other sites

A ešte si mohol pridať Online hráči ako take dačo ale aby sa to staré furt zmazalo ked je ešte online ... Ked je online aktualizuje čas :) skusil som dačo take...

public IsPlayerOnline(playerid)
{
   gettime(hodina,minuta,sekunda),getdate(rok,mesiac,den);
   format(global,150,"server=[%02d:%02d:%02d|%02d/%02d/%d] %s je ONLINE\r",hodina,minuta,sekunda,mesiac,den,rok,meno(playerid));
   HTTP(0, HTTP_POST,URL, global, "MyHttpResponse");
   return 1;
}

ale jak na to aby sa to auktualizovalo a nie pridavalo nové :( diki :d

Link to comment
Share on other sites

  • 2 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...