2021-06-28, 09:45 PM
(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(playerid, bool:success)
{
if(success)
{
new query[256], field[24];
? ? format(query, sizeof(query), "SELECT * FROM `USERS` WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(ReturnName(playerid)));
database_result = db_query(server_database, query);
if(db_num_rows(database_result))
{
db_get_field_assoc(database_result, "SCORE", field, sizeof(field));
SetPlayerScore(playerid, strval(field));
db_get_field_assoc(database_result, "KILLS", field, sizeof(field));
PlayerInfo[playerid][pKills] = strval(field);
db_get_field_assoc(database_result, "DEATHS", field, sizeof(field));
PlayerInfo[playerid][pDeaths] = strval(field);
}
db_free_result(database_result);
ShowModelSelectionMenu(playerid, joinskin, "Select a Skin");
SendClientMessage(playerid, -1, "SERVER: You have successfully logged into your account.");
return 1;
}
else {
Kick(playerid);
}
return 1;
}