21.01.2016, 00:52
PHP код:
command(arrest, playerid,params[])
{
new string[128];
new ID;
new time;
if (sscanf(params, "ud", ID, time))
{
if(Factions[Player[playerid][Faction]][CommandTypes] == 1 || Factions[Player[playerid][Faction]][CommandTypes] == 3)
{
SendClientMessage(playerid, COLOR_GREY, "SYNTAX: /arrest [playerid/name] [minutes]");
}
else
{
RemoveTextMessage(playerid);
TextDrawShowForPlayer(playerid, Text:CantCommand);
SetTimerEx("RemoveTextMessage", 3500, false, "d", playerid);
}
}
if(GetDistanceBetweenPlayers(playerid,ID) > 4)
{
format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to arrest him.",RPName(ID),ID);
SendClientMessage(playerid,-1,string);
return 1;
}
if(GetDistanceBetweenPlayers(playerid,ID) <= 4)
{
ResetPlayerWeapons(ID);
Player[ID][Arrest] = 1;
Player[ID][PrisonTime] = time * 60;
SetPlayerSpecialAction(ID, SPECIAL_ACTION_NONE);
format(string, sizeof(string), "> You've arrested %s for %d days at San Andreas Prison.", RPName(ID), time);
SendClientMessage(playerid, SPECIALORANGE, string);
format(string, sizeof(string), "> %s has you arrested for %d days at San Andreas Prison.", RPName(playerid), time);
SendClientMessage(ID, SPECIALORANGE, string);
}
return 1;
}
If you just put /arrest to check if it works, (Without ID and Time)
You will get
/arrest [id][time]
> You've arrested %s for %d days at San Andreas Prison.
> %s has you arrested for %d days at San Andreas Prison.