Jump to content
  • 0

Log


heker

Question

2 answers to this question

Recommended Posts

face mai mult lag,de fiecare data cand un player foloseste o comanda sa deschida un fisier,sa scrie in el si apoi sa il inchida..


[tt]

//global(la inceput)
new ValidCommand[MAX_PLAYERS];
//la OnPlayerCommandText
//la inceput
ValidCommand[playerid]=1;
SetTimerEx("LogCmd",2000,0,"is",playerid,cmdtext);
//la sfarsitul functiei,dar inainte de return 0;
ValidCommand[playerid]=0;
//dupa functia OnPlayerCommandText,adic dupa return 0;}
forward LogCmd(playerid,cmdtext[]);
public LogCmd(playerid,cmdtext[])
{
if(!IsPlayerConnected(playerid))return 0;
new str[90],y,m,d,h,mi,s,pn[24];
getdate(y,m,d);
gettime(h,mi,s);
GetPlayerName(playerid,pn,24);
format(str,90,"[%d.%d.%d:%d%d%d] %s[%d] used %s",y,m,d,h,mi,s,pn,playerid,cmdtext);
new File:Handler=fopen("log.txt",io_append);
fwrite(Handler,str);
fclose(Handler);
return 1;
}

[/tt]


Daca apar erori zi,ca l'am facut pe loc ...

PS:Am folosit timer si gvar ca sa nu scrie orice comanda pe care o foloseste :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.