/GETIP Errors - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /GETIP Errors (
/showthread.php?tid=535015)
/GETIP Errors -
Gogeta101 - 01.09.2014
I have tried to script this cmd like this but does not work.
pawn Код:
CMD:getip(playerid, params[])
{
if(Player[playerid] [pAdmin] >=1)
{
new targetid;
new ip[16];
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]/getip [ID].");
GetPlayerIp(targetid,ip,sizeof(ip));
format(ip, sizeof(ip), "[SERVER]:TargetID IP is: %s ",ip);
SendClientMessage(playerid,COLOR_YELLOW,ip);
}
else
{
SendClientMessage(playerid,COLOR_RED, "[SERVER]:You are not allowed to use this command.");
}
return 1;
}
Re: /GETIP Errors -
K9IsGodly - 01.09.2014
I would simply just rewrite it for you:
PHP код:
CMD:getip(playerid, params[])
{
if(Player[playerid] [pAdmin] >=1)
{
new targetid, ip[16], string[60];
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]/getip [ID].");
GetPlayerIp(targetid,ip,sizeof(ip));
format(string, sizeof(string), "[SERVER]:TargetID IP is: %s ",ip);
SendClientMessage(playerid,COLOR_YELLOW,string);
}
else
{
SendClientMessage(playerid,COLOR_RED, "[SERVER]:You are not allowed to use this command.");
}
return 1;
}
I think that should work, all I did really is make a new string because you were getting the player's IP, and then overwriting it with the [SERVER]:TargetID etc message, and then trying to send the user the IP which had already been rewritten over.
Re: /GETIP Errors -
M0HAMMAD - 01.09.2014
Use This :
pawn Код:
new string[150];
new ipstring[25];
new ID;
GetPlayerIp(ID,ipstring,sizeof(ipstring));
format(string,sizeof(string),"(%d) IP : %s",ID,ipstring);
SendClientMessage(playerid,-1,string);
}
Re: /GETIP Errors -
SanAndreasMP - 01.09.2014
Here :
pawn Код:
COMMAND:getip(playerid, params[])
{
if(//Your enumerator variable here)
{
new
ip[32],
target,
string[50];
if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "USAGE: /ip [ip]");
GetPlayerIp(target, ip, sizeof(ip));
format(string, sizeof(string), "Player: %s (ID: %d) | IP: %s", GetPlayerName(target), playerid, ip);
SendClientMessage(playerid, -1, string);
}
}
return 1;
}