27.08.2011, 20:54
pawn Код:
forward SayLog(string[]);
if(strcmp(cmd, "/say", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pAdmin] < 1) // aca modificalo como quieras
{
SendClientMessage(playerid, COLOR_GRAD2, "No eres admin !");
return 1;
}
new nick[MAX_PLAYER_NAME];
GetPlayerName(playerid, nick, sizeof(nick));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, 0xBFC0C2FF, "Utiliza: /say [texto]");
return 1;
}
format(string, sizeof(string), "Admin %s: %s " , nick, result);
SendClientMessageToAll(0x2587CEAA,string);
SayLog(string);
}
return 1;
}
public SayLog(string[])
{
new entrada[256];
format(entrada, sizeof(entrada), "%s\n",string); // aca es configurable, podes poner la ruta que quieras. ej. de esta carpeta: scriptfiles.
new File:hFile;
hFile = fopen("say.log", io_append);
fwrite(hFile, entrada);
fclose(hFile);
}