Using the /command [ID] System, Please Help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Using the /command [ID] System, Please Help (
/showthread.php?tid=267603)
Using the /command [ID] System, Please Help -
HayZatic - 09.07.2011
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] ?
Re: Using the /command [ID] System, Please Help - [L3th4l] - 09.07.2011
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.");
}
Re: Using the /command [ID] System, Please Help -
Bu$ter - 09.07.2011
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.");
}