getping
#5

pawn Код:
CMD:getping(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "SERVER: Unknown Command");
    new targetplayer;
    if(sscanf(params, "u", targetplayer)) return SendClientMessage(playerid, -1, "USAGE: /getping [ID]");
    if(!IsPlayerConnected(targetplayer) || targetplayer == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Player is not connected.");
    new str[25];
    format(str, sizeof(str), "Player's ping is %i.", GetPlayerPing(targetplayer));
    SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
    return 1;
}
You should use the "u" parameter when dealing with player names and/or IDs. Read more about SSCANF specifiers here:
https://github.com/Y-Less/sscanf/wiki
Reply


Messages In This Thread
getping - by saffierr - 29.03.2015, 21:01
Re: getping - by Evocator - 29.03.2015, 21:08
Re: getping - by CalvinC - 29.03.2015, 21:16
Re: getping - by saffierr - 29.03.2015, 22:05
Re: getping - by Threshold - 30.03.2015, 03:06
Re: getping - by saffierr - 30.03.2015, 13:20
Re: getping - by CalvinC - 30.03.2015, 13:30
Re: getping - by saffierr - 30.03.2015, 13:56
Re: getping - by CalvinC - 30.03.2015, 14:11
Re: getping - by saffierr - 30.03.2015, 14:42

Forum Jump:


Users browsing this thread: 2 Guest(s)