SA-MP Forums Archive
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)
+--- Thread: Command (/showthread.php?tid=457467)



Command - lsreskjn - 11.08.2013

hey all, I want to ask you if someone is going to help me by showing me very simple technique of making a commands.

First, i want to make an rcon command /getping [ID] - show the ping of the player in dialog.


Thanks very much for every reply!


Re: Command - RedJohn - 11.08.2013

pawn Код:
COMMAND:getping(playerid, params[]) //Using Zeex's ZCMD (Command processor)
{
    new targetID, Message[128]; //targetID = ID of player you would like to check ping, Message is simple string with lenght of 128.
    if(sscanf(params, "u", targetID)) return SendClientMessage(playerid, 0xDEEE20FF, "USAGE: /getping [playerid]"); //Usage, using ******'s sscanf.
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xDEEE20FF, "You are not RCON administrator."); //If you are not RCON then show him that message.
    format(Message, sizeof(Message), "Ping of the following player is: %d", GetPlayerPing(targetID)); //Format message with ping
    SendClientMessage(playerid, 0xDEEE20FF, Message); //Show that message
    return 1;
}



Re: Command - lsreskjn - 11.08.2013

so I need to include ZCMD right? its showing the error undefined symbol "cmd" and symbol is never used: "getping"


Re: Command - lsreskjn - 11.08.2013

Sorry for DoublePost

this is my /info command witch shows some information but i want to something for admin that shows other player's info

Код:
if(strcmp(cmdtext, "/info", true) == 0)
{
new strin[400];
GetPlayerIp(playerid, ip2, sizeof(ip2));
GetPlayerPing(playerid);

format(strin,sizeof(strin),"{990099}===============Informacie===============\n\n",strin);
format(strin,sizeof(strin),"%s{FFFFFF}Nick: {990099}%s\n{FFFFFF}ID: {990099}%i\n{FFFFFF}IP Adresa: {990099}%s\n{FFFFFF}Ping: {990099}%d\n{FFFFFF}Verzia SAMP: {990099}0.3x-R1-2\n{FFFFFF}Score: {990099}%d\n{FFFFFF}Peniaze: {990099}$%d\n{FFFFFF}Zomrel: {990099}%d\n{FFFFFF}Zabil: {990099}%d\n",strin,Jmeno(playerid),playerid,GetPlayerIpEx(playerid),GetPlayerPing(playerid),pScore[playerid],GetPlayerMoney(playerid),pDeaths[playerid],pKills[playerid]);
ShowPlayerDialog(playerid,5,DIALOG_STYLE_MSGBOX,"INFO",strin,"Zavriet","");
return 1; 
}