SA-MP Forums Archive
Increasing a variable by one after failed login - Help needed - 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: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Increasing a variable by one after failed login - Help needed (/showthread.php?tid=96413)



Increasing a variable by one after failed login - Help needed - MisterTickle - 07.09.2009

Basically I have it so theirs a text draw where you have "Login Attempts Remanining" in the corner, Its value changes depending on how many "login counts" you have, If you reach 3, It autokicks you.

Now I have this code for login

Код:
dcmd_login(playerid,params[])
{
	if (PlayerI[playerid][PlayerLogged] == 1) return SystemMsg(playerid,"Already Logged In");
	if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account doesn't exist, please use '/register password'.");
	if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/login password'");
	if (udb_CheckLogin(PlayerName(playerid),params)) {
 	PlayerI[playerid][PlayerLogged] = 1;
 	Login(playerid); //login the player if hes loggedin succesfully
	return SystemMsg(playerid,"Successfully logged in!");
  else {
  PlayerI[playerid][LoginCount] ++ 1; }}
  return 1;
}
I'm trying to make it so each time you attempt to login and you fail, It will increase the login by one. I have only started to code a few days ago so bare with me. Thanks.

Oh and also in general increasing values such as "playerkicked' I want to keep track of how many times a player is kicked and banned and want it to increase if the command is targeting them, How is this done?


Re: Increasing a variable by one after failed login - Help needed - Calgon - 08.09.2009

You mean a textdraw? https://sampwiki.blast.hk/wiki/TextDrawCreate


Re: Increasing a variable by one after failed login - Help needed - MisterTickle - 08.09.2009

The textdraw is fine, It reads the value of "logincount" and when it is 3 it kicks you, it changes the value of the textdraw depending on your login count

i want a system so with my login cmd if you fail login it ads a logincount, i can make it reset to 0 on dc but i dont know how to increase it by 1 per failed login


Re: Increasing a variable by one after failed login - Help needed - _Vortex - 08.09.2009

To track how many times a player has been kicked, banned, etc, make 2 new PlayerI things under the enum, called Kicked and Banned

and when your ban/kick command is executed, before they're ban do something like
Код:
PlayerI[playerid][Kicked] ++;
PlayerI[playerid][Banned] ++;
(no need for the 1)


Re: Increasing a variable by one after failed login - Help needed - MisterTickle - 08.09.2009

With your help vortex and moving some things around I got it working, Thanks.


Re: Increasing a variable by one after failed login - Help needed - _Vortex - 08.09.2009

Quote:
Originally Posted by MisterTickle
With your help vortex and moving some things around I got it working, Thanks.
No problem