13.03.2015, 21:17
this is better.
Use the slots to sscanf, so it will be faster and do not need to create so many variables.
Use the slots to sscanf, so it will be faster and do not need to create so many variables.
PHP код:
CMD:jail(playerid,params[])
{
if(pInfo[playerid][pAdminLevel] >= 1)
{
new reason[100];
if(sscanf(params, "uis[100]", params[0], params[1], reason))
return SendClientMessage(playerid, -1, "*"COL_WHITE" /jail [playerid] [time] [reason]");
if(!IsPlayerConnected(params[0]) && params[0] == INVALID_PLAYER_ID)
return SendClientMessage(playerid, -1,"*"COL_RED" Player is not connected.");
if(Jailed[params[0]] == 1)
return SendClientMessage(playerid, -1, "*"COL_RED" Player is already jailed.");
new name1[24], name2[24];
GetPlayerName(params[0], name1, sizeof(name1));
GetPlayerName(playerid, name2, sizeof(name2));
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", name1, params[0], params[1], reason);
SendClientMessageToAll(-1, szString);
SetPlayerInterior(params[0], 3);
SetPlayerVirtualWorld(params[0], 10);
SetPlayerFacingAngle(params[0], 360.0);
SetPlayerPos(params[0], 197.5662, 175.4800, 1004.0);
SetPlayerHealth(params[0], 9999999999.0);
ResetPlayerWeapons(params[0]);
JailTimer[params[0]] = SetTimerEx("Unjail", params[1]*60000, false, "i", params[0]);
}
return true;
}