Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] How to tell user if they are registered or not?

 
  • 0 Vote(s) - 0 Average
Pawn How to tell user if they are registered or not?
CrypticSin
Offline

Burgershot Member
Posts: 24
Threads: 9
Joined: Mar 2021
Reputation: 0
#1
2021-06-26, 11:14 AM
I've got a login and registration system which works using SQLlite.

Im trying to let the server tell the player whether they are registered or not?

So if they are already registered the server should say "Welcome back 'player' You are already registered on the server please log in to continue." By returning the playername.

But if they are not registered it should prompt the user with "The 'username' is not registered on this server."

PHP Code:
public OnPlayerConnect(playerid)
{
SetPlayerCamera(playerid);
    SetPlayerScore(playerid, 0);
    
    PlayerInfo
[playerid][pKills] = 0;
PlayerInfo[playerid][pDeaths] = 0;

PlayerInfo[playerid][pLoggedIn] = false;

new 
query[128];
format(query, sizeof(query), "SELECT `NAME` FROM `USERS` WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(ReturnName(playerid)));
  database_result = db_query(server_database, query);
  if(db_num_rows(database_result))
{
// Registered accounts see this login
ShowPlayerDialog(playerid, LOGIN_DIALOG, DIALOG_STYLE_PASSWORD, "{FFFFFF}TWDZS: Account Login", "{FFFFFF}Please enter your password below to login to your account:", "Enter", "Leave"); 
}
else
{
ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "{FFFFFF}TWDZS: Register Account", "Please enter a strong password to register your account", "Register", "Cancel");
}
return 
1;

} 
Pinch
Offline

Burgershot Member
Posts: 391
Threads: 19
Joined: Apr 2019
Reputation: 22
Location: Belgrade, Serbia
#2
2021-06-26, 11:50 AM
https://fiddle.sa-mp.dev/PegmatiteFrozenTuna
Using Pawn.CMD?
If you're doing so, this is the very first sign that you absolutely shouldn't utilize your all powerful P-Code knowledge in any of the scripting discussion topics.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode