help with a command - 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: help with a command (
/showthread.php?tid=186049)
help with a command -
yarrum3 - 27.10.2010
Hi im looking to make a command that you type /id then the players name and it will come up with there id where is a good place to start with a command like this.
Re: help with a command -
yarrum3 - 27.10.2010
i have all reedy made a command for it now. Thanks
Re: help with a command -
Calgon - 27.10.2010
Get
zcmd and the
sscanf plugin.
pawn Код:
CMD:id(playerid, params[]) { // Command initializer for zcmd
new
_playerID; // Create a variable for sscanf to process
if(sscanf(params, "u", _playerID)) { // Using sscanf to parse the result.
return SendClientMessage(playerid, SOME_COLOR, "Syntax: /id [playerid]"); // Send them a message showing the usage of the command (they didn't use the proper command usage). Define SOME_COLOR or replace it
}
else { // They added the proper usage. Continue with the code.
if(_playerID == INVALID_PLAYER_ID) return SendClientMessage(playerid, SOME_COLOR, "That person is not connected."); // Send them a message, the ID/name is not connected
// If it continues past the code above (^), then the player is connected.
new
_playerMsgFormatSz[50], // Create the variable to format the message we'll send.
_playerNameSz[MAX_PLAYER_NAME]; // Create the variable to retrieve the players name.
GetPlayerName(_playerID, _playerNameSz, MAX_PLAYER_NAME); // Get the players name.
format(_playerMsgFormatSz, sizeof(_playerMsgFormatSz), "%s (%d) is connected.", _playerNameSz, _playerID); // Format the message.
return SendClientMessage(playerid, SOME_COLOR, _playerMsgFormatSz); // Send the message
}
}
Edit: Crap, too late.
Re: help with a command -
yarrum3 - 27.10.2010
NP calgon thanks for your help anyway