Help with GetPlayerPing
#1

What I wanted to do is I wanted a command /ping, with that player could enable a textdraw on the botton of the screen showing his ping "Ping: 234". The /ping command first checks if the player's ping text draw is on or not, if on then hide if not on then bring it on. Below is my attempt, but it doesn't do anything when I type /ping except for the SERVER: Unknown command notice.

pawn Код:
// On top of the script

new bool:ping[MAX_PLAYERS];
new Text:PingText[MAX_PLAYERS];


// OnPlayerConnect

    ping[playerid] = false;
    TextDrawFont(PingText[playerid], 2);
    TextDrawColor(PingText[playerid], 0xB0A32DFF);
    TextDrawSetProportional(PingText[playerid], true);
    TextDrawSetShadow(PingText[playerid], 1);

// OnGameModeInit

   for(new i=0; i<MAX_PLAYERS; i++)
    {
        PingText[i] = TextDrawCreate(222.5, 386, " ");
        }

// Command /ping

    CMD:ping(playerid,params[])
    {
        if(ping[playerid] == false)
        {
            new string[128];
            format(string,sizeof(string),"Ping: ~w~%s",GetPlayerPing(playerid));
            TextDrawSetString(PingText[playerid],string);
            ping[playerid] = true;
            return 1;
        }
        else
        {
            TextDrawHideForPlayer(playerid,PingText[playerid]);
            ping[playerid] = false;
            return 1;

        }
    }
Could someone help me out there please?
Reply


Messages In This Thread
Help with GetPlayerPing - by Goldilox - 13.06.2013, 01:36
Re: Help with GetPlayerPing - by dubyabeast - 13.06.2013, 01:43
Re: Help with GetPlayerPing - by Goldilox - 13.06.2013, 01:52

Forum Jump:


Users browsing this thread: 1 Guest(s)