weird problem with player country or player ip -
wallen - 12.03.2018
PHP код:
CMD:whois(playerid, params[])
{
if(connected[playerid] == true) return GameTextForPlayer(playerid, "~r~Spawn First", 5000, 5);
if(pInfo[playerid][Admin] < 3) return SendClientMessage(playerid, -1, "{C3C3C3}(INFO) You don't have the priviliges to use this command.");
{
new str[500], target, ip[90], str2[144];
if(sscanf(params, "u", target)) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) /whois [id]");
if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "{c3c3c3}(INFO) Player offline.");
GetPlayerIp(target, ip, 16);
GetPlayerCountry(target, str2, sizeof(str2));
format(str, sizeof(str), "{ff0000}%s's ip is '%s' connected from '%s'", PlayerName[target], ip[target], str2[target]);
SendClientMessage(playerid, -1, str);
}
return 1;
}
When i do that command to myself it shows ip and country with no issues, but when i type /whois 1 or any other id, it removes 2/3 letters from country name, like, "Kingdoom" instead of United Kingdoom, and ip's are like ".123.2312.3" instead of 12.3.2314.4 you know. Using whitetiger's geo location
Re: weird problem with player country or player ip -
Sew_Sumi - 12.03.2018
That isn't right.
str2 isn't an array based on a player, it's a string. That'll be why you've got messed outputs. You are ID 0, so it will show all the string, but if they are ID 15, the string will show from character 15 onwards. (I only learnt of this last week)
If I have ExampleName[10] and I have a player called FudgeCake, if I do something like ExampleName[5] I'll either end up with output of eCake, or Cake... Hopefully Cake.
source:
http://forum.sa-mp.com/showpost.php?...06&postcount=2
Re: weird problem with player country or player ip -
RedFusion - 12.03.2018
I found an error in your code
Change from this
pawn Код:
format(str, sizeof(str), "{ff0000}%s's ip is '%s' connected from '%s'", PlayerName[target], ip[target], str2[target]);
to this
pawn Код:
format(str, sizeof(str), "{ff0000}%s's ip is '%s' connected from '%s'", PlayerName[target], ip, str2);
Re: weird problem with player country or player ip -
wallen - 12.03.2018
Thanks hope it works
Re: weird problem with player country or player ip -
Sew_Sumi - 12.03.2018
I sure hope you read what I mentioned. It could help you in the future, especially with how that technique works.