Probier mal so
mysql_format(Handle, Query, sizeof(Query), "UPDATE `Spieler` SET `IP`='%s', `Admin`=%d, `VIP`=%d, `Morde`=%d, `Tode`=%d, `Level`=%d, `Geld`=%d WHERE `ID`=%d", IP[playerid], SpielerInfo[playerid][Admin], SpielerInfo[playerid][VIP], SpielerInfo[playerid][Morde], SpielerInfo[playerid][Tode], GetPlayerScore(playerid), SpielerInfo[playerid][Geld], SpielerInfo[playerid][ID]);
Leider ist auch das nicht die Lösung.
Ich stelle mal meinen ganzen Code hier bereit
@Jeffry
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#include <a_mysql>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
#endif
static
Handle,
Name[MAX_PLAYERS][24],
IP[MAX_PLAYERS][16]
;
stock SpielerSpeichern(playerid)
{
new Query[256];
mysql_format(Handle, Query, sizeof(Query), "UPDATE `Spieler` SET `IP`='%s', `Admin`=%d, `VIP`=%d, `Morde`=%d, `Tode`=%d, `Level`=%d, `Geld`=%d WHERE `ID`=%d", IP[playerid], SpielerInfo[playerid][Admin], SpielerInfo[playerid][VIP], SpielerInfo[playerid][Morde], SpielerInfo[playerid][Tode], GetPlayerScore(playerid), SpielerInfo[playerid][Geld], SpielerInfo[playerid][ID]);
mysql_tquery(Handle, Query, "OnAccountCheck", "i", playerid);
}
new IstRegistriert[MAX_PLAYERS];
enum SpielerDaten
{
ID,
Passwort[129],
Admin,
VIP,
Morde,
Tode,
Level,
Geld
}
// MYSQL DATEN //
#define M_HOST "Host"
#define M_USER "Benutzer"
#define M_DATA "Datenbank"
#define M_PASS "Passwort"
// MYSQL DATEN ENDE//
public OnGameModeInit()
{
//===[ M_Connection ]===//
mysql_log(LOG_ERROR | LOG_WARNING | LOG_DEBUG);
Handle = mysql_connect(M_HOST, M_USER, M_DATA, M_PASS);
if(mysql_errno(Handle) != 0)
{
print("[M_CONNECTION] >> Die Verbindung zur Datenbank ist Fehlgeschlagen! << [M_CONNECTION]");
}
else
{
printf("[M_CONNECTION] >> Die Verbindung zur Datenbank %s wurde Erfolgreich Hergestellt! << [M_CONNECTION]",M_DATA);
}
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
for(new i; SpielerDaten:i < SpielerDaten; i++)
{
SpielerInfo[playerid][SpielerDaten:i] = 0;
}
IstRegistriert[playerid] = 0;
GetPlayerName(playerid, Name[playerid], 24);
GetPlayerIp(playerid, IP[playerid], 16);
new Query[128];
mysql_format(Handle, Query, sizeof(Query), "SELECT `IP`, `Passwort`, `ID` FROM `Spieler` WHERE `Spielername` = '%e' LIMIT 1", Name[playerid]);
mysql_tquery(Handle, Query, "OnAccountCheck", "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(IstRegistriert[playerid] != 0)
{
SpielerSpeichern(playerid);
}
return 1;
}
forward OnAccountCheck(playerid);
forward OnAccountLoad(playerid);
forward OnAccountRegister(playerid);
#define D_REGISTER 1
#define D_LOGIN 2
public OnAccountCheck(playerid)
{
new Rows, Fields;
cache_get_data(Rows, Fields, Handle);
if(Rows)
{
new oldIP[16];
cache_get_field_content(0, "IP", oldIP, Handle, 16);
GetPlayerIp(playerid, oldIP, 16);
IstRegistriert[playerid] = 1;
if(strlen(IP[playerid]) != 0 && !strcmp(IP[playerid], oldIP, true))
{
OnAccountLoad(playerid);
}
else
{
(!strlen(IP[playerid]) || strcmp(IP[playerid], NewIP, true));
cache_get_field_content(0, "Passwort", SpielerInfo[playerid][Passwort], Handle, 129);
SpielerInfo[playerid][ID] = cache_get_field_content_int(0, "ID");
printf("%s", SpielerInfo[playerid][Passwort]);
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_INPUT, "Login", "Dein Account wurde gefunden. Bitte gib nun dein Passwort ein:","Einloggen","Abbrechen");
}
}
else
{
ShowPlayerDialog(playerid, D_REGISTER, DIALOG_STYLE_INPUT, "Registrieren","Dein Account wurde nicht gefunden! Bitte gib nun dein gewünschtes Passwort ein:","Registrieren","Abbrechen");
}
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch(dialogid)
{
case D_LOGIN:
{
if(!response) Kick(playerid);
new H_Pass[129];
new Query[100];
WP_Hash(H_Pass, 129, inputtext);
if(!strcmp(H_Pass, SpielerInfo[playerid][Passwort]))
{
mysql_format(Handle, Query, sizeof(Query), "SELECT * FROM `Spieler` WHERE `Spielername` = '%e' LIMIT 1", Name[playerid]);
mysql_tquery(Handle, Query, "OnAccountLoad", "i", playerid);
}
else
{
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_INPUT, "Login", "Dein Account wurde gefunden. Bitte gib nun dein Passwort ein\nFalsches Passwort!", "Einloggen", "Abbrechen");
}
}
case D_REGISTER:
{
if(!response) return Kick(playerid);
if(strlen(inputtext) < 6) return ShowPlayerDialog(playerid, D_REGISTER, DIALOG_STYLE_INPUT, "Register", "Dein Account wurde nicht gefunden! Bitte gib nun dein gewünschtes Passwort ein.\nDein Passwort muss länger als 6 Zeichen sein!", "Registrieren", "Abbrechen");
new Query[300];
WP_Hash(SpielerInfo[playerid][Passwort], 129, inputtext);
mysql_format(Handle, Query, sizeof(Query), "INSERT INTO `Spieler` (`Spielername`, `Passwort`, `IP`, `Admin`, `VIP`,`Morde`,`Tode`,`Level`, `Geld`) VALUES ('%e', '%s', '%s', 0, 0, 0, 0, 0, 50000)", Name[playerid], SpielerInfo[playerid][Passwort], IP[playerid]);
mysql_tquery(Handle, Query, "OnAccountRegister", "i", playerid);
}
}
return 1;
}
native WP_Hash(buffer[], len, const str[]);
public OnAccountLoad(playerid)
{
new Score;
SpielerInfo[playerid][Admin] = cache_get_field_content_int(0, "Admin");
SpielerInfo[playerid][VIP] = cache_get_field_content_int(0, "VIP");
SpielerInfo[playerid][Geld] = cache_get_field_content_int(0, "Geld");
SpielerInfo[playerid][Morde] = cache_get_field_content_int(0,"Morde");
SpielerInfo[playerid][Tode] = cache_get_field_content_int(0, "Tode");
Score = cache_get_field_content_int(0, "Level");
SetPlayerScore(playerid, Score);
GivePlayerMoney(playerid, SpielerInfo[playerid][Geld]);
SendClientMessage(playerid, -1, "Du hast dich Erfolgreich Eingeloggt!");
return 1;
}
public OnAccountRegister(playerid)
{
SpielerInfo[playerid][ID] = cache_insert_id();
printf("Neuer Account Registriert | ID: %d", SpielerInfo[playerid][ID]);
SpielerInfo[playerid][Geld] = 10000;
GivePlayerMoney(playerid, 10000);
IstRegistriert[playerid] = 1;
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}