17.03.2016, 17:51
If this is a command for sending an offline-player to jail, you will need to enter the information and then save the file by dini_close, just as ATGOggy stated in his reply.
Also, you will need to update Player[][pPrison], Player[][pPrisonTime] and Player[][pPrisonReason] correctly when the player logs on.
Although, the biggest problem here is that the PrisonTimer does not update the player position, neither does your /oprison. You'll therefore have to check if player is jailed on player connect or player login and use
Код:
IRP:oprison(playerid, var[]) { new user[32], string[128], file[32], time; if(!Logged(playerid)) return NoLogin(playerid); if(Player[playerid][pAdmin] < 3) return NoAuth(playerid); if(sscanf(var, "s[32]is[128]", user, time, var)) return SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /oprison [playername] [time] [reason]"); if(RPIDFN(user) != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD2, "Player is connected to the server, use /prison instead."); format(file, sizeof(file), "Accounts/%s.ini", user); if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_GRAD2, "Player name not found."); if(Player[playerid][pAdmin] < dini_Int(file, "Admin")) return SendClientMessage(playerid, COLOR_GRAD2, "Player has a higher admin level than you."); format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", user, GetName(playerid), var); SendClientMessageToAll(COLOR_LIGHTRED, string); format(string, sizeof(string), "AdmCmd: %s has been offline-prisoned by %s, reason: %s", user, GetName(playerid) , var); // Prisoning dini_IntSet(file, "pJail", 1); // Prisonreason dini_Set(file, "pJailReason", var); dini_Set(file, "pJailBy", GetName(playerid)); dini_IntSet(file, "pJailTime", time); dini_Close(file); return 1; }
Although, the biggest problem here is that the PrisonTimer does not update the player position, neither does your /oprison. You'll therefore have to check if player is jailed on player connect or player login and use
Код:
SetPlayerPos(playerid, x, y, z);