26.07.2009, 18:39
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;
}