forward RadioBroadCast(playerid, Float:radi, color, string[]);
public RadioBroadCast(playerid, Float:radi, color, string[])
{
new MiscString[128];
foreach(new i : Player)
{
if(PlayerInfo[i][pRadioFreq] == PlayerInfo[playerid][pRadioFreq] && PlayerInfo[i][pRadio] == 1)
{
for(new Words; Words < sizeof(BannedWords); Words++) //Sets a loop as it checks the words one by one.
{
if(strfind(string,BannedWords[Words],true) != -1 ) // Checks if the text includes any of the defined Swear Words or not
{
SendClientMessage(playerid, -1, "Using OOC Words in IC chat is prohibited.");
return 1; // return 0; to avoid sending the text in chat.
}
}
format(MiscString, sizeof(MiscString), "** [%d khz] %s: %s **", PlayerInfo[playerid][pRadioFreq], GetName(playerid), string);
SendClientMessage(i, color, MiscString);
format(MiscString, sizeof(MiscString), "(radio) %s says: %s", GetName(playerid), string);
ProxDetector(radi, playerid, MiscString,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
SetPlayerChatBubble(playerid,string,COLOR_WHITE,5.0,5000);
format(MiscString, sizeof(MiscString), "[%d khz] %s (IP: %s): %s", PlayerInfo[playerid][pRadioFreq], GetName(playerid), GetPlayerIpEx(playerid), string);
Log("logs/radio.log", MiscString);
}
}
return 1;
}
Log("logs/radio.log", MiscString);
pawn Код:
|
new
File: log_file = fopen( "logs/radio.log", io_append )
;
if( log_file ) // it opened correctly, now you can write to it. Othewise you try to write to a closed file which cause problems
{
fwrite( log_file, "some logs here" );
fclose( log_file );
}