SA-MP Forums Archive
/id 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: /id command (/showthread.php?tid=557195)



/id command - Ejected - 13.01.2015

How can I make an /id command which says the player's PING? like...
/id Bobby

Bobby Fiddlebob (ID:1) - Ping: 51


Re: /id command - Banana_Ghost - 13.01.2015

assuming you're using zcmd or some sort and sscanf
pawn Код:
CMD:id(playerid,params[])
{
    new TargetID,str1[45],pname[MAX_PLAYER_NAME];
    if(sscanf(params,"u",TargetID)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /id (Nick / ID)");
    if(TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID)) return SendClientMessage(playerid, 0xFF0000FF, "Player Is Not Connected.");
    else
    {
        GetPlayerName(TargetID,pname,sizeof(pname));
        format(str1,sizeof(str1),"%s (%d)'s Ping: %d",pname,TargetID,GetPlayerPing(TargetID));
        SendClientMessage(playerid,-1,str1);
    }
    return 1;
}



Respuesta: /id command - JuanStone - 13.01.2015

pawn Код:
command(id, playerid, params[])
{
    if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, -1, "usage: /id [playerid/name].");
    if(IsPlayerConnected(params[0]) && params[0] != INVALID_PLAYER_ID)
    {
        new string[48], name[24];
        GetPlayerName(params[0], name, 24);
        format(string, sizeof(string), "%s(%d) ping: %d.", name, params[0], GetPlayerPing(params[0]));
        SendClientMessage(playerid, -1, string);
    }
    else
    {
        SendClientMessage(playerid, -1, "Player not conected.");
    }
    return true;
}



Re: /id command - PowerPC603 - 13.01.2015

Or just press TAB, alot faster and displays the ping for all players at once.