10.04.2017, 08:16
my goal is to make it so when a player is released from admin jail (either by an admin or by his time running out) it spawns him back in the place he originally was when he was admin jailed
ive been messing around with GetPlayerPos and SetPlayerPos but im not having any luck
id also like to GetPlayerVirtualWorld and GetPlayerInterior but i could probably figure myself by applying the same method as the GetPlayerPos one
ive been messing around with GetPlayerPos and SetPlayerPos but im not having any luck
id also like to GetPlayerVirtualWorld and GetPlayerInterior but i could probably figure myself by applying the same method as the GetPlayerPos one
pawn Код:
CMD:ajail(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] > 0)
{
new targetid, minutes, reason[205], str[205];
if(sscanf(params, "ris[205]", targetid, minutes, reason)) return SendClientMessage(playerid, COLOR_ADMIN, "USAGE: /ajail [id] [minutes] [reason]");
if(minutes <= 0 || minutes > 180) return SendClientMessage(playerid, COLOR_ADMIN, "ERROR: Minutes can't be less than 0 or more than 180!");
if(inJail[targetid]) return SendClientMessage(playerid, COLOR_ADMIN, "ERROR: This player is already jailed.");
if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You can't jail yourself!");
if(pInfo[targetid][pAdminLevel] > pInfo[playerid][pAdminLevel]) return SendClientMessage(playerid, COLOR_RED, "You can't jail higher level admins!");
format(str, sizeof(str), "%s has jailed %s for %d minute(s), reason: %s", PlayerName(playerid), PlayerName(targetid), minutes, reason);
SendSplitMessageToAll(COLOR_ADMIN, str);
JailTimer[targetid] = SetTimer("Unjail", minutes*60*1000, false);
SetPlayerPos(targetid, 264.4176, 77.8930, 1001.0391);
SetPlayerInterior(playerid, 6);
SetPlayerVirtualWorld(playerid, 99);
inJail[targetid] = true;
}
else return SendClientMessage(playerid, -1, "uhh ur not an admin so why are you trying to do that");
return 1;
}
/**************************************************************************************************************************************************/
CMD:unjail(playerid, params[])
{
if(pInfo[playerid][pAdminLevel] > 0)
{
new targetid, string[128];
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_ADMIN, "/unjail [ID]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ADMIN, "ERROR: This player is not online.");
if(!inJail[playerid]) return SendClientMessage(playerid, COLOR_ADMIN, "ERROR: This player is not admin jailed.");
if(inJail[targetid])
{
format(string, sizeof(string), "%s has been released from admin jail by %s.", PlayerName(targetid), PlayerName(playerid));
SendSplitMessageToAll(COLOR_ADMIN, string);
SpawnPlayer(playerid);
SetPlayerInterior(playerid, 0);
inJail[playerid] = false;
KillTimer(JailTimer[playerid]);
SendClientMessage(playerid, COLOR_ADMIN, "SERVER: You've been released from admin jail.");
}
}
else return SendClientMessage(playerid, -1, "ey mang ur not an admin so cut it out");
return 1;
}
/**************************************************************************************************************************************************/
forward Unjail(playerid);
public Unjail(playerid)
{
SpawnPlayer(playerid);
SetPlayerInterior(playerid, 0);
inJail[playerid] = false;
KillTimer(JailTimer[playerid]);
SendClientMessage(playerid, COLOR_ADMIN, "SERVER: You've been released from admin jail.");
}