04.08.2015, 07:25
PHP код:
YCMD:mensagem(playerid, params[], help)
{
new msgText[256];
if(sscanf(params, "s[256]", msgText))
return SendClientMessage(playerid, -1, "/mensagem [texto]");
new
playerName[MAX_PLAYER_NAME],
file[16] = "PASTA/ARQUIVO.txt",
string[600];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
if(!fexist(file)) {
new File: f = fopen(file, io_write);
fclose(f);
}
format(string, sizeof(msgText) + 32, "%s: %s\r\n", playerName, msgText);
new File: f = fopen(file, io_append);
fwrite(f, string);
fclose(f);
SendClientMessage(playerid, -1, "Mensagem adicionada com sucesso!");
return 1;
}