/*hallo liebe brotfische,
ich habe vor ein paar tagen angefangen mein registersystem in mysql zu machen aber die daten des users werden in der datenbank nicht gespeichert oO.
hier die zeilen
PS ich machs in quelltext da es evtl. sein kann das alles in einer zeile ist...*/
public AccPlayerUpdater() //dann wird es regelmäßig gespeichert und es speichert automatisch wenn spieler disconnectet...
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
UpdateAccount(i);
}
}
stock mysqlget(table[],bedien[],abfrag[],data[])
{
new query[128];
format(query,sizeof(query),"SELECT %s FROM %s WHERE %s",abfrag,table,bedien);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
mysql_fetch_field(abfrag, data);
mysql_free_result();
return true;
}
else
{
mysql_free_result();
return false;
}
}
stock LoadUserData(playerid,playername[])
{
new query[256],data[255],move[256];
format(move,sizeof move,"Nickname='%s'",playername);
format(query,sizeof query,"SELECT * FROM Accounts WHERE %s",move);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
mysql_fetch_field("Adminlevel",data);
Acc[playerid][Adminlv] = strval(data);
mysql_free_result();
mysql_fetch_field("Alter",data);
Acc[playerid][Alter] = strval(data);
mysql_free_result();
mysql_fetch_field("Herkunft",data);
Acc[playerid][Herkunft] = strval(data);
mysql_free_result();
mysql_fetch_field("Geschlecht",data);
Acc[playerid][Geschlecht] = strval(data);
mysql_free_result();
mysql_fetch_field("Chef",data);
Acc[playerid][Chef] = strval(data);
mysql_free_result();
mysql_fetch_field("Co_Chef",data);
Acc[playerid][Co_Chef] = strval(data);
mysql_free_result();
mysql_fetch_field("Member",data);
Acc[playerid][Member] = strval(data);
mysql_free_result();
mysql_fetch_field("Rank",data);
Acc[playerid][Rank] = strval(data);
mysql_free_result();
mysql_fetch_field("Tutorial",data);
Acc[playerid][Tut] = strval(data);
mysql_free_result();
mysql_fetch_field("WereTimeout",data);
Acc[playerid][WereTimeout] = strval(data);
mysql_free_result();
mysql_fetch_field("Bank",data);
Acc[playerid][Bank] = strval(data);
mysql_free_result();
mysql_fetch_field("Adminwarns",data);
Acc[playerid][Adminwarns] = strval(data);
mysql_free_result();
mysql_fetch_field("Skin",data);
Acc[playerid][Skin] = strval(data);
mysql_free_result();
mysql_fetch_field("Kontonr",data);
Acc[playerid][Kontonr] = strval(data);
mysql_free_result();
mysql_fetch_field("Kontoauszug",data);
Acc[playerid][LastBankCheck] = strval(data);
mysql_free_result();
mysql_fetch_field("Wanteds",data);
Acc[playerid][Wanteds] = strval(data);
mysql_free_result();
mysql_fetch_field("Autoschein",data);
Acc[playerid][CarLiz] = strval(data);
mysql_free_result();
mysql_fetch_field("Motorradschein",data);
Acc[playerid][MoLiz] = strval(data);
mysql_free_result();
mysql_fetch_field("Bootschein",data);
Acc[playerid][BootLiz] = strval(data);
mysql_free_result();
mysql_fetch_field("Flugschein",data);
Acc[playerid][FlyLiz] = strval(data);
mysql_free_result();
mysql_fetch_field("Lkwschein",data);
Acc[playerid][LkwLiz] = strval(data);
mysql_free_result();
mysql_fetch_field("Angelschein",data);
Acc[playerid][AngelLiz] = strval(data);
mysql_free_result();
mysql_fetch_field("Waffenschein",data);
Acc[playerid][WaffenLiz] = strval(data);
mysql_free_result();
mysql_fetch_field("Busschein",data);
Acc[playerid][BusLiz] = strval(data);
mysql_free_result();
mysql_fetch_field("Gebannt",data);
Acc[playerid][Gebannt] = strval(data);
mysql_free_result();
mysql_fetch_field("Userid",data);
Acc[playerid][Userid] = strval(data);
mysql_free_result();
mysql_fetch_field("TimeoutPosX",data);
TimeoutPosX[playerid] = floatstr(data);
mysql_free_result();
mysql_fetch_field("TimeoutPosY",data);
TimeoutPosY[playerid] = floatstr(data);
mysql_free_result();
mysql_fetch_field("TimeoutPosZ",data);
TimeoutPosZ[playerid] = floatstr(data);
mysql_free_result();
}
else
{
SendClientMessage(playerid,rot,"Es ist ein Problem mit ihrem Account aufgetaucht. Bitte reloggen sie!");
Kick(playerid);
}
}
stock mysqlupdate(table[],bedien[],spalte[],data[])
{
new query[128];
format(query,sizeof query,"UPDATE %s SET %s='%s' WHERE %s",table,spalte,data,bedien);
mysql_query(query);
mysql_free_result();
}
stock UpdateAccount(playerid)
{
new bedien[128],updatestring[128];
GetPlayerNameEx(playerid,name);
format(bedien,sizeof bedien,"Nickname='%s'",name);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Adminlv]);
mysqlupdate("Accounts",bedien,"Adminlevel",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Alter]);
mysqlupdate("Accounts",bedien,"Alter",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Herkunft]);
mysqlupdate("Accounts",bedien,"Herkunft",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Geschlecht]);
mysqlupdate("Accounts",bedien,"Geschlecht",updatestring);
format(updatestring,sizeof updatestring,"%i",GetPlayerMoney(playerid));
mysqlupdate("Accounts",bedien,"Geld",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Chef]);
mysqlupdate("Accounts",bedien,"Chef",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Co_Chef]);
mysqlupdate("Accounts",bedien,"Co_Chef",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Member]);
mysqlupdate("Accounts",bedien,"Member",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Rank]);
mysqlupdate("Accounts",bedien,"Rank",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Tut]);
mysqlupdate("Accounts",bedien,"Tutorial",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][WereTimeout]);
mysqlupdate("Accounts",bedien,"WereTimeout",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Bank]);
mysqlupdate("Accounts",bedien,"Bank",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Adminwarns]);
mysqlupdate("Accounts",bedien,"Adminwarns",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Skin]);
mysqlupdate("Accounts",bedien,"Skin",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Kontonr]);
mysqlupdate("Accounts",bedien,"Kontonr",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][LastBankCheck]);
mysqlupdate("Accounts",bedien,"Kontoauszug",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Wanteds]);
mysqlupdate("Accounts",bedien,"Wanteds",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][CarLiz]);
mysqlupdate("Accounts",bedien,"Autoschein",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][MoLiz]);
mysqlupdate("Accounts",bedien,"Motorradschein",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][BootLiz]);
mysqlupdate("Accounts",bedien,"Bootschein",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][FlyLiz]);
mysqlupdate("Accounts",bedien,"Flugschein",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][LkwLiz]);
mysqlupdate("Accounts",bedien,"Lkwschein",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][AngelLiz]);
mysqlupdate("Accounts",bedien,"Angelschein",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][WaffenLiz]);
mysqlupdate("Accounts",bedien,"Waffenschein",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][BusLiz]);
mysqlupdate("Accounts",bedien,"Busschein",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Gebannt]);
mysqlupdate("Accounts",bedien,"Gebannt",updatestring);
format(updatestring,sizeof updatestring,"%i",Acc[playerid][Userid]);
mysqlupdate("Accounts",bedien,"Userid",updatestring);
format(updatestring,sizeof updatestring,"%f",TimeoutPosX[playerid]);
mysqlupdate("Accounts",bedien,"TimeoutPosX",updatestring);
format(updatestring,sizeof updatestring,"%f",TimeoutPosY[playerid]);
mysqlupdate("Accounts",bedien,"TimeoutPosY",updatestring);
format(updatestring,sizeof updatestring,"%f",TimeoutPosZ[playerid]);
mysqlupdate("Accounts",bedien,"TimeoutPosZ",updatestring);
}
/*Danke schonmal für eure Hilfe
MfG [aKoE]nanyo */
//edit 1
Versuch 1 pwn zeilen einzufügen