22.08.2015, 13:29
Try that:
PHP код:
COMMAND:jail(playerid, params[])
{
new text[128],time,targetid,string[256],sendername[MAX_PLAYER_NAME],giveplayer[MAX_PLAYER_NAME];
if(sscanf(params, "uis[128]", targetid, time, text)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /jail [playerid] [minutes] [reason]");
else
{
if (GetPVarInt(playerid, "PlayerLogged") == 0) return SendClientMessage(playerid, COLOR_WHITE, "You must be logged in to use this.");
if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected !");
if(IsPlayerNPC(targetid)) return SendClientMessage(playerid, COLOR_GREY, "Can't do this to a NPC.");
if(strlen(text) >= 100) return SendClientMessage(playerid, COLOR_WHITE, "Reason is too long.");
if(GetPVarInt(playerid, "Admin") >= 2)
{
format(sendername, sizeof(sendername), "%s", AdminName(playerid));
format(giveplayer, sizeof(giveplayer), "%s", PlayerName(targetid));
GiveNameSpace(sendername);
GiveNameSpace(giveplayer);
format(string, sizeof(string), "AdmCmd: %s was jailed by %s, reason: %s", giveplayer, sendername, text);
SendAdminMessage(COLOR_LIGHTRED, string);
SetPVarInt(targetid, "Jailed", 2);
SetPVarInt(targetid, "JailTime", time*60);
strmid(PlayerInfo[targetid][pJailReason], text, 0, strlen(text), 255);
format(string, sizeof(string), "You are jailed for %d minutes.", time);
SendClientMessage(targetid, COLOR_WHITE, string);
format(string, sizeof(string), "REASON: %s.", text);
SendClientMessage(targetid, COLOR_WHITE, string);
SetPlayerPos(targetid,2523.9197,-1673.8944,14.8589);
TogglePlayerControllableEx(targetid, false);
SetPlayerInterior(targetid, 0);
SetPlayerVirtualWorld(targetid, targetid);
SetPVarInt(targetid, "Jails", GetPVarInt(targetid, "Jails")+1);
SetPVarInt(targetid, "Mute", 1);
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You do not have access to this command !");
}
return 1;
}