16.07.2014, 14:01
I'm trying to fix the offline prison command on my server but I can't get it working. Is there someone that can help?
The problem is that the information doesn't get saved in the userfile of the player.
The problem is that the information doesn't get saved in the userfile of the player.
Код:
CMD:oprison(playerid, params[]) { new playerb[32], string[128], file[32], time; if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command."); if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); if(sscanf(params, "s[32]is[128]", playerb, time, params)) return SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /oprison [playername] [time] [reason]"); if(RPIDFN(playerb) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "Player is connected to the server, use /prison instead."); format(file, sizeof(file), "users/%s.ini", playerb); if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GREY, "Player name not found."); if(PlayerInfo[playerid][pAdmin] < dini_Int(file, "Admin")) return SendClientMessage(playerid, COLOR_GREY, "Player has a higher admin level than you."); format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid), params); SendClientMessageToAll(COLOR_LIGHTRED, string); format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", playerb, RPN(playerid) , params); // Prisoning new INI:filez = INI_Open("users/%s.ini", playerb); INI_WriteInt(filez, "Prison", 2); INI_WriteInt(filez, "PrisonTime", time*60); INI_WriteString(filez, "PrisonReason", params); INI_WriteString(filez, "PrisonBy", RPNU(playerid)); INI_Close(filez); return 1; }