Nabend Leute, ich habe ein problem mit dem ServerSide Money von Luís Miki. Hier der Link [Include] Server-Side Money. Ich hab das System meinem Script angepasst aber komischweiße wird das Geld immer verdoppelt. Etwas großes kann es ja nicht sein, leider find ich den Fehler nicht. Hier der Code:
stock CreateAccount(playerid,passwort[])
{
new username[24], query[128];
GetPlayerName(playerid,username,sizeof(username));
format(query,128,"INSERT INTO `accounts` (Name,Passwort) VALUES ('%s',SHA1('%s'))",username,passwort);
mysql_query(query);
AccountInfo[playerid][xLevel] = StartLevel;
SetPlayerScore(playerid, AccountInfo[playerid][xLevel]);
GivePlayerServerMoney(playerid, StartMoney);
PlayerLogin(playerid);
return 1;
}
stock LoadAccount(playerid)
{
new query[128],data[128],bedienung[40];
format(bedienung,sizeof(bedienung),"`Name` = '%s'",GetName(playerid));
format(query,sizeof(query),"SELECT * FROM `accounts` WHERE %s", bedienung);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
mysql_fetch_field("Level",data); AccountInfo[playerid][xLevel] = strval(data);
mysql_fetch_field("Admin",data); AccountInfo[playerid][xAdmin] = strval(data);
mysql_fetch_field("Tutorial",data); AccountInfo[playerid][xTutorial] = strval(data);
mysql_fetch_field("Geld",data); AccountInfo[playerid][xGeld] = strval(data);
mysql_fetch_field("Bank",data); AccountInfo[playerid][xBank] = strval(data);
mysql_fetch_field("EcKarte",data); AccountInfo[playerid][xEcKarte] = strval(data);
mysql_fetch_field("Wanteds",data); AccountInfo[playerid][xWanteds] = strval(data);
mysql_fetch_field("Skin",data); AccountInfo[playerid][xSkin] = strval(data);
mysql_fetch_field("Leader",data); AccountInfo[playerid][xLeader] = strval(data);
mysql_fetch_field("Member",data); AccountInfo[playerid][xMember] = strval(data);
mysql_fetch_field("FrakSkin",data); AccountInfo[playerid][xFrakSkin] = strval(data);
PlayerLogin(playerid);
}
else SendClientMessage(playerid,0xFF0000FF,"Es ist ein Problem mit ihren Account aufgetaucht");
mysql_free_result();
return 1;
}
stock PlayerLogin(playerid)
{
new string[128];
Eingeloggt[playerid] = 1;
SetPlayerScore(playerid, AccountInfo[playerid][xLevel]);
SetPlayerWantedLevel(playerid, AccountInfo[playerid][xWanteds]);
GivePlayerServerMoney(playerid, AccountInfo[playerid][xGeld]);
SetPlayerColor(playerid, COLOR_WHITE);
SpawnPlayer(playerid);
UpdateAccount(playerid);
if(AccountInfo[playerid][xTutorial] == 0)
{
TutorialTimer[playerid] = SetTimerEx("PlayerTutorial", 1000, 1, "i", playerid);
TogglePlayerControllable(playerid, false);
}
if(AccountInfo[playerid][xAdmin] > 0)
{
format(string, sizeof(string), "{088A08}SERVER: {FFFFFF}Du bist als Admin level {088A08}%d{FFFFFF} Eingeloggt.",AccountInfo[playerid][xAdmin]);
SendClientMessage(playerid, 0xFFFFFFAA, string);
}
}
stock UpdateAccount(playerid)
{
if(Eingeloggt[playerid] == 1 && !IsPlayerNPC(playerid))
{
new bedien[128];
format(bedien,sizeof(bedien),"`Name`='%s'",GetName(playerid));
MySQLUpdate(bedien,"Level",AccountInfo[playerid][xLevel]);
MySQLUpdate(bedien,"Admin",AccountInfo[playerid][xAdmin]);
MySQLUpdate(bedien,"Tutorial",AccountInfo[playerid][xTutorial]);
MySQLUpdate(bedien,"Geld",GetPlayerMoney(playerid));
MySQLUpdate(bedien,"Bank",AccountInfo[playerid][xBank]);
MySQLUpdate(bedien,"EcKarte",AccountInfo[playerid][xEcKarte]);
MySQLUpdate(bedien,"Wanteds",AccountInfo[playerid][xWanteds]);
MySQLUpdate(bedien,"Skin",AccountInfo[playerid][xSkin]);
MySQLUpdate(bedien,"Leader",AccountInfo[playerid][xLeader]);
MySQLUpdate(bedien,"Member",AccountInfo[playerid][xMember]);
MySQLUpdate(bedien,"FrakSkin",AccountInfo[playerid][xFrakSkin]);
}
return 1;
}