Using the /command [ID] System, Please Help
#1

So My Homemade Command Is This RIGHT NOW

Код:
COMMAND:jail(playerid, params[])
{
    if(IsPlayerConnected(playerid))
	{
	    if(PlayerInfo[playerid][AdminLevel] >= 5)
	    {
			format(string, sizeof(string), "Admin %s has Placed %d in jail!", pname);
			SendClientMessageToAll(Red, string);
			SetPlayerPos(playerid,265.0000, 82.0000, 1002.0000);
	        SendClientMessage(playerid,0x00FFFFAA,"%s has placed you in jail!");
			new Float:pX, Float:pY, Float:pZ;
			PlayerPlaySound(playerid,1057,pX,pY,pZ);
			}
    		return 1;
			}
	    	else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not allowed to use this command.");
	}
			else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
What do i have to add to make it detect ids if i do /jail [id] ?
Reply
#2

You can use "isnull", at least that's what I use for single parameter.

pawn Код:
COMMAND:jail(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 5)
    {
        if(isnull(params)) return SendClientMessage(playerid, Red, "Usage: /Jail < Player ID >");
        new
            pID;

        if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, Red, "That user is not connected!");
        if(pID == playerid) return SendClientMessage(playerid, Red, "You can't jail yourself noob!");

        new
            iStr[80],
            iNameA[24];

        GetPlayerName(playerid, iNameA, sizeof(iNameA));

        format(iStr, sizeof(iStr), "%s has jailed you!", iNameA);
        SendClientMessage(pID, Red, iStr);

        return SetPlayerPos(pID,265.0000, 82.0000, 1002.0000);
    }
    else return SendClientMessage(playerid, Red, "You are not allowed to use this command.");
}
Reply
#3

Or if you want to use zcmd+sscanf:
pawn Код:
COMMAND:jail(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
     new Player;
   if(PlayerInfo[playerid][AdminLevel] >= 5)
   else if (sscanf(params, "u", Player)) return SendClientMessage(playerid, 0xFFFF00FF, "Usage: /jail [PlayerID]");
   else if (Player == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not found!");
          {
       
            format(string, sizeof(string), "Admin %s has Placed %d in jail!", pname);
            SendClientMessageToAll(Red, string);
            SetPlayerPos(playerid,265.0000, 82.0000, 1002.0000);
            SendClientMessage(playerid,0x00FFFFAA,"%s has placed you in jail!");
            new Float:pX, Float:pY, Float:pZ;
            PlayerPlaySound(playerid,1057,pX,pY,pZ);
            }
            return 1;
            }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not allowed to use this command.");
    }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)