[Tutorial] Make Your Login System More Secure - 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] Make Your Login System More Secure (
/showthread.php?tid=588639)
-
dh240473 - 11.09.2015
Removed
Re: Make Your Login System More Secure -
SickAttack - 11.09.2015
You are not ready to write any sort of documentation yet.
Re: Make Your Login System More Secure -
Banana_Ghost - 11.09.2015
If they haven't logged in, why not just prevent spawning instead of kicking them?
pawn Code:
public OnPlayerRequestSpawn(playerid)
{
if(AccInfo[playerid][PassType] == 0)
{
return 0;
}
return 1;
}
As for changing the password without logging in, why not just deny the command from being used instead of kicking them.
pawn Code:
CMD:changepass(playerid,params[])
{
if(AccInfo[playerid][Logged] == 0)
{
SendClientMessage(playerid, Red, "Login First Bruh ");
return 1;
}
else
{
new pass[128];
if(sscanf(params, "s[128]", pass))
{
SendClientMessage(playerid,Red,"USAGE: /changepass <new pass>");
return 1;
}
if(strlen(pass) < 3 || strlen(pass) > 32)
{
SendClientMessage(playerid,Red,"SERVER: Incorrect password length.");
return 1;
}
new string[128];
UpdatePlayerPass(playerid, pass);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
format(string, sizeof(string),"SERVER: You have successfully changed your password to \"%s\"",pass);
SendClientMessage(playerid,Yellow,string);
}
return 1;
}
As for a bot that connects:
pawn Code:
public OnPlayerConnect(playerid)
{
new ipaddr[16];
GetPlayerIp(playerid, ipaddr, 16);
if(IsPlayerNPC(playerid) && strcmp(ipaddr, "127.0.0.1",true)){
Kick(playerid);
return 0;
}
return 1;
}
People hate being kicked from servers. lol
Re: Make Your Login System More Secure -
dh240473 - 11.09.2015
Quote:
Originally Posted by Banana_Ghost
If they haven't logged in, why not just prevent spawning instead of kicking them?
pawn Code:
public OnPlayerRequestSpawn(playerid) { if(AccInfo[playerid][PassType] == 0) { return 0; } return 1; }
As for changing the password without logging in, why not just deny the command from being used instead of kicking them.
pawn Code:
CMD:changepass(playerid,params[]) { if(AccInfo[playerid][Logged] == 0) { SendClientMessage(playerid, Red, "Login First Bruh "); return 1; } else { new pass[128]; if(sscanf(params, "s[128]", pass)) { SendClientMessage(playerid,Red,"USAGE: /changepass <new pass>"); return 1; } if(strlen(pass) < 3 || strlen(pass) > 32) { SendClientMessage(playerid,Red,"SERVER: Incorrect password length."); return 1; } new string[128]; UpdatePlayerPass(playerid, pass); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); format(string, sizeof(string),"SERVER: You have successfully changed your password to \"%s\"",pass); SendClientMessage(playerid,Yellow,string); } return 1; }
As for a bot that connects:
pawn Code:
public OnPlayerConnect(playerid) { new ipaddr[16]; GetPlayerIp(playerid, ipaddr, 16); if(IsPlayerNPC(playerid) && strcmp(ipaddr, "127.0.0.1",true)){ Kick(playerid); return 0; } return 1; }
People hate being kicked from servers. lol
|
lol did you know raksamp?
Re: Make Your Login System More Secure -
dh240473 - 11.09.2015
deleted
Re: Make Your Login System More Secure -
dh240473 - 11.09.2015
deleted
Re: Make Your Login System More Secure -
Banana_Ghost - 11.09.2015
Quote:
Originally Posted by dh240473
lol did you know raksamp?
|
I thought checking the client version kept that from occuring?
Re: Make Your Login System More Secure -
J0sh... - 11.09.2015
Quote:
Originally Posted by Banana_Ghost
I thought checking the client version kept that from occuring?
|
Raksamp spoofs it as a client.
An 20 second timer to login is very bad and will piss off whoever is being kicked.