IP comand?
#2

Ok, I was bored, so I made you the whole filterscript. You must be logged in RCON to use the command. Command = "/getip", script:

pawn Код:
#include <a_samp>

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
  if(strcmp(cmdtext, "/getip", true) == 0)
  {
    if(IsPlayerAdmin(playerid))
    {
      new text[128];
      new index;
      text = strtok(cmdtext, index);
      if(!strlen(text))
      {
        SendClientMessage(playerid, 0xFFFFFFFF,"Usage: /getip [playerid]");
        return 1;
      }
      new player;
      player = strval(text);
      if(IsPlayerConnected(player))
      {
        new string[128];
      new name[MAX_PLAYER_NAME];
      new IP[20];
      GetPlayerName(player, name, sizeof(name));
        GetPlayerIp(player, IP, sizeof(IP));
        format(string, sizeof(string), "%s's IP: %s", name, IP);
        SendClientMessage(playerid, 0xFFFFFFFF, string);
        return 1;
      }
      else return SendClientMessage(playerid, 0xFFFFFFFF,"Player is not connected");
    }
    else return 0;
  }
  return 0;
}
Reply


Messages In This Thread
IP comand? - by jonybomb - 26.07.2009, 18:08
Re: IP comand? - by refshal - 26.07.2009, 18:39
Re: IP comand? - by James_Alex - 26.07.2009, 18:52
Re: IP comand? - by jonybomb - 26.07.2009, 19:06
Re: IP comand? - by MadeMan - 26.07.2009, 19:15
Re: IP comand? - by jonybomb - 26.07.2009, 19:23
Re: IP comand? - by refshal - 26.07.2009, 19:50
Re: IP comand? - by jonybomb - 26.07.2009, 19:52
Re: IP comand? - by jonybomb - 26.07.2009, 20:17
Re: IP comand? - by Jefff - 26.07.2009, 20:32

Forum Jump:


Users browsing this thread: 1 Guest(s)