08.02.2015, 20:47
This would be fairly easy with sscanf and y_commands or ZCMD.
EDIT: The command for getting phone number is fairly similar. Just edit the name of the command and edit the format variables to how you want them.
PHP Code:
CMD:id(playerid, params[])
{
// Creating the variables we will need
new String[128], Target, TargetName[MAX_PLAYER_NAME];
// Checking that all the params are there, and that everything is in order
if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_INFO, "* Usage: /id [playerid/PartOfName]");
else // If everything is in order, this will happen
{
// Checking that the player is online and that the ID is valid
if(Target != INVALID_PLAYER_ID)
{
// Getting player name into the formerly created string
GetPlayerName(Target, TargetName, sizeof(TargetName));
// Formatting it to how you wanted it. Player_Name [ID:10]
format(String, sizeof(String), "%s [ID:%d]", TargetName, Target);
// Sending the message
SendClientMessage(playerid, COLOR_INFO, String);
}
}
return 1;
}
PHP Code:
format(String, sizeof(String), "%d - %s [ID:%d]", PhoneNumberVariable, TargetName, Target);
// Will output 1337 - Player_Name [ID:10]