Help with jail
#1

How to make when i jail someone for 2 min and he left the server and come back again to put him again in jail for 2 min?
Reply
#2

You need to save the data and upload them when you connect, you could give more information in this regard? That system uses to save your data, variables etc.
Reply
#3

enums:
Код:
enum pInfo
{
	pPass,
	pAdmin,
	pVIP,
	pKills,
	pDeaths,
	pJailed,
	pMuted,
	pCash,
	pScore,
	pBanned,
	pFightStyle,
	pLoggedIn,
	pStreamer
};
cmd: jail

Код:
CMD:jail(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new giveplayerid, reason[50], minutes, pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME];
		if(sscanf(params, "uds[50]", giveplayerid, minutes, reason)) return SendClientMessage(playerid, WHITE, "USAGE: /jail [playerid/name] [time in minutes] [reason]"); 
		if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not connected.");
		if(PlayerInfo[giveplayerid][pAdmin] >= 5)
		{
			SendClientMessage(playerid, RED, "You cannot jail 5 level admin!");
		}
		else
		{
			GetPlayerName(playerid, pname1, sizeof(pname1));
			GetPlayerName(giveplayerid, pname2, sizeof(pname2));
			new str[250];
			SetPlayerVirtualWorld(giveplayerid, 0);
			SetPlayerPos(giveplayerid, 2055.0920, 2432.3054, 171.6713);
			SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
			PlayerInfo[giveplayerid][pJailed] = 1;
			format(str, sizeof(str), "ADMIN: %s jailed player %s for %d min. Reason: %s", pname1, pname2, minutes, reason);
			SendClientMessageToAll(RED, str);
			jtimer = SetTimerEx("Jailed", minutes*1000*60, false, "i", giveplayerid);
		}
	}
	else return SendClientMessage(playerid, RED, "You are not a admin!");
	return 1;
}
OnPlayerDisconnect:

Код:
if(PlayerInfo[playerid][pJailed] == 0)
{
PlayerInfo[playerid][pJailed] = 0;
KillTimer(jtimer);
}
Unjail command:

Код:
CMD:unjail(playerid, params[])
{

	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new giveplayerid, string[120];
		if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, WHITE, "USAGE: /unjail [playerid/name]");
		if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED, "Player not connected.");
		new pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME];
		GetPlayerName(playerid, pname1, sizeof(pname1));
		GetPlayerName(giveplayerid, pname2, sizeof(pname2)); 
		format(string, sizeof(string), "ADMIN: %s unjailed player %s.", pname1, pname2); 
		SendClientMessageToAll(GREEN, string); 
		KillTimer(jtimer);
		SpawnPlayer(giveplayerid);
	}
	else return SendClientMessage(playerid, RED, "You are not a admin!");
	return 1;
}
Public Jailed:
Код:
public Jailed(giveplayerid)
{
	SetPlayerVirtualWorld(giveplayerid, 0);
	SpawnPlayer(giveplayerid);
	SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE);
	KillTimer(jtimer);
	PlayerInfo[giveplayerid][pJailed] = 0;
	return 1;
}
Reply
#4

BUMP
Reply
#5

Hello, look at this .

Hello one.

Hello two.
Reply
#6

Try to change the public Jailed to this

Код:
public Jailed(giveplayerid)
{
	SetPlayerVirtualWorld(giveplayerid, 0);
	SpawnPlayer(giveplayerid);
	SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE);
	KillTimer(jtimer);
	PlayerInfo[giveplayerid][pJailed] = 1;
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)