02.02.2014, 00:25
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
In PlayerConnect we'll add 3 new variables
Then we'll get the player's name and IP using "loginname and IP" variables
Next we will compare two strings to see if they are the same using strcmp
Then we'll give a message saying "Welcome"
Then we'll put the code of what happens if the IP isnt the same
and a return
Full code:
Compile and your done
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>
pawn Code:
public OnPlayerConnect(playerid)
pawn Code:
new loginname[24], IP[16], String[256];
pawn Code:
GetPlayerName(playerid, loginname, 24); // GetPlayerName(playerid, variable, sizeof(variable));
GetPlayerIp(playerid, IP, 16); // GetPlayerIp(playerid, variable, sizeof(variable));
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)
pawn Code:
{
SendClientMessage(playerid, 0xFFFFFFFF, "Welcome Back!");
}
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
}
pawn Code:
return 1;
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