Is the IP same check, how?
#1

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.
Reply
#2

Learn to use ****** ...

https://sampwiki.blast.hk/wiki/GetPlayerIp
https://sampwiki.blast.hk/wiki/Strcmp
Reply
#3

SA:MP Wiki is big
https://sampwiki.blast.hk/
Reply
#4

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(playeridparams[])
{
  new 
otheridcash;
  if (
sscanf(params"dd"otheridcash)) SendClientMessage(playeridCOLOR_RED"[ERROR]: {FFFFFF}/pay [ID] [Amount]");
  else
  {
    if(
GetPlayerMoney(playerid) < cashSendClientMessage(playeridCOLOR_RED"[ERROR]: {FFFFFF}You don't have that much!");
    else if(!
IsPlayerConnected(otherid)) SendClientMessage(playeridCOLOR_RED"[ERROR]: {FFFFFF}Invalid ID (Player not connected)");
    else if(
otherid == playeridSendClientMessage(playeridCOLOR_RED"[ERROR]: {FFFFFF}Invalid ID (You can't pay yourself)");
    else
    {
      
GivePlayerMoney(playerid, -cash);
      
GivePlayerMoney(otheridcash);
    }
  }
  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
Reply
#5

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
Reply
#6

I dont understand it damn... read alot of times but i still dont get it, please can someone do it for me?
Reply
#7

PHP код:
COMMAND:pay(playeridparams[])
{
  new 
otheridcash;
  if (
sscanf(params"dd"otheridcash)) SendClientMessage(playeridCOLOR_RED"[ERROR]: {FFFFFF}/pay [ID] [Amount]");
  else
  {
    if(
GetPlayerMoney(playerid) < cashSendClientMessage(playeridCOLOR_RED"[ERROR]: {FFFFFF}You don't have that much!");
    else if(!
IsPlayerConnected(otherid)) SendClientMessage(playeridCOLOR_RED"[ERROR]: {FFFFFF}Invalid ID (Player not connected)");
    else if(
otherid == playeridSendClientMessage(playeridCOLOR_RED"[ERROR]: {FFFFFF}Invalid ID (You can't pay yourself)");
    else
    {
      
GivePlayerMoney(playerid, -cash);
      
GivePlayerMoney(otheridcash);
    }
  }
  return 
1;

Here it is
Reply
#8

very easy D;

PHP код:
    if(!strcmp(ipOneipTwofalse))
    {
        print(
"IPs match.");
    }
    else
    {
        print(
"IPs don't match.");
    } 
RyderX are you a troll? You can't be serious, open your eyes!
Reply
#9

Код:
	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.
Reply
#10

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
very easy D;

PHP код:
    if(!strcmp(ipOneipTwofalse))
    {
        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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)