[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


Messages In This Thread
Nickname logged in by 1 IP Address - by TheFlyer - 02.02.2014, 00:25
Re: Nickname logged in by 1 IP Address - by K9IsGodly - 02.02.2014, 02:01
Re: Nickname logged in by 1 IP Address - by newbienoob - 02.02.2014, 02:27
Re: Nickname logged in by 1 IP Address - by TheFlyer - 02.02.2014, 18:39
Re: Nickname logged in by 1 IP Address - by Vanter - 12.02.2014, 21:14
Re: Nickname logged in by 1 IP Address - by Vince - 12.02.2014, 21:28
Re: Nickname logged in by 1 IP Address - by Abagail - 12.02.2014, 21:36
Re: Nickname logged in by 1 IP Address - by SpearReal - 17.07.2014, 23:49

Forum Jump:


Users browsing this thread: 3 Guest(s)