[Tutorial] Nickname logged in by 1 IP Address
#1

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
pawn Code:
#include <a_samp>
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
pawn Code:
return 1;
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
Reply
#2

Thanks man, this is really helpful for me. I appreciate this.
Reply
#3

What if someone has dynamic ip?
Reply
#4

Quote:
Originally Posted by K9IsGodly
View Post
Thanks man, this is really helpful for me. I appreciate this.
Your welcome

Quote:
Originally Posted by newbienoob
View Post
What if someone has dynamic ip?
then this system wont work I guess
Reply
#5

noob tutorial and completely non sense, so anyone with a router and a laptop will get auto banned.
most people dont get static IPs.
Reply
#6

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

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

Haha thank you... solved my problems. (y)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)