17.04.2017, 23:29
Ok so im trying to make an offline jailing system this is my code.
Also could someone tell me how to read from a specific line in y_ini. Example say i want to show the players reason why he was banned on his next connection to the server , how do i read from the file..
Dont send me the link to the Y_ini topic cause i tried it already and failed... So could someone explain it and show me as well.
PHP код:
CMD:ojail(playerid, params[])
{
if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 4)
{
new playerb[32], string[128], file[32], time[6];
if(sscanf(params, "s[32]i[6]s[128]", playerb, time, params)) return SendClientMessage(playerid, error, "Usage: /ojail [playername] [time] [reason]");
if(idCheck(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, error, "Player is connected to the server, use /ajail instead.");
if (!fexist(file)) return SendClientMessage(playerid,error,"Error: This player doesn't have an account.");
new INI:ACCOUNT = INI_Open(file);
INI_SetTag(ACCOUNT,"data");
INI_WriteInt(ACCOUNT, "Jailed", 2);
INI_WriteInt(ACCOUNT, "JailedTime", time);
INI_Close(ACCOUNT);
format(string, sizeof(string), "[AdmCmd]: {FF6347}An Administrator has been jailed %s. [Reason: %s]", playerb, params);
SendClientMessageToAll(red, string);
format(string, sizeof(string), "[OJAIL] %s has offline jailed %s . [Reason: %s]", GetName(playerid), playerb, params);
WriteToLog(string,"oJail");
}
else return ShowMessage(playerid, error, 1);
return 1;
}
//But i keep getting an argument type mismatch at this line
INI_WriteInt(ACCOUNT, "JailedTime", time);
Dont send me the link to the Y_ini topic cause i tried it already and failed... So could someone explain it and show me as well.