• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] How to tell user if they are registered or not?
#1
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(playerid0);

? ? 

? ? 
PlayerInfo[playerid][pKills] = 0;

PlayerInfo[playerid][pDeaths] = 0;



PlayerInfo[playerid][pLoggedIn] = false;



new 
query[128];

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

database_result db_query(server_databasequery);

? if(
db_num_rows(database_result))

{

// Registered accounts see this login

ShowPlayerDialog(playeridLOGIN_DIALOGDIALOG_STYLE_PASSWORD"{FFFFFF}TWDZS: Account Login""{FFFFFF}Please enter your password below to login to your account:""Enter""Leave"); 

}

else

{

ShowPlayerDialog(playeridREGISTER_DIALOGDIALOG_STYLE_PASSWORD"{FFFFFF}TWDZS: Register Account""Please enter a strong password to register your account""Register""Cancel");

}

return 
1;




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


Forum Jump: