• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] How to make pasword validation?
#3
(2021-06-28, 09:41 AM)Pinch Wrote:
Code:
public OnPlayerLogin(playerid, bool:success)

{

? ? if(success)

? ? {

? ? ? ? DeletePVar(playerid, "loginFails");

? ? ? ? // Logged in code

? ? }

? ? else

? ? {

? ? ? ? SetPVarInt(playerid, "loginFails", (GetPVarInt(playerid, "loginFails")  1));

? ? ? ? if(GetPVarInt(playerid, "loginFails") >= 3)

? ? ? ? {

? ? ? ? ? ? SendClientMessage(playerid, -1, "Too many failed login attempts!");

? ? ? ? ? ? Kick(playerid);

? ? ? ? }

? ? ? ? else

? ? ? ? {

? ? ? ? ? ? SendClientMessage(playerid, -1, "You entered the wrong password, please try again!");

? ? ? ? }

? ? }

}



Hi my OnPlayerLogin looks a bit more different so im unsure how to fix the code with the one you sent.



PHP Code:
public OnPlayerLogin(playeridbool:success)

{

if(
success)

{

new 
query[256], field[24];

? ? 
format(querysizeof(query), "SELECT * FROM `USERS` WHERE `NAME` = '%s' COLLATE NOCASE"DB_Escape(ReturnName(playerid)));

database_result db_query(server_databasequery);

if(
db_num_rows(database_result))

{

db_get_field_assoc(database_result"SCORE"fieldsizeof(field));

SetPlayerScore(playeridstrval(field));



db_get_field_assoc(database_result"KILLS"fieldsizeof(field));

PlayerInfo[playerid][pKills] = strval(field);



db_get_field_assoc(database_result"DEATHS"fieldsizeof(field));

PlayerInfo[playerid][pDeaths] = strval(field);

}



db_free_result(database_result);

ShowModelSelectionMenu(playeridjoinskin"Select a Skin");



SendClientMessage(playerid, -1"SERVER: You have successfully logged into your account.");

return 
1;

}



else {

Kick(playerid);

}



return 
1;


  Reply


Messages In This Thread
How to make pasword validation? - by CrypticSin - 2021-06-27, 02:48 PM
RE: How to make pasword validation? - by Pinch - 2021-06-28, 09:41 AM
RE: How to make pasword validation? - by CrypticSin - 2021-06-28, 09:45 PM

Forum Jump: