View Full Version : Server Crashing.... Please Help

04/04/2012, 01:36 PM
Please Help Me Please

#define reportPATH "Logs/ReportLog.txt"

The folder is in the right place


new Target; //define the target's name
new Reason[128];//the report-reason
if(!sscanf(params, "us[32]",Target, Reason))
if(Target == playerid) return SendClientMessage(playerid, COLOR_RED, "SERVER: Cant perform this command on yourself!"); //comment this line if you want to try this cmd on yourself
if(!IsPlayerConnected(Target)) //if the ID is invalid
return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected!"); //send the player a message, that the ID doesn't exist

new tname[MAX_PLAYER_NAME]; //the name of player one (reporting)
new pname[MAX_PLAYER_NAME]; //the name of player two (the reported)
GetPlayerName(Target,tname,sizeof(tname)); //get (receive) the player's name for the first
GetPlayerName(playerid,pname,sizeof(pname)); //get (receive) the player's name for the second

new rstring[256]; //the report-string
format(rstring,sizeof(rstring),"* Player %s(%d) reported %s(%d)! (Reason: %s)", pname,playerid,tname,Target,Reason); //only admins will receive this message! a specific player with a reason got reported, here we'll use all variables created
SendMessageToAdmins(COLOR_WHITE,rstring); //we'll talk about that later

//NOW HERE, we'll open the reportpath and WRITE into it
new File:Log = fopen(reportPATH, io_append); //here you're opening the path defined
new logData[128]; //create the logdata we wanna write in
new name[MAX_PLAYER_NAME]; //define the name again
GetPlayerName(Target,name,sizeof(name)); //receive the name again
new fTime[6]; //create the specific time for the report
getdate(fTime[0], fTime[1], fTime[2]); //get the report's date
gettime(fTime[3], fTime[4], fTime[5]); //get the report's time
format(logData, sizeof logData, "[%02d/%02d/%04d || %02d:%02d:%02d]%s got reported by %s! (Reason: %s)\r\n", fTime[2], fTime[1], fTime[0], fTime[3], fTime[4], fTime[5], tname, pname, Reason); //this will write everything (name,reason,time,date etc.) into the logdata
fwrite(Log, logData); //write it into the path
fclose(Log); //close the log, finished!
else return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /report <playerid> <reason>"); //detects the wrong params from sscanf and send the client this message

return 1;

public SendMessageToAdmins(color,const string[]) //create the callback, including color and string
for(new i = 0; i < MAX_PLAYERS; i++) //set a for-loop and loop through all the admins
if(IsPlayerConnected(i) == 1) //the admin gotta be connected
if(PlayerInfo[i][pAdmin] >= 1) //and his level gotta be at least 1 (or higher)
SendClientMessage(i, color, string); //send this message now to every admin online, with color + string!
return 1;

Please Help Me Please

04/04/2012, 03:25 PM
Please Help