Strcmp not working
#1

The problem is, im ID 0, i join, im fine. It says no difference, and ips are the same (127.0.0.1) and in the ini file too (127.0.0.1). Now my friend joins and it says DIFFERENCE FOUND, while the IP of my friend and the ip in the ini are exactly the same. And he gets banned. Please help me?

Код:
dcmd_actest(playerid, params[])
{
	new string[128];
  new Name[MAX_PLAYER_NAME+1];

  GetPlayerName(playerid, Name, sizeof(Name));
	GetPlayerIp(playerid, PlayerIP[playerid], sizeof(PlayerIP));

	if(!strcmp(Name, "Eros"))
	{
	  printf("Player IP: %s --- Original IP: %s", PlayerIP[playerid], dini_Get("Players.ini", "ErosIP"));

		if(strcmp(PlayerIP, dini_Get("Players.ini", "ErosIP")))
		{
			format(string, sizeof(string), "***BAN: %s (%d) (INVALID NICK) Fake Admin!", Name, playerid);
 			SendClientMessageToAll(COLOR_PINK, string);
		}
	}

	else if(!strcmp(Name, "Decysen"))
	{
	  printf("Player IP: %s --- Original IP: %s", PlayerIP[playerid], dini_Get("Players.ini", "DecysenIP"));
		
		if(strcmp(PlayerIP, dini_Get("Players.ini", "DecysenIP")))
		{
			format(string, sizeof(string), "***BAN: %s (%d) (INVALID NICK) Fake Admin!", Name, playerid);
 			SendClientMessageToAll(COLOR_PINK, string);
		}
	}
	
	return 1;
}
Reply
#2

*BUMP*
Reply
#3

make sure:
new PlayerIP[MAX_PLAYERS];

is actually:
new PlayerIP[MAX_PLAYERS][];

because the ip is actually a string, not just 1 integer.
PlayerIP[MAX_PLAYERS][] =
{
{"192.168.0.1"},//id 1
{"192.168.0.2"} // id 2
};

just a thought, might, might not work
Reply
#4

Check strcmp's parameters.. i think your missing some.

Also try seeing if they are 0. like..

pawn Код:
if(strcmp(Name, "Eros") == 0)
Reply
#5

Sorry for the late bump, but still cannot get it to work..

Thnx
Reply
#6

pawn Код:
if(!strcmp(Name,"/command",1))
Reply
#7

pawn Код:
if(strcmp("Eros", Name, true) == 0)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)