[Pedido] Comando de IP
#1

Boas malta,eu queria um comando,que so admin podesse usar,e tipo,queria o comando "/ip",o admin usava o comando em um id do player e descobrisse o ip.

Vou explicar melhor,um admin usava o comando /ip espaзo a seguir ao id "/ip 20",ia ver o ip do player id 20.

/ip [Player ID]

O Admin ao usar esse comando,podesse ver o ip do player. :S
Reply
#2

ta ai:

pawn Код:
if(strcmp(cmd, "/pegarip", true) == 0)//getip
    {
        if (PlayerInfo[playerid][pAdmin] >= 2)
        {
            tmp = strtok(cmdtext,idx);
            new playersip[256];
            if(!strlen(tmp))
            {
                SendClientMessage(playerid,COLOR_GRAD1,"{339933}[Use]{FFFFFF} /pegarid [Players ID]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerIp( giveplayerid,playersip,sizeof(playersip));
            format(string, sizeof(string), "Player: %s IP: %s",giveplayer,playersip);
            SendClientMessage(playerid,COLOR_YELLOW,string);
        }
        return 1;
    }
Ajudei Reep ai?
Reply
#3

pawn Код:
5395) : error 035: argument type mismatch (argument 2)
C:\Users\Jesus\Desktop\Comunidade OG\OG\gamemodes\OG-RP.pwn(5395) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
Reply
#4

alterei o comando para
pawn Код:
if(strcmp(cmd, "/pegarip", true) == 0)//getip
    {
        if (PlayerInfo[playerid][mstrvbcAdmin] >= 21)
        {
            tmp = strtok(cmdtext,idx);
            new playersip[256];
            if(!strlen(tmp))
            {
                SendClientMessage(playerid,COLOR_RED,"/pegarid [Player ID] para descobrir o ip de algum jogador ");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            GetPlayerName(giveplayerid, giveplayerid, sizeof(giveplayerid));
            GetPlayerIp( giveplayerid,playersip,sizeof(playersip));
            format(string, sizeof(string), "Player: %s IP: %s",giveplayerid,playersip);
            SendClientMessage(playerid,COLOR_YELLOW,string);
        }
        return 1;
    }
e deume
pawn Код:
C:\Users\Jesus\Desktop\Comunidade OG\OG\gamemodes\OG-RP.pwn5395) : error 035: argument type mismatch (argument 2)
C:\Users\Jesus\Desktop\Comunidade OG\OG\gamemodes\OG-RP.pwn(5395) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
Reply
#5

knd eu uso /verip,apareзe "Digite: /verip [id]",so que quando uso /verip 1,ou outro qualquer id,apareзe que o comando nao existe
Reply
#6

caoraivoso, qual sistema vocк usa para "gerenciar" seus comandos?

DCMD, ZCMD, strtok, ..?
Reply
#7

so tem esas include no gm
pawn Код:
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <a_http>
#include <file>
#include <Dini>
#include <a_players>
#include <F_Streamer>
#include <foreach>
#include <JunkBuster>
mas na pasta das includes tenho prai umas 50 includes,e la tem a zcmd.
Reply
#8

Nгo estou falando de includes, mas sim do "gerenciador" de comandos do OnPlayerCommandText ...

Exemplo em DCMD:

pawn Код:
Topo:
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1


OnPlayerCommandText:
dcmd(ip,2,cmdtext);


dcmd_ip(playerid,params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Vocк nгo й admin!");
    if(strlen(params[0])==0) return SendClientMessage(playerid,-1,"Uso: /ip [id]");
    new id = strval(params[0]);
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,-1,"ID nгo conectado!");
    new msg[64],name[MAX_PLAYER_NAME],ip[16];
    GetPlayerIP(id,ip,sizeof(ip));
    GetPlayerName(id,name,sizeof(name));
    format(msg,64,"%s - IP: %s",name,ip);
    SendClientMessage(playerid,-1,msg);
    return 1;
}
Reply
#9

no topo do gm so tenho isto
pawn Код:
/==============[Script DEFINES]===============
#define MAX_PLAYER_ATTACHED_OBJECTS 5 // This is the number of attached indexes available ie 5 = 0-4
#define SetPlayerHoldingObject(%1,%2,%3,%4,%5,%6,%7,%8,%9) SetPlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1,%2,%3,%4,%5,%6,%7,%8,%9)
#define StopPlayerHoldingObject(%1) RemovePlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1)
#define IsPlayerHoldingObject(%1) IsPlayerAttachedObjectSlotUsed(%1,MAX_PLAYER_ATTACHED_OBJECTS-1)
#define MAX_BARS                (MAX_TEXT_DRAWS / 3)
#define INVALID_BAR_ID          (Bar:-1)
#define pb_percent(%1,%2,%3,%4) ((%1 - 6.0) + ((((%1 + 6.0 + %2 - 2.0) - %1) / %3) * %4))
#define WEAPON_TYPE_NONE        (0)
#define WEAPON_TYPE_HEAVY   (1)
#define WEAPON_TYPE_LIGHT   (2)
#define WEAPON_TYPE_MELEE   (3)//Nahkampf
//============[SYSTEM RELATED MESSAGE DEFINES]========
#define BUSINESS_TYPES "1: Restaurante | 2: Companhia Telefonica | 3: Loja 24-7 | 4: Ammunation | 5: Advertising | 6: Loja de Roupa | 7: Bar/Club | 8: Farmacia"
#define BUSINESS_TYPES2 "9: Stand de Carros | 10: Casa dos Emprestimos | 11: Garagem de Tuning"
#define FACTION_TYPE "0: Gang's | 1: Police Department | 2: Medic Department | 3: Governo | 4: New | 5: Mafia Italiano | 6: Vagos"
#define FACTION_TYPE2 "7: Ballas | 8: Exercito | 9: Mecanic | 10: Taxi"
//====================================================
#include <a_samp>
#include <core>
#include <float>
#include <time>
#include <a_http>
#include <file>
#include <Dini>
#include <a_players>
#include <F_Streamer>
#include <foreach>
#include <JunkBuster>
#include <zcmd>
#include <a_vehicles>
//====================================================
#define MAX_STRING 255
#define COLOR_PURPLE 0xC2A2DAAA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GREY 0xAFAFAFAA
//===============================[MAIN SETTINGS]================================================
#define GAMEMODE    "OG-RP"// This is what the gamemode text will be set to.
#define GAMEMODE_USE_VERSION    "Yes" // This shows the Server name and the version in Gamemode text, if set to "No" it will only display the gamemode name.
#define MAP_NAME    "Las Venturas" // This is what the map name will be set to.
#define SERVER_NAME "" // This is what the hostname/servername will be set to.
#define WEBSITE "www.originalgamers.forumbom.com" // This is what the website will be set to.
#define VERSION "v1.0" // Script Version
#define LAST_UPDATE "5/11/2010" // Script was last updated.
#define DEVELOPER   "J0T4R97" // Developer Name.
#define PASSWORD    "" // Server Password
#define SCRIPT_LINES 52562 // For printing the script lines amount, unfortunately it has to be updated manually.
//===============================[OTHER SETTINGS]================================================
#define MAX_AFKTIME (900)
#define MAX_BOMBAS  (16)
#define MAX_SURFBOARDS (5)
#define MAX_SURFBOARD_SPEED (5.0)
#define MAX_CHARS 32
#define PICKUP_RANGE 50 //The range in which a player has to be to see the pickups
#define MAX_ZONE_NAME 28
#define MAX_SPAWN_ATTEMPTS 3 //This is the amount of times sometime can try to spawn before finally getting kicked.
#define txtcost 5
#define PRODUCT_PRICE 10
#define MAX_RENT_VEHICLES 500
#define GasMax 100
#define MAX_PICKUPZ 10000
#define MAX_CPT 500
#define MAX_STREAMOBJECTS 5000
#define MAX_SPIKESTRIPS 200
#define MAX_BARREIRAS 200
#define MAX_GRADITY 200
#define maxobj 100 // Limit
#define DIALOGID 50
#define Distancia 100
,o resto das defines sao cores e nao tenho mais nada.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
    new cmd[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    new tmp[256];
    new giveplayerid;
    if(gPlayerLogged[playerid] == 1)
Reply
#10

Tenta ai:

pawn Код:
if(strcmp(cmd, "/verip", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        new id[128], IP[128];
        id = strtok(cmdtext,idx);
        if(!strlen(id)) return SendClientMessage(playerid, -1, "Digite: /verip [id]");
        GetPlayerIp(strval(id), IP, sizeof(IP));
        format(string, sizeof(string), "* IP Do Jogador: %s", IP);
        SendClientMessage(playerid, -1, string);
        return 1;
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)