[Tutorial] Nickname logged in by 1 IP Address - 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)
+---- Forum: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Nickname logged in by 1 IP Address (
/showthread.php?tid=491998)
Nickname logged in by 1 IP Address -
TheFlyer - 02.02.2014
Hey everyone,
This is my first tutorial and since I couldn't find any tutorials about this, I made up with a tiny system that consist on a certain Nickname can only be logged in from 1 IP Address
to begin the Includes that we'll need is just a_samp
so at the top of the script you put this code
and then we'll search for
pawn Code:
public OnPlayerConnect(playerid)
In PlayerConnect we'll add 3 new variables
pawn Code:
new loginname[24], IP[16], String[256];
Then we'll get the player's name and IP using "loginname and IP" variables
pawn Code:
GetPlayerName(playerid, loginname, 24); // GetPlayerName(playerid, variable, sizeof(variable));
GetPlayerIp(playerid, IP, 16); // GetPlayerIp(playerid, variable, sizeof(variable));
Next we will compare two strings to see if they are the same using strcmp
pawn Code:
if (!strcmp(loginname, "TheFlyer")) // <-- Type your Nick or Player's Nick
if (!strcmp(IP, "168.36.161.268")) // <-- Type your IP or Player's IP | | | "168.36.161.268" is a IP that doesn't exist (I just made that up)
Then we'll give a message saying "Welcome"
pawn Code:
{
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome Back!");
}
Then we'll put the code of what happens if the IP isnt the same
pawn Code:
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "The IP you joined in isn't the same from the one when you first time played (We think your hacking accounts), BANNED!!!"); // Sends a message saying that the IP is not the same and he got banned
format(String, 256, "~r~your banned!~n~~y~reason: ~r~hacking a account");
GameTextForPlayer(playerid, String, 10000, 3); // GameTextForPlayer(playerid, String, Time, Style);
BanEx(playerid, "account hack"); // Bans a player with a reason on samp.ban
}
and a return
Full code:
pawn Code:
#include <a_samp>
public OnPlayerConnect(playerid)
{
new loginname[24], IP[16], String[256];
GetPlayerName(playerid, loginname, 24);
GetPlayerIp(playerid, IP, 16);
if (!strcmp(loginname, "TheFlyer")) // <-- Type your Nick or Player's Nick
if (!strcmp(IP, "168.36.161.268")) // <-- Type your IP or Player's IP | | | "168.36.161.268" is a IP that doesn't exist (I just made that up)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome Back!");
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "The IP you joined in isn't the same from the one when you first time played (We think your hacking accounts), BANNED!!!");
format(String, 256, "~r~your banned!~n~~y~reason: ~r~hacking a account");
GameTextForPlayer(playerid, String, 10000, 3);
BanEx(playerid, "account hack");
}
return 1;
}
Compile and your done
pawn Code:
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Re: Nickname logged in by 1 IP Address -
K9IsGodly - 02.02.2014
Thanks man, this is really helpful for me. I appreciate this.
Re: Nickname logged in by 1 IP Address -
newbienoob - 02.02.2014
What if someone has dynamic ip?
Re: Nickname logged in by 1 IP Address -
TheFlyer - 02.02.2014
Quote:
Originally Posted by K9IsGodly
Thanks man, this is really helpful for me. I appreciate this.
|
Your welcome
Quote:
Originally Posted by newbienoob
What if someone has dynamic ip?
|
then this system wont work I guess
Re: Nickname logged in by 1 IP Address -
Vanter - 12.02.2014
noob tutorial and completely non sense, so anyone with a router and a laptop will get auto banned.
most people dont get static IPs.
Re: Nickname logged in by 1 IP Address -
Vince - 12.02.2014
Hardcoded stuff is not nice. Every time you need to change the name or IP you need to change it in the script and recompile it. Very bothersome. Better to keep a list of name/ip sets in a separate file or so.
Re: Nickname logged in by 1 IP Address -
Abagail - 12.02.2014
This isn't a great tutorial... There's a lot of thing's you have to keep in mind such as Dynamic IP's, etc... Would be good except it isn't... Sorry mate. My TIP is to re-do this.
- Abagail
Re: Nickname logged in by 1 IP Address -
SpearReal - 17.07.2014
Haha thank you... solved my problems. (y)