I want so that the registration and login to be used in a GUI system and request assistance if you understand well this pawn Help me remake
Код:
//Includes----------------------------------------------------------------------
#include <a_samp>
#include <dudb>
#include <dutils>
//------------------------------------------------------------------------------
#pragma unused strtok
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//------------------------------------------------------------------------------
//Spalvos//
#define COLOR_SYSTEM 0xEFEFF7AA
#define green 0x33FF33AA
#define blue 0x00FFFFAA
//------------------------------------------------------------------------------
new PLAYERLIST_authed[MAX_PLAYERS];
#if defined FILTERSCRIPT
//------------------------------------------------------------------------------
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Filterscript");
print("--------------------------------------\n");
return 1;
}
//------------------------------------------------------------------------------
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print("Filterscript");
print("----------------------------------\n");
}
#endif
//------------------------------------------------------------------------------
public OnPlayerRequestSpawn(playerid)
{
if (udb_Exists(PlayerName(playerid))){
if (!PLAYERLIST_authed[playerid]){
SendClientMessage(playerid,green,"Jыs jau esate uюsiregistravжs, naudokite /login prisijungti prie savo sаskaitos.");
return 0;
}
}
return 1;
}
//------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid)
{
if (PLAYERLIST_authed[playerid])
{
dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
dUserSetINT(PlayerName(playerid)).("score",GetPlayerScore(playerid));
return 1;
}
PLAYERLIST_authed[playerid]=false;
return 1;
}
//------------------------------------------------------------------------------
public OnPlayerConnect(playerid)
{
if (PLAYERLIST_authed[playerid]==0)
{
if (udb_Exists(PlayerName(playerid)))
{
SystemMsg(playerid,"Jыs jau esate uюsiregistravжs, praрome prisijungti /login [slaptaюodis].");
return 1;
}
else{ SystemMsg(playerid,"Jыs neregistruotas naudokite /register [slaptaюodis] prisijungti naudosite /login [slaptaюodis].");
}
return 0;
}
return 1;
}
//------------------------------------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(login,5,cmdtext);
dcmd(register,8,cmdtext);
return 0;
}
//------------------------------------------------------------------------------
stock SystemMsg(playerid,msg[]) {
if ((IsPlayerConnected(playerid))&&(strlen(msg)>0)) {
SendClientMessage(playerid,COLOR_SYSTEM,msg);
}
return 1;
}
//------------------------------------------------------------------------------
stock PlayerName(playerid) {
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}
//------------------------------------------------------------------------------
dcmd_register(playerid,params[])
{
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Jыs jau registruotas.");
if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Jыs jau registruotas naudokite /login [slaptaюodis].");
if (strlen(params)==0) return SystemMsg(playerid,"Naudojimas: /register [slaptaюodis]");
if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,"Jыs sлkmingai uюsiregistravote dabar naudokite /login [slaptaюodis].");
return true;
}
//------------------------------------------------------------------------------
dcmd_login(playerid,params[])
{
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Jыs jau prisijunges.");
if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Jыs neturite sаskaitos, praрome uюsiregistruoti /register [slaptaюodis]");
if (strlen(params)==0) return SystemMsg(playerid,"Naudojimas: /login [slaptaюodis]");
if (udb_CheckLogin(PlayerName(playerid),params)) {
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score"));
SetPlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money"));
PLAYERLIST_authed[playerid]=true;
return SystemMsg(playerid,"Jыs sлkmingai prisijungлte.");
}
return SystemMsg(playerid,"Neteisingas slaptaюodis arba vartotojo vardas!");
}
//------------------------------------------------------------------------------