Is the IP same check, how? -
aw1337 - 01.01.2017
Hey,
i have a command to give over money to another player.
But i want to return it to 1 , if the IP if playerid is the same as of pid (target).
But i dont know how to check if the IP is the same? I mean, it wont work with == ...
Can someone quickly write a code? Thanks.
Re: Is the IP same check, how? -
BiosMarcel - 01.01.2017
Learn to use ****** ...
https://sampwiki.blast.hk/wiki/GetPlayerIp
https://sampwiki.blast.hk/wiki/Strcmp
Re: Is the IP same check, how? -
RyderX - 01.01.2017
SA:MP Wiki is big
https://sampwiki.blast.hk/
Re: Is the IP same check, how? -
BiosMarcel - 01.01.2017
Quote:
Originally Posted by RyderX
No need to check ip to dis-allow yourself to send money to urself,
just use this one:
PHP код:
COMMAND:pay(playerid, params[])
{
new otherid, cash;
if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}/pay [ID] [Amount]");
else
{
if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}You don't have that much!");
else if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}Invalid ID (Player not connected)");
else if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}Invalid ID (You can't pay yourself)");
else
{
GivePlayerMoney(playerid, -cash);
GivePlayerMoney(otherid, cash);
}
}
return 1;
}
|
Dude ... he doesn't to check if it the same player but another character of the same person ... so your answer makes no sense
Re: Is the IP same check, how? -
aw1337 - 01.01.2017
Quote:
Originally Posted by [Bios]Marcel
Dude ... he doesn't to check if it the same player but another character of the same person ... so your answer makes no sense
|
Right, i want to disallow if somebody wants to pay to someone else with the SAME IP...
To avoid Money laundering
Re: Is the IP same check, how? -
aw1337 - 02.01.2017
I dont understand it damn... read alot of times but i still dont get it, please can someone do it for me?
Re: Is the IP same check, how? -
RyderX - 02.01.2017
PHP код:
COMMAND:pay(playerid, params[])
{
new otherid, cash;
if (sscanf(params, "dd", otherid, cash)) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}/pay [ID] [Amount]");
else
{
if(GetPlayerMoney(playerid) < cash) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}You don't have that much!");
else if(!IsPlayerConnected(otherid)) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}Invalid ID (Player not connected)");
else if(otherid == playerid) SendClientMessage(playerid, COLOR_RED, "[ERROR]: {FFFFFF}Invalid ID (You can't pay yourself)");
else
{
GivePlayerMoney(playerid, -cash);
GivePlayerMoney(otherid, cash);
}
}
return 1;
}
Here it is
Re: Is the IP same check, how? -
BiosMarcel - 02.01.2017
very easy D;
PHP код:
if(!strcmp(ipOne, ipTwo, false))
{
print("IPs match.");
}
else
{
print("IPs don't match.");
}
RyderX are you a troll? You can't be serious, open your eyes!
Re: Is the IP same check, how? -
aw1337 - 02.01.2017
Код:
GetIP(playerid, ip1, 18);
GetIP(pid, ip2, 18);
if(!strcmp(ip1, ip2, false))
{
SendClientMessage(playerid, GRAU, "Du kannst unter der gleichen IP-Adresse kein Geld vergeben.");
SendClientMessage(playerid, ROT, "Bitte beachte das dies dokumentiert wird.");
for(new i=0; i<GetMaxPlayers(); i++)
{
new str[128];
format(str,sizeof(str),"[ADMIN] %s hat versucht %s Geld zu geben (identische IP-Adresse).",PlayerName(playerid),PlayerName(pid));
if(!IsAdmin(i, 1))continue;
SendClientMessage(i, GELB, str);
}
return 1;
}
Why do i get these Errors ? How do i have to do it?
C:\Users\Safa B\Desktop\Server\gamemodes\gamemode.pwn(10704) : error 017: undefined symbol "ip1"
C:\Users\Safa B\Desktop\Server\gamemodes\gamemode.pwn(10705) : error 017: undefined symbol "ip2"
C:\Users\Safa B\Desktop\Server\gamemodes\gamemode.pwn(10706) : error 017: undefined symbol "ip1"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
Re: Is the IP same check, how? -
RyderX - 02.01.2017
Quote:
Originally Posted by [Bios]Marcel
very easy D;
PHP код:
if(!strcmp(ipOne, ipTwo, false))
{
print("IPs match.");
}
else
{
print("IPs don't match.");
}
RyderX are you a troll? You can't be serious, open your eyes!
|
it's just 3:18AM im just like a drunk guy