format(string, sizeof(string), "You are jailed for %d minutes. Bail: Unable", minutes);
Код:
format(string, sizeof(string), "You are jailed for %d minutes. Bail: Unable", minutes); |
new Text: timeLeft;
timeLeft = TextDrawCreate(299.5 ,400 , " ");
TextDrawFont(timeLeft , 1);
TextDrawLetterSize(timeLeft , 1, 7);
TextDrawColor(timeLeft , 0xed37b3FF);
TextDrawSetOutline(timeLeft , false);
TextDrawSetProportional(timeLeft , true);
TextDrawSetShadow(timeLeft , 0);
forward UpdateJailText()
public UpdateJailText()
{
foreach(Player, i)
{
if(GetPVarInt(i, "Jailed") >= 1)
{
new string[32];
format(string, sizeof string, "Time left in jail: %d minutes!", GetPVarInt(i, "Jailed"));
TextDrawSetString(timeLeft, string);
TextDrawShowForPlayer(playerid, timeLeft);
}
if(GetPVarInt(i, "Jailed") == 0)
{
TextDrawHideForPlayer(playerid, timeLeft);
}
}
}
// at the top
new timlf_tm;
// on game mode init
timlf_tm = SetTimer(UpdateJailText, 5000, true);
// gmx
KillTimer(timlf_tm);
CMD:jail(playerid,params[])
{
new targetid,reason[50],string[128],minutes;
if(!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params, "uds[50]", targetid, minutes, reason))return SendClientMessage(playerid, COLOR_WHITE, "/jail [playerid/name] [time in minutes] [reason]");
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_WHITE, "Error: This player is not connected.");
if(Spawned[targetid] == 0) return SendClientMessage(playerid,COLOR_WHITE,"Error: This Player Is Not Spawned.");
if(PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playerid,COLOR_WHITE,"Error: This player is already in jail.");
else
{
new calc = minutes*60;
PlayerInfo[targetid][pJailTime] = calc;
PlayerInfo[targetid][pAdminJailed] = 1;
ResetPlayerWeapons(targetid);
SetPlayerScore(targetid,GetPlayerScore(targetid)-1);
GameTextForPlayer(targetid,"~r~JAILED!",7000,4);
PutPlayerInJail(targetid);
format(string, sizeof(string), "%s(%d) has been Jailed by an Administrator - Reason: %s", GetName(targetid), targetid, reason);
SendClientMessageToAll(COLOR_WHITE,string);
Releaser[targetid] = SetTimerEx("JailTime",calc*1000, false, "i", targetid);
}
return 1;
}
public JailTime(playerid)//just add this codes in your unjail timeri mean when the player get unjailed
{
new timer[20];
Releaser[playerid]--;
if(Releaser[playerid] > 0)
{
format(timer,sizeof(timer),"~r~Jailed: %d",Releaser[playerid]);
GameTextForPlayer(playerid,time,500,3);
}
return 1;
}