Jail CMD please +Rep
#1

hi guys i need /jail /unjailcmd for myGM
i maked one by myself
but it's bugged
when i doig
/jail Diago(explain) rule break
it's jailing my self lols
how make that it's will jail him and not my self
i'm usig ZCMDand sscanf
Reply
#2

PHP код:
CMD:jail(playeridparams[])
{
    new 
id;
    if(
IsPlayerConnected(id))
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1)
        {
            if(!
sscanf(params"u"id))
            {
                new 
string[64];
                
format(stringsizeof(string), "You have been jailed by %s."PlayerName(playerid));
                
SendClientMessage(id0xD8D8D8FFstring);
                
format(stringsizeof(string), "You jailed %s ."PlayerName(id));
                
SendClientMessage(playerid0xD8D8D8FFstring);
                
SetPlayerPos(id264.5442199707,77.155387878418,1001.0390625);
                
SetPlayerInterior(id6);
                return 
true;
            }
            else return 
SendClientMessage(playerid0xD8D8D8FF"USAGE: /jail [PlayerId/PartOfName]");
        }
        else return 
SendClientMessage(playeridCOLOR_RED"You are not allowed to use this command.");
    }
    else return 
SendClientMessage(playerid0xD8D8D8FF"Player is not connected.");

PHP код:
CMD:unjail(playeridparams[])
{
    new 
id;
    if(
IsPlayerConnected(id))
    {
        if(
PlayerInfo[playerid][pAdmin] >= 1)
        {
            if(!
sscanf(params"u"id))
            {
                new 
string[64];
                
format(stringsizeof(string), "You have been unjailed by %s."PlayerName(playerid));
                
SendClientMessage(id0xD8D8D8FFstring);
                
format(stringsizeof(string), "You unjailed %s ."PlayerName(id));
                
SendClientMessage(playerid0xD8D8D8FFstring);
                
SetPlayerPos(id1552.1305,-1675.6511,16.1554);
                
SetPlayerInterior(id0);
                return 
true;
               }
            else return 
SendClientMessage(playerid0xD8D8D8FF"USAGE: /unjail [PlayerId/PartOfName]");
        }
        else return 
SendClientMessage(playeridCOLOR_RED"You are not allowed to use this command.");
    }
    else return 
SendClientMessage(playerid0xD8D8D8FF"Player is not connected.");

rep for help and change colors becose maybe it will give you error if you wont !

EDIT:forgot stock PlayerName
PHP код:
stock PlayerName(playerid)
{
    new 
Name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridNamesizeof(Name));
    return 
Name;

Reply
#3

where do i put this:
stock PlayerName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}
lol
Reply
#4

Quote:
Originally Posted by Alexy_Dramon
Посмотреть сообщение
where do i put this:
stock PlayerName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}
lol
At the end of your script.
Reply
#5

huh i maked it working witout
stock PlayerName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}

but why it's giving me /jail /unjail when i'm ain't admin huh
i did
if(!IsPlayerAdmin(playerid))
but it's not working
Reply
#6

Код:
CMD:jail(playerid,params[])
{
      if(PInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
      {
           new id;
           new jailedname[MAX_PLAYER_NAME];
           new adminname[MAX_PLAYER_NAME];
           if(sscanf(params,"u",id))return SendClientMessage(playerid,red,"Useage: /jail <playerid>");
           if(IsPlayerConnected(id))
           {
                  GetPlayerName(id,jailedname,sizeof(jailedname));
                  GetPlayerName(playerid,adminname,sizeof(adminname));
                  new string[256];
                  format(string,sizeof(string),"Administrator \"%s\" Has Jailed You",adminname);
                  SendClientMessage(id,blue,string);
                  format(string,sizeof(string),"You Have Jailed \"%s\"",jailedname);
                  SendClientMessage(playerid,blue,string);
                  SetPlayerPos(id, 264.5442199707,77.155387878418,1001.0390625); 
                  return SetPlayerInterior(id, 6);
          }
          else return SendClientMessage(playerid,red,"ERROR: Player Is Not connected");
    } 
    else return SendClientMessage(playerid,red,"ERROR: You are not a admin to use this command");
}
CMD:unjail(playerid,params[])
{
      if(PInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
      {
           new id;
           new unjailedname[MAX_PLAYER_NAME];
           new adminname[MAX_PLAYER_NAME];
           if(sscanf(params,"u",id))return SendClientMessage(playerid,red,"Useage: /unjail <playerid>"); 
     
           if(IsPlayerConnected(id))
           {
                  GetPlayerName(id,jailedname,sizeof(jailedname));
                  GetPlayerName(playerid,adminname,sizeof(adminname));
                  new string[256];
                  format(string,sizeof(string),"Administrator \"%s\" Has UnJailed You",adminname);
                  SendClientMessage(id,blue,string);
                  format(string,sizeof(string),"You Have Jailed \"%s\"",unjailedname);
                  SendClientMessage(playerid,blue,string);
                  return SpawnPlayer(id);
          }
          else return SendClientMessage(playerid,red,"ERROR: Player Is Not connected");
    } 
    else return SendClientMessage(playerid,red,"ERROR: You are not a admin to use this command");
}
Reply
#7

Код:
CMD:jail(playerid, params[])
{
    new PID;
	if(IsPlayerConnected(PID))
	{
	    if(!IsPlayerAdmin(playerid))
	    {
			if(!sscanf(params, "u", PID))
			{
			    new string[64];
			    format(string, sizeof(string), "You have been jailed by %s.", PlayerName(playerid));
			    SendClientMessage(PID, 0xD8D8D8FF, string);
			    format(string, sizeof(string), "You jailed %s .", PlayerName(PID));
			    SendClientMessage(playerid, 0xD8D8D8FF, string);
			    SetPlayerPos(PID, 264.5442199707,77.155387878418,1001.0390625);
			    SetPlayerInterior(PID, 6);
			    return true;
			}
			else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /jail [PlayerId/PartOfName]");
	    }
	    else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command.");
	}
	else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
CMD:unjail(playerid, params[])
{
    new PID;
	if(IsPlayerConnected(PID))
	{
	    if(!IsPlayerAdmin(playerid))
	    {
			if(!sscanf(params, "u", PID))
			{
			    new string[64];
			    format(string, sizeof(string), "You have been unjailed by %s.", PlayerName(playerid));
			    SendClientMessage(PID, 0xD8D8D8FF, string);
			    format(string, sizeof(string), "You unjailed %s .", PlayerName(PID));
			    SendClientMessage(playerid, 0xD8D8D8FF, string);
			    SetPlayerPos(PID, 1552.1305,-1675.6511,16.1554);
			    SetPlayerInterior(PID, 0);
			    return true;
	        }
			else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /unjail [PlayerId/PartOfName]");
	    }
	    else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command.");
	}
	else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
stock PlayerName(playerid)
{
	new Name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, Name, sizeof(Name));
	return Name;
}
It's Working without any error but one problem huh
i'm not allowed Use it when i'm on Rcon admin it's show me this Error IG
Код:
	    else return SendClientMessage(playerid, COLOR_RED, "You are not allowed to use this command.");
huh if u see any problem in this script plesae Tell me
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)