// Register / Login Filterscript //
#include <a_samp>
#include <dudb>
#include <dutils>
#include <FileManager>
#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
//Colors//
#define COLOR_SYSTEM 0xEFEFF7AA
#define green 0x33FF33AA
#define blue 0x00FFFFAA
#define TEAM_CIVIL 0
#define TEAM_MENTO 1
#define TEAM_RENDOR 2
#define TEAM_KOMMANDOS 3
#define TEAM_BERGYILKOS 4
#define TEAM_TAXI 5
#define TEAM_UTTISZTITO 6
new PLAYERLIST_authed[MAX_PLAYERS];
static gTeam[MAX_PLAYERS];
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\"Register / Login System\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print(\"\\n----------------------------------\");
print(\" Register / Login System by wasdkiller\");
print(\"----------------------------------\\n\");
}
#endif
public OnPlayerRequestSpawn(playerid)
{
if (udb_Exists(PlayerName(playerid)))
{
if (!PLAYERLIST_authed[playerid])
{
SendClientMessage(playerid,green,\"Mar regisztralva vagy, hasznald a /login-t hogy bejelentkezz!\");
return 0;
}
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
if (PLAYERLIST_authed[playerid])
{
// If someone has logged in, it saves money and score.
dUserSetINT(PlayerName(playerid)).(\"money\",GetPlayerMoney(playerid));
dUserSetINT(PlayerName(playerid)).(\"score\",GetPlayerScore(playerid));
dUserSetINT(PlayerName(playerid)).(\"skin\",GetPlayerSkin(playerid));
dUserSetINT(PlayerName(playerid)).(\"munka\",gTeam[playerid]);
}
PLAYERLIST_authed[playerid]=false;
return 1;
}
public OnPlayerConnect(playerid)
{
if (PLAYERLIST_authed[playerid]==0)
{
if (udb_Exists(PlayerName(playerid)))
{
SystemMsg(playerid,\"Mar regisztralva vagy, hasznald a /login-t hogy bejelentkezz!\");
}
else
{
SystemMsg(playerid,\"Meg nem vagy regisztralva. /register [jelszo]\");
}
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,\"Mar regisztralva vagy, hasznald a /login-t hogy bejelentkezz!\");
if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,\"Mar regisztralva vagy, hasznald a /login-t hogy bejelentkezz!\");
if (strlen(params)==0) return SystemMsg(playerid,\"HASZNALAT: /register [jelszo]\");
if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,\"Sikeresen regisztraltal, hasznald a /login-t hogy bejelentkezz!\");
return true;
}
dcmd_login(playerid,params[])
{
if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,\"Mar be vagy jelentkezve!\");
if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,\"Nem vagy regisztralva! /register [jelszo]\");
if (strlen(params)==0) return SystemMsg(playerid,\"HASZNALAT: /login [jelszo]\");
if (udb_CheckLogin(PlayerName(playerid),params)) {
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).(\"score\"));
SetPlayerMoney(playerid,dUserINT(PlayerName(playerid)).(\"money\"));
SetPlayerSkin(playerid,dUserINT(PlayerName(playerid)).(\"skin\"));
gTeam[playerid] = (playerid,dUserINT(PlayerName(playerid)).(\"munka\"));
SpawnPlayer(playerid);
SetPlayerPos(playerid, -88.2897,1085.8445,19.7422);
SetPlayerFacingAngle(playerid, 57.0515);
PLAYERLIST_authed[playerid]=true;
return SystemMsg(playerid,\"Sikeresen bejelentkeztel, visszakaptad a pontjaidat!\");
}
return SystemMsg(playerid,\"Rossz felhasznalovnev vagy jelszo\");
}
A pénz-t és a score-t visszadja, de a skin-t és a gTeam-ot nem kapom meg. Mi lehet a baj? Nincs benne a modomba a OnPlayerSpawn-nál semmi(pl. gTeam[playerid] = (szám), sem a GameModInit-nál hogy AddPlayerClass, mi lehet a baj?