26.07.2009, 20:32
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[128],index; cmd = strtok(cmdtext, index); if(strcmp(cmd, "/getip", true) == 0) { if(IsPlayerAdmin(playerid)) { new text[128]; text = strtok(cmdtext, index); if(!strlen(text)) return SendClientMessage(playerid, 0xFFFFFFFF,"Usage: /getip [playerid]"); new 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); }else SendClientMessage(playerid, 0xFFFFFFFF,"Player is not connected"); }else SendClientMessage(playerid, 0xFFFFFFFF,"Only for admins !"); return 1; } return 0; }