Guten Abend Community,
Ich habe ein kleines Problem undzwar habe ich mein Godfather auf Mysql Umgeschrieben und nun wird das Geld auf der HAnd auf der Bank und der Skin nicht gespeichert.
Alles andere wird gespeichert...
So Lade ich den Spieler beim einloggen : (Habe alles ausser Skin und geld rausgenommen vom getint...)
stock OnPlayerLogin(playerid)
{
new tmp2[256];
new string2[128];
new playername2[MAX_PLAYER_NAME];
if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
{
{
{
GetPlayerName(playerid, PlayerInfo[playerid][pName], MAX_PLAYER_NAME);
PlayerInfo[playerid][pCash] = mysql_GetInt("accounts","Geld", "Name",PlayerInfo[playerid][pName]); // Geld auf der HAnd
PlayerInfo[playerid][pAccount] = mysql_GetInt("accounts","Bank", "Name",PlayerInfo[playerid][pName]); //Geld auf der Bank
PlayerInfo[playerid][pChar] = mysql_GetInt("accounts","Char","Name",PlayerInfo[playerid][pName]); // Char
PlayerInfo[playerid][pModel] = mysql_GetInt("accounts","Model","Name",PlayerInfo[playerid][pName]); //Model
printf("Spielerdaten vom Spieler %s erfolgreich aus der Datenbank geladen",SpielerName(playerid));
}//end while
}
PlayerInfo[playerid][pAdjustable] = 0;
ResetPlayerMoney(playerid);
ConsumingMoney[playerid] = 1;
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
CurrentMoney[playerid] = PlayerInfo[playerid][pCash];
if(PlayerInfo[playerid][pReg] == 0)
{
PlayerInfo[playerid][pLevel] = 1;
PlayerInfo[playerid][pSHealth] = 0.0;
PlayerInfo[playerid][pHealth] = 99.0;
PlayerInfo[playerid][pPos_x] = 2246.6;
PlayerInfo[playerid][pPos_y] = -1161.9;
PlayerInfo[playerid][pPos_z] = 1029.7;
PlayerInfo[playerid][pInt] = 15;
PlayerInfo[playerid][pLocal] = 255;
PlayerInfo[playerid][pTeam] = 3;
PlayerInfo[playerid][pModel] = 212;
PlayerInfo[playerid][pPhousekey] = 255;
PlayerInfo[playerid][pPbiskey] = 255;
PlayerInfo[playerid][pAccount] = 0;
PlayerInfo[playerid][pReg] = 1;
GivePlayerMoney(playerid, 10000);
}
if(PlayerInfo[playerid][pGesperrt] == 1)//PlayerInfo[playerid][pLevel] == -999) //autoban
{
format(string2,sizeof(string2)," %s versucht mit seinem gebannten Account online zu kommen und wurde gekickt!",playername2);
ABroadCast(COLOR_LIGHTRED,string2,1);
SendClientMessage(playerid,COLOR_RED," Du bist hier gebannt.. also mag dich hier keiner");
SendClientMessage(playerid,COLOR_RED," und du hast keine Freunde :D haha NOOB ");
Kick(playerid);
return 1;
}
else if(PlayerInfo[playerid][pCK] > 0)
{
Kick(playerid);
}
format(string2, sizeof(string2), "Erfolgreich eingeloggt, Willkommen %s",playername2);
SendClientMessage(playerid, COLOR_GREEN,string2);
printf("%s has logged in.",playername2);
if(PlayerInfo[playerid][pDonateRank] > 0)
{
SendClientMessage(playerid, COLOR_GREEN,"Du bist Premium Nutzer.");
}
if (PlayerInfo[playerid][pAdmin] > 0)
{
format(string2, sizeof(string2), "Willkommen Admin %d.",PlayerInfo[playerid][pAdmin]);
SendClientMessage(playerid, COLOR_GREEN,string2);
}
if(PlayerInfo[playerid][pSupporter] > 0)
{
format(string2, sizeof(string2), "Willkommen Supporter %d.",PlayerInfo[playerid][pSupporter]);
SendClientMessage(playerid, COLOR_GREEN,string2);
}
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pModel], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);
if(gTeam[playerid] == 0)
{
gTeam[playerid] = 3;
}
else
{
gTeam[playerid] = PlayerInfo[playerid][pTeam];
}
gPlayerLogged[playerid] = 1;
SpawnPlayer(playerid);
format(tmp2, sizeof(tmp2), "~w~Willkommen ~n~~y~ %s", playername2);
DateProp(playerid);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SendClientMessage(playerid, COLOR_YELLOW, motd);
}
if(OfflineFlucht[playerid] == 1 && WantedLevel[playerid] > 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "* Du wurdest Eingesperrt weil du Offline-Flucht begangen hast!");
SendClientMessage(playerid,COLOR_LIGHTRED, "* Pro WantedLevel 5 Minuten + 30 Minuten Strafe!");
new sendername[MAX_PLAYER_NAME],string[100];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "*[Auto-Jail] %s wurde wegen Offline-Flucht eignesperrt.", sendername);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsADChatter(i))
{
SendClientMessage(i,COLOR_ALLDEPT,string);
}
}
OfflineFlucht[playerid] = 0;
ResetPlayerWeapons(playerid);
new wlevel = WantedLevel[playerid];
PlayerInfo[playerid][pJailed] = 1;
PlayerInfo[playerid][pJailTime] = (wlevel*300)+1800;
SetPlayerInterior(playerid, 3);
if(LSPDZellen == 0)//zelle1
{
SetPlayerPos(playerid,219.4217,110.5207,999.0156);
LSPDZellen += 1;
}
if(LSPDZellen == 1)//zelle2
{
SetPlayerPos(playerid,223.2922,110.6890,999.0156);
LSPDZellen += 1;
}
if(LSPDZellen == 2)//zelle3
{
SetPlayerPos(playerid,215.0419,110.2922,999.0156);
LSPDZellen = 0;
}
WantedPoints[playerid] = 0;
SetPlayerWantedLevel(playerid,0);
WantedLevel[playerid] = 0;
}
else if(OfflineFlucht[playerid] == 1 && WantedLevel[playerid] == 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "* Du wurdest eingesperrt weil du Offline-Flucht begangen hast!");
new sendername[MAX_PLAYER_NAME],string[100];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "*[Auto-Jail] %s wurde wegen Offline-Flucht eingesperrt.", sendername);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsADChatter(i))
{
SendClientMessage(i,COLOR_ALLDEPT,string);
}
}
OfflineFlucht[playerid] = 0;
ResetPlayerWeapons(playerid);
PlayerInfo[playerid][pJailed] = 1;
PlayerInfo[playerid][pJailTime] = 300;
SetPlayerInterior(playerid, 3);
if(LSPDZellen == 0)//zelle1
{
SetPlayerPos(playerid,215.0419,110.2922,999.0156);
LSPDZellen += 1;
}
if(LSPDZellen == 1)//zelle2
{
SetPlayerPos(playerid,227.8457,110.7000,999.0156);
LSPDZellen += 1;
}
if(LSPDZellen == 2)//zelle3
{
SetPlayerPos(playerid,223.2922,110.6890,999.0156);
LSPDZellen = 0;
}
WantedPoints[playerid] = 0;
SetPlayerWantedLevel(playerid,0);
WantedLevel[playerid] = 0;
}
else if(OfflineFlucht[playerid] == 2 && WantedLevel[playerid] > 0)
{
SendClientMessage(playerid,COLOR_LIGHTRED, "* Du wurdest Eingesperrt weil du Gecuffed einen Crash hattest!");
SendClientMessage(playerid,COLOR_LIGHTRED, "* Pro WantedLevel 5 Minuten!");
new sendername[MAX_PLAYER_NAME],string[100];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "*[Auto-Jail] %s wurde wegen Exe-Crash eingesperrt.", sendername);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsADChatter(i))
{
SendClientMessage(i,COLOR_ALLDEPT,string);
}
}
OfflineFlucht[playerid] = 0;
ResetPlayerWeapons(playerid);
new wlevel = WantedLevel[playerid];
PlayerInfo[playerid][pJailed] = 1;
PlayerInfo[playerid][pJailTime] = wlevel*300;
SetPlayerInterior(playerid, 3);
if(LSPDZellen == 0)//zelle1
{
SetPlayerPos(playerid,223.2922,110.6890,999.0156);
LSPDZellen += 1;
}
if(LSPDZellen == 1)//zelle2
{
SetPlayerPos(playerid,227.8457,110.7000,999.0156);
LSPDZellen += 1;
}
if(LSPDZellen == 2)//zelle3
{
SetPlayerPos(playerid,215.0419,110.2922,999.0156);
LSPDZellen = 0;
}
WantedPoints[playerid] = 0;
SetPlayerWantedLevel(playerid,0);
WantedLevel[playerid] = 0;
}
new stern = WantedLevel[playerid];
SetPlayerWantedLevel(playerid,stern);
WantedPoints[playerid] = stern * 2;
if(PlayerInfo[playerid][pLevel] <= 3)
{
Noob[playerid] = Create3DTextLabel("{FFFFFF}*Neuling*",COLOR_WHITE,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(Noob[playerid], playerid, 0.0, 0.0, 0.4);
Noobi[playerid] = 1;
}
KHSperre[playerid] = 1;
SetTimerEx("KHSP",60000,0,"i",playerid);
return 1;
}
So speichere ich alles :
if(gPlayerLogged[playerid] == 1)
{
{
mysql_SetInt("accounts","Geld",GetPlayerMoney(playerid),"Name",PlayerInfo[playerid][pName]);
mysql_SetInt("accounts","Bank",PlayerInfo[playerid][pAccount],"Name",PlayerInfo[playerid][pName]);
mysql_SetInt("accounts","Char",GetPlayerSkin(playerid),"Name",PlayerInfo[playerid][pName]);
mysql_SetInt("accounts","Model",GetPlayerSkin(playerid),"Name",PlayerInfo[playerid][pName]);
printf("Spielerdaten vom Spieler %s erfolgreich in der Datenbank gespeichert.",SpielerName(playerid));
}
}
return 1;
}
Die Stuktur der Tabellen bzw. der sachen die nicht gespeichert werden :
`Geld` int(11) NOT NULL DEFAULT '0',
`Bank` int(11) NOT NULL DEFAULT '0',
`Char` int(11) NOT NULL DEFAULT '0',
`Model` int(11) NOT NULL DEFAULT '0',
Hoffentlich könnt ihr mich helfen...
//edit
Struktur hinzugefügt