Command
#1

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!
Reply
#2

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;
}
Reply
#3

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

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; 
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)