Small help please.
#1

Well
okay, we all started as newbies.. Could anybody tell me to make these simple commands show a message to everybody that the "target" got jailed by "admin" and the reason.
just noticed the ajail command doesn't contain a reason thing, any possibility to add it?
Admin jail
Код:
	if(strcmp(cmd, "/ajail", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /ajail [playerid/partofname] [minutes]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			  if(IsPlayerConnected(playa))
			  {
			    if(playa != INVALID_PLAYER_ID)
			    {
						format(string, sizeof(string), "[Info:] You jailed %s", GetPlayerNameEx(playa));
						SendClientMessage(playerid, COLOR_ADMINCMD, string);
						format(string, sizeof(string), "[Info:] You have been jailed by %s for %d minutes", GetPlayerNameEx(playerid),money);
						SendClientMessage(playa, COLOR_WHITE, string);
						SetPlayerVirtualWorld(playa,2);
						SetPlayerInterior(playa,6);
						SetPlayerPos(playa, 264.5743,77.5118,1001.0391);
						SafeResetPlayerWeapons(playa);
						WantedPoints[playa] = 0;
						ResetPlayerWantedLevelEx(playa);
						PlayerInfo[playa][pJailed] = 1;
						PlayerInfo[playa][pJailTime] = money*60;
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not authorized to use that command");
			}
		}
		return 1;
Kick
Код:
	if(strcmp(cmd, "/kick", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
	  	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /kick [playerid/partofname] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
				if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[128];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /kick [playerid/partofname] [reason]");
							return 1;
						}
						KickPlayer(giveplayerid,GetPlayerNameEx(playerid),(result));
						return 1;
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "[Error:] Invalid ID/Name");
			}
		}
		return 1;
Reply
#2

if(strcmp(cmd, "/ajail", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage:] /ajail [playerid/partofname] [minutes]");
return 1;
}
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
format(string, sizeof(string), "[Info:] You jailed %s", GetPlayerNameEx(playa));
SendClientMessage(playerid, COLOR_ADMINCMD, string);
format(string, sizeof(string), "[Info:] You have been jailed by %s for %d minutes", GetPlayerNameEx(playerid),money);
SendClientMessage(playa, COLOR_WHITE, string);

format(string, sizeof(string), "[INFO] %s has been jailed by %s !", GetPlayerNameEx(playa), GetPlayerNameEx(playerid));
SendClientMessageToAll(COLOR_WHITE, string);


SetPlayerVirtualWorld(playa,2);
SetPlayerInterior(playa,6);
SetPlayerPos(playa, 264.5743,77.5118,1001.0391);
SafeResetPlayerWeapons(playa);
WantedPoints[playa] = 0;
ResetPlayerWantedLevelEx(playa);
PlayerInfo[playa][pJailed] = 1;
PlayerInfo[playa][pJailTime] = money*60;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "[Error:] You are not authorized to use that command");
}
}
return 1;
Reply
#3

Thank you so much
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)