28.08.2011, 23:11
Код:
forward TestLog(string[]);
Код:
#define TESTTEST 1
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/testt", cmdtext, true, 10) == 0) { ShowPlayerDialog(playerid,TESTTEST, DIALOG_STYLE_INPUT, "Server Comment Box", "Type your comment here.", "Submit", "Cancel"); return 1; } return 0; }
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == TESTTEST) { if(response) { new string[120]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); strval(inputtext); format(string, sizeof(string), "Message sent %s %s",sendername, inputtext); SendClientMessageToAll(COLOR_WHITE, string); TestLog(string); return 1; } } return 1; }
Код:
public TestLog(string[]) { new entry[200]; format(entry, sizeof(entry), "%s\r\n",string); new File:hFile; hFile = fopen("testt.log", io_append); fwrite(hFile, entry); fclose(hFile); }