Increasing a variable by one after failed login - Help needed
#1

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?
Reply
#2

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

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

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)
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)