Quote:
Originally Posted by Ricop522
pawn Код:
if(strcmp(cmd, "/bug", true) == 0) { if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "use: /bug texto");
new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[128]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) return SendClientMessage(playerid, -1, "use: /bug [bug]"); new y,m,d; new h,mi,s; getdate(y,m,d); gettime(h,mi,s); new nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, nome, sizeof(nome); format(string, sizeof(string),"(%d/%d/%d)[%d:%d:%d] BUG de %s: %s",d,m,y,h,mi,s,nome, (result)); BugsLog(string); return 1; }
forward BugsLog(string[]); public BugsLog(string[]) { new entry[128]; format(entry, sizeof(entry), "%s\r\n",string); new File:hFile; hFile = fopen("bugs.log", io_append); fwrite(hFile, entry); fclose(hFile); }
|
Cara, funcionou perfeito, sу que tive de fazer alguns ajustes, tal como criar a variбvel string que vocк esqueceu, e tambйm colocar um parenteses, ta ae o cуdigo arrumado pra quem precisar
pawn Код:
if(strcmp(cmd, "/bug", true) == 0)
{
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "use: /bug texto");
new length = strlen(cmdtext);
new string[256];
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, -1, "use: /bug [bug]");
new y,m,d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
format(string, sizeof(string),"(%d/%d/%d)[%d:%d:%d] BUG de %s: %s",d,m,y,h,mi,s,nome, (result));
BugsLog(string);
return 1;
}