Hey,
Wenn ich mich einlogge kommt kein Login O. registrier Fenster
Weiß einer warum das so ist
public OnPlayerConnect(playerid)
{
strdel(Query,0,STR_LEN);
for(new x; pStats:x < pStats; x++) PlayerInfo[playerid][pStats:x] = 0;
GetPlayerName(playerid,PlayerInfo[playerid][pName],20);
SendClientMessage(playerid,-1,"Willkommen auf dem Server");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(player_loged_in{playerid}){
SavePlayerData(playerid);
player_loged_in{playerid}=false;
enter_password_try{playerid}=0;
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(player_loged_in{playerid}==false)return Kick(playerid);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
printf("Hallo3");
TogglePlayerSpectating(playerid,1);
SetTimerEx("LoginCamera", 100, false, "i", playerid);
printf("Hallo1");
return 1;
}
public OnPlayerCheckAccount(playerid)
{
new row, field;
cache_get_data(row,field);
if(!row)return ShowPlayerDialog(playerid, DIALOG_REGISTER_ACCEPT, DIALOG_STYLE_MSGBOX,"Registrierung",DIALOG_REGISTER_ACCEPT_TEXT,"Weiter","Abbrechen");
else{
cache_get_field_content(0,"Password",PlayerInfo[playerid][pPassword]);
cache_get_field_content(0,"LastLogin",PlayerInfo[playerid][pLastLogin]);
cache_get_field_content(0,"Ban",PlayerInfo[playerid][pBan]);
if(PlayerInfo[playerid][pBan] == 1)return Kick(playerid);
strdel(Query,0,STR_LEN);
strdel(ALLSTRING,0,sizeof(ALLSTRING));
format(ALLSTRING,64,"Passworteingabe | Letzer Login: {FF8C00}%s",PlayerInfo[playerid][pLastLogin]);
SendClientMessage(playerid,-1,"Dein Account wurde gefunden. Bitte logge dich ein.");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login",ALLSTRING,"Anmelden","Abbrechen");
}
return 1;
}
public OnPlayerLoadPlayerData(playerid)
{
new data[30];
cache_get_row(0,0,PlayerInfo[playerid][pName]);
cache_get_row(0,2,data); PlayerInfo[playerid][pAge] = strval(data);
cache_get_row(0,3,PlayerInfo[playerid][pCountry]);
cache_get_row(0,4,data); PlayerInfo[playerid][pLevel] = strval(data);
cache_get_row(0,5,data); PlayerInfo[playerid][pAdmin] = strval(data);
cache_get_row(0,6,data); PlayerInfo[playerid][pDonate] = strval(data);
cache_get_row(0,7,PlayerInfo[playerid][pGender]);
cache_get_row(0,8,data); PlayerInfo[playerid][pMoney] = strval(data);
cache_get_row(0,9,data); PlayerInfo[playerid][pBank] = strval(data);
cache_get_row(0,10,data); PlayerInfo[playerid][pPosX] = floatstr(data);
cache_get_row(0,11,data); PlayerInfo[playerid][pPosY] = floatstr(data);
cache_get_row(0,12,data); PlayerInfo[playerid][pPosZ] = floatstr(data);
cache_get_row(0,13,data); PlayerInfo[playerid][pVW] = strval(data);
cache_get_row(0,14,data); PlayerInfo[playerid][pInt] = strval(data);
cache_get_row(0,15,data); PlayerInfo[playerid][pFraction] = strval(data);
cache_get_row(0,16,data); PlayerInfo[playerid][pCarlic] = strval(data);
cache_get_row(0,17,data); PlayerInfo[playerid][pBikelic] = strval(data);
cache_get_row(0,18,data); PlayerInfo[playerid][pPlanelic] = strval(data);
cache_get_row(0,19,data); PlayerInfo[playerid][pLKWlic] = strval(data);
cache_get_row(0,20,data); PlayerInfo[playerid][pHelilic] = strval(data);
cache_get_row(0,21,data); PlayerInfo[playerid][pHealth] = floatstr(data);
cache_get_row(0,22,data); PlayerInfo[playerid][pArmour] = floatstr(data);
cache_get_row(0,25,PlayerInfo[playerid][pRegdate]);
TogglePlayerSpectating(playerid,0);
SetPlayerScore(playerid,PlayerInfo[playerid][pLevel]);
GivePlayerMoney(playerid,PlayerInfo[playerid][pMoney]);
SetCameraBehindPlayer(playerid);
SetSpawnInfo(playerid, 0, 0, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ], 0.0, 0, 0, 0, 0, 0, 0);
SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pVW]);
SetPlayerInterior(playerid,PlayerInfo[playerid][pInt]);
player_loged_in{playerid}=true;
strdel(Query,0,STR_LEN);
mysql_format(m_connect,Query,"UPDATE `accounts` SET `LastLogin` = NOW() WHERE `Name` = '%s'",PlayerName(playerid));
mysql_function_query(m_connect,Query,false,"","");
return SpawnPlayer(playerid);
}
public OnQueryError( errorid, error[], callback[], query[], connectionHandle ){
printf("EID: %d | Error: %s | callback: %s | Query: %s", errorid, error, callback, query);
return 1;
}
stock Databaseconnect()
{
if(mysql_ping(m_connect) == 1)return print("Verbindung hergestellt");
else{
m_connect = mysql_connect("localhost", "root", "samp_db", "");
if(mysql_ping(m_connect) == 1)return print("Verbindung hergestellt");
else{
print("Verbindung fehlgeschlagen");
SendRconCommand("exit");
return 1;
}
}
}
stock SavePlayerData(playerid)
{
strdel(Query,0,STR_LEN);
GetPlayerPos(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
PlayerInfo[playerid][pInt] = GetPlayerInterior(playerid);
PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
GetPlayerArmour(playerid, PlayerInfo[playerid][pArmour]);
GetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]);
mysql_format(m_connect,Query,"UPDATE `accounts` SET `Name` = '%s', `Level` = '%d', `Admin` = '%d', `Donate` = '%d', `Money` = '%d', `Bank` = '%d', `X` = '%f', `Y` = '%f', `Z` = '%f', `VW` = '%d', `Interior` = '%d', `Fraction` = '%d', `Carlic` = '%d', `Bikelic` = '%d', `Planelic` = '%d', `LKWlic` = '%d', `Helilic` = '%d', `Health` = '%f', `Armour` = '%f', `Ban` = '%d' WHERE `Name` = '%s' ",PlayerName(playerid),PlayerInfo[playerid][pLevel],PlayerInfo[playerid][pAdmin],PlayerInfo[playerid][pDonate],
PlayerInfo[playerid][pMoney],PlayerInfo[playerid][pBank],PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ],PlayerInfo[playerid][pVW],PlayerInfo[playerid][pInt],PlayerInfo[playerid][pFraction],PlayerInfo[playerid][pCarlic],PlayerInfo[playerid][pBikelic],PlayerInfo[playerid][pPlanelic],PlayerInfo[playerid][pLKWlic],PlayerInfo[playerid][pHelilic],PlayerInfo[playerid][pHealth],PlayerInfo[playerid][pArmour],PlayerInfo[playerid][pBan],PlayerInfo[playerid][pName]);
mysql_function_query(m_connect,Query,true,"","");
printf("%d",strlen(Query));
return 1;
}
stock CreateTables()
{
mysql_format(m_connect,Query,"CREATE TABLE IF NOT EXISTS `accounts`(`Name` varchar(20) NOT NULL,`Password` varchar(129) NOT NULL,`Age` int(3) NOT NULL,`Country` varchar(20) NOT NULL,`Level` int(10) NOT NULL,`Admin` int(10) NOT NULL,`Donate` int(2) NOT NULL,`Gender` varchar(10) NOT NULL,`Money` int(22) NOT NULL,`Bank` int(22) NOT NULL,`X` float NOT NULL,`Y` float NOT NULL,`Z` float NOT NULL,");
mysql_format(m_connect,Query,"%s`VW` int(6) NOT NULL,`Interior` int(3) NOT NULL,`Rank` int(2) NOT NULL,`Fraction` int(2) NOT NULL,`Carlic` int(1) NOT NULL,`Bikelic` int(1) NOT NULL,`Planelic` int(1) NOT NULL,`LKWlic` int(1) NOT NULL,`Helilic` int(1) NOT NULL,`Health` float NOT NULL,`Armour` float NOT NULL,`Ban` int(1) NOT NULL,`RegDate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',`LastLogin` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00')",Query);
mysql_function_query(m_connect,Query,false,"","");
return 1;
}
MFG