ajail command
#1

Hello guys, I need someone to help me make an ajail command for admins I did this:

Код:
forward Unjail();
forward Timer();

.......

COMMAND:ajail(playerid,params[])
{
	new string[128];
	new ID;
	new cmdreason;
	if(sscanf(params, "us", ID, cmdreason)) return SendClientMessage(playerid,COLOR_RED,"ERROR: /ajail [ID] [Reason]");
	if(Spawned[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be alive and spawned to use the command /ajail!");
	if(AdminLevel[playerid] < 3) return SendClientMessage(playerid,COLOR_RED,"ERROR: You don't have permission to use this command!");
	if(Jailed[ID] != 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: This player is already in jail!");
	if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,COLOR_RED,"ERROR: This player ID isn't connected!");
	if(Spawned[ID] == 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: That player ID is not spawned. You can't jail a dead person...");
	
	//Messages
	format(string,128,"%s(%d) has been jailed by a server admin (Seconds: 120, Reason: %s)",PlayerName(ID), ID, cmdreason);
	SendClientMessageToAll(COLOR_LIGHTBLUE,string);
	SendClientMessage(ID,COLOR_BLUE,"You Have Been Jailed!");
	SendClientMessage(ID,COLOR_WHITE,"Info:");
	SendClientMessage(ID,COLOR_LIGHTBLUE,"Seconds: 120");
	format(string,128,"Reason: %s",cmdreason);
	SendClientMessage(ID,COLOR_LIGHTBLUE,string);
	format(string,128,"You Have Jailed %s!",PlayerName(ID));
	SendClientMessage(playerid,COLOR_ADMIN,string);

	//What It Does
	Jailed[ID] =1;
	SetTimer("Unjail",120000,false);
	SetTimer("Timer",1000,true);
	ResetPlayerWeapons(ID);
    SetPlayerInterior(ID,10);
	SetPlayerPos(ID,219.4913,110.9124,999.0156);
	SetPlayerFacingAngle(ID,359.0834);
    return 1;
}

.......


public Unjail()
{
	for(new i=0; i<MAX_PLAYERS; i++)
 	{
 	    if(IsPlayerConnected(i))
	    {
			if(gTeam[i] == TEAM_US || gTeam[i] == TEAM_FRANCE)
			{
	  			SetPlayerPos(i,-688.1398,937.6632,13.6328);
				SetPlayerFacingAngle(i,180.5165);
			}
			new string[128];
			new pname[60];
			GetPlayerName(i,pname,sizeof(pname));
			format(string,sizeof(string),"%s has been released from the admin jail.",pname);
			SendClientMessageToAll(COLOR_ADMIN,string);
			Jailed[i] =0;
		}
	}
}

public Timer()
{
    for(new i=0; i<MAX_PLAYERS; i++)
 	{
 		if(IsPlayerConnected(i))
	    {
    		JailTime[i]--;
		}
	}
}
But I can't get it fixed it always says when I test it that the ID isn't connected and I know it is....


Please help me....

Either create me a new one please or edit this one
Reply
#2

pawn Код:
COMMAND:ajail(playerid,params[])
{
    new string[128];
    new ID;
    new cmdreason;
    if(sscanf(params, "us", ID, cmdreason)) return SendClientMessage(playerid,COLOR_RED,"ERROR: /ajail [ID] [Reason]");
    if(Spawned[playerid] == 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: You must be alive and spawned to use the command /ajail!");
    if(AdminLevel[playerid] < 3) return SendClientMessage(playerid,COLOR_RED,"ERROR: You don't have permission to use this command!");
    if(Jailed[ID] != 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: This player is already in jail!");
    if(Spawned[ID] == 0) return SendClientMessage(playerid,COLOR_RED,"ERROR: That player ID is not spawned. You can't jail a dead person...");
    if(IsPlayerConnected(ID))
    {
        //Messages
        format(string,128,"%s(%d) has been jailed by a server admin (Seconds: 120, Reason: %s)",PlayerName(ID), ID, cmdreason);
        SendClientMessageToAll(COLOR_LIGHTBLUE,string);
        SendClientMessage(ID,COLOR_BLUE,"You Have Been Jailed!");
        SendClientMessage(ID,COLOR_WHITE,"Info:");
        SendClientMessage(ID,COLOR_LIGHTBLUE,"Seconds: 120");
        format(string,128,"Reason: %s",cmdreason);
        SendClientMessage(ID,COLOR_LIGHTBLUE,string);
        format(string,128,"You Have Jailed %s!",PlayerName(ID));
        SendClientMessage(playerid,COLOR_ADMIN,string);

        //What It Does
        Jailed[ID] =1;
        SetTimer("Unjail",120000,false);
        SetTimer("Timer",1000,true);
        ResetPlayerWeapons(ID);
        SetPlayerInterior(ID,10);
        SetPlayerPos(ID,219.4913,110.9124,999.0156);
        SetPlayerFacingAngle(ID,359.0834);}
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"ERROR: This player ID isn't connected!");
    }
    return 1;
}
Reply
#3

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)