CMD:kick(playerid,params[])
{
new string[200];
if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid, COLOR_ERROR, "Error: Insufficient Permission");
if(sscanf(params, "us[200]", ID, string))
{
SendClientMessage(playerid, COLOR_ADCMD, "Usage: /kick (id) (reason)");
SendClientMessage(playerid, COLOR_ADCMD2, "Function: Will kick the specified player");
return 1;
}
if(pInfo[ID][Adminlevel] > pInfo[playerid][Adminlevel])
{
SendClientMessage(playerid, COLOR_ERROR, "Error: You cannot kick higher level staff members");
return 1;
}
if(pInfo[playerid][Adminlevel] >= 2)
{
if(IsPlayerConnected(ID) && ID != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "**%s(%d) has been kicked by an Administrator | Reason: %s", GetName(ID), ID, string);
SendClientMessageToAll(COLOR_LIGHTRED, string);
format(string, sizeof(string), "**%s has been kicked by Administrator %s | Reason: %s", GetName(ID), GetName(playerid), string);
SaveIn("KickLog",string);
pInfo[ID][Kicked] ++;
SetTimerEx("KickEx", 500, false, "d", ID);
return 1;
}
}
return 1;
}
SaveIn("KickLog",string);
CMD:kick(playerid,params[])
{
print("1");
new string[200];
if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid, COLOR_ERROR, "Error: Insufficient Permission");
print("2");
if(sscanf(params, "us[200]", ID, string))
{
SendClientMessage(playerid, COLOR_ADCMD, "Usage: /kick (id) (reason)");
SendClientMessage(playerid, COLOR_ADCMD2, "Function: Will kick the specified player");
return 1;
}
print("3");
if(pInfo[ID][Adminlevel] > pInfo[playerid][Adminlevel])
{
SendClientMessage(playerid, COLOR_ERROR, "Error: You cannot kick higher level staff members");
return 1;
}
print("4");
if(pInfo[playerid][Adminlevel] >= 2)
{
if(IsPlayerConnected(ID) && ID != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "**%s(%d) has been kicked by an Administrator | Reason: %s", GetName(ID), ID, string);
SendClientMessageToAll(COLOR_LIGHTRED, string);
format(string, sizeof(string), "**%s has been kicked by Administrator %s | Reason: %s", GetName(ID), GetName(playerid), string);
print("before kicklog");
SaveIn("KickLog",string);
print("after kiclog");
pInfo[ID][Kicked] ++;
print("before timer");
SetTimerEx("KickEx", 500, false, "d", ID);
print("after timer");
return 1;
}
}
print("end of command");
return 1;
}
|
SaveIn problably saves a file in the folder, and the folder isnt created. This error is commonly known to me, and has lead to many rage moments. Make sure you have folders required for SaveIn function to actually create files in folders.
|
|
Unless you're using io_append or io_readwrite, make sure the actual FILE is created.
|
public SaveIn(filename[],text[])
{
new File:Lfile;
new filepath[256];
new string[256];
new year,month,day;
new hour,minute,second;
getdate(year,month,day);
gettime(hour,minute,second);
format(filepath,sizeof(filepath),"Logs/%s.txt",filename);
Lfile = fopen(filepath,io_append);
format(string,sizeof(string),"[%02d/%02d/%02d | %02d:%02d:%02d] %s\r\n",day,month,year,hour,minute,second,text);
fwrite(Lfile,string);
fclose(Lfile);
return 1;
}
|
The folder it's attempting to save it to, 'Logs', is with a capital letter. Make sure that the actual folder you created is exactly the same, this includes the uppercase letter.
|