Abend :),
Ich habe folgendes Problem die Speicherung funktioniert nicht, und hab jetzt momentan Errors. Die Frage ist wie man den public gestalten kann.
Derzeitiger Error ist mysql_format weil der Code nicht vorhanden ist.
Dieser Public wird beim Kauf aufgerufen um die jeweiligen Werte in Spalten zu schreiben und vorallem eine Spalte zu erstellen.
C
forward createcarupdate(playerid,chid);
public createcarupdate(playerid,chid)
{
new var[2000],formi[50],formi2[200],formi3[200],formi4[200],formi5[200];
mysql_format(MySQL_Connection,formi2,200,"`AH_SpawnSaveX`, `AH_SpawnSaveY`, `AH_SpawnSaveZ`, `AH_SpawnSaveRot`, `AH_TankVolumen`, `AH_RepairTime`, `AH_Versicherung`, `AH_StandTime`, `AH_Meter`");
mysql_format(MySQL_Connection,formi3,200,"`AH_mod5`, AH_mod6`, AH_mod7`, `AH_mod8`, `AH_mod9`, `AH_mod10`, `AH_mod11`, `AH_mod12`, `AH_mod13`, `AH_mod14`, `AH_mod15`, `AH_mod16`, `AH_mod17`");
mysql_format(MySQL_Connection,formi4,200,"'%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d'",
Carlist[playerid][chid][mod5],Carlist[playerid][chid][mod6],Carlist[playerid][chid][mod7],Carlist[playerid][chid][mod8],Carlist[playerid][chid][mod9],Carlist[playerid][chid][mod10],Carlist[playerid][chid][mod11],Carlist[playerid][chid][mod12],Carlist[playerid][chid][mod13],
Carlist[playerid][chid][mod14],Carlist[playerid][chid][mod15],Carlist[playerid][chid][mod16],Carlist[playerid][chid][mod17]);
mysql_format(MySQL_Connection,formi5,200,"'%.1f', '%.1f', '%.1f', '%.1f', '%d', '%d', '%d', '%d', '%d'",
Carlist[playerid][chid][SpawnSaveX],Carlist[playerid][chid][SpawnSaveY],Carlist[playerid][chid][SpawnSaveZ],Carlist[playerid][chid][SpawnSaveRot],
Carlist[playerid][chid][TankVolumen],Carlist[playerid][chid][RepairTime],Carlist[playerid][chid][Versicherung],Carlist[playerid][chid][StandTime],Carlist[playerid][chid][Meter]);
mysql_format(MySQL_Connection,formi,50,"%dAutoNR%d",PlayerInfo[playerid][pSQLID],chid);
format(var, sizeof(var),
"INSERT INTO `usercars` (`Name`, `AH_Typ`, `AH_X`, `AH_Y`, `AH_Z`, `AH_Rot`, `AH_Status`, `AH_Lock`, `AH_Paintjob`, `AH_Farbe1`, `AH_Farbe2`, `AH_mod1`, `AH_mod2`, `AH_mod3`, `AH_mod4`, %s, %s) VALUES ('%s', '%d', '%.1f', '%.1f', '%.1f', '%.1f', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', %s, %s)",
formi3,formi2,formi,formi4,formi5,Carlist[playerid][chid][Typ],Carlist[playerid][chid][pos_x],Carlist[playerid][chid][pos_y],Carlist[playerid][chid][pos_z],Carlist[playerid][chid][z_angle],Carlist[playerid][chid][Status],Carlist[playerid][chid][Lock],Carlist[playerid][chid][Paintjob],
Carlist[playerid][chid][Farbe1],Carlist[playerid][chid][Farbe2],Carlist[playerid][chid][mod1],Carlist[playerid][chid][mod2],Carlist[playerid][chid][mod3],Carlist[playerid][chid][mod4]);
self_mysql_queryEx(var);
}
Alles anzeigen
Hier werden die Spalten editiert/updatet.
C
public PlayerCarUpdate(playerid)
{
if(IsPlayerNPC(playerid))
{
return 1;
}
new string[256],
playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
for(new h = 0; h < MaxVeh[playerid]; h++)
{
if(SaveServerMySQL==0)
{
format(string, sizeof(string), "cars/%dAutoNR%d.ini", PlayerInfo[playerid][pSQLID], h);
new File: CarFile = fopen(string, io_write);
if (CarFile)
{
new var[256];
format(var, 256, "AH_Typ=%d\n", Carlist[playerid][h][Typ]); fwrite(CarFile, var);
format(var, 256, "AH_X=%.1f\n", Carlist[playerid][h][pos_x]); fwrite(CarFile, var);
format(var, 256, "AH_Y=%.1f\n", Carlist[playerid][h][pos_y]); fwrite(CarFile, var);
format(var, 256, "AH_Z=%.1f\n", Carlist[playerid][h][pos_z]); fwrite(CarFile, var);
format(var, 256, "AH_Rot=%.1f\n", Carlist[playerid][h][z_angle]); fwrite(CarFile, var);
format(var, 256, "AH_Status=%d\n", Carlist[playerid][h][Status]); fwrite(CarFile, var);
format(var, 256, "AH_Lock=%d\n", Carlist[playerid][h][Lock]); fwrite(CarFile, var);
format(var, 256, "AH_Paintjob=%d\n", Carlist[playerid][h][Paintjob]); fwrite(CarFile, var);
format(var, 256, "AH_Farbe1=%d\n", Carlist[playerid][h][Farbe1]); fwrite(CarFile, var);
format(var, 256, "AH_Farbe2=%d\n", Carlist[playerid][h][Farbe2]); fwrite(CarFile, var);
format(var, 256, "AH_mod1=%d\n", Carlist[playerid][h][mod1]); fwrite(CarFile, var);
format(var, 256, "AH_mod2=%d\n", Carlist[playerid][h][mod2]); fwrite(CarFile, var);
format(var, 256, "AH_mod3=%d\n", Carlist[playerid][h][mod3]); fwrite(CarFile, var);
format(var, 256, "AH_mod4=%d\n", Carlist[playerid][h][mod4]); fwrite(CarFile, var);
format(var, 256, "AH_mod5=%d\n", Carlist[playerid][h][mod5]); fwrite(CarFile, var);
format(var, 256, "AH_mod6=%d\n", Carlist[playerid][h][mod6]); fwrite(CarFile, var);
format(var, 256, "AH_mod7=%d\n", Carlist[playerid][h][mod7]); fwrite(CarFile, var);
format(var, 256, "AH_mod8=%d\n", Carlist[playerid][h][mod8]); fwrite(CarFile, var);
format(var, 256, "AH_mod9=%d\n", Carlist[playerid][h][mod9]); fwrite(CarFile, var);
format(var, 256, "AH_mod10=%d\n", Carlist[playerid][h][mod10]); fwrite(CarFile, var);
format(var, 256, "AH_mod11=%d\n", Carlist[playerid][h][mod11]); fwrite(CarFile, var);
format(var, 256, "AH_mod12=%d\n", Carlist[playerid][h][mod12]); fwrite(CarFile, var);
format(var, 256, "AH_mod13=%d\n", Carlist[playerid][h][mod13]); fwrite(CarFile, var);
format(var, 256, "AH_mod14=%d\n", Carlist[playerid][h][mod14]); fwrite(CarFile, var);
format(var, 256, "AH_mod15=%d\n", Carlist[playerid][h][mod15]); fwrite(CarFile, var);
format(var, 256, "AH_mod16=%d\n", Carlist[playerid][h][mod16]); fwrite(CarFile, var);
format(var, 256, "AH_mod17=%d\n", Carlist[playerid][h][mod17]); fwrite(CarFile, var);
format(var, 256, "AH_SpawnSaveX=%.1f\n", Carlist[playerid][h][SpawnSaveX]); fwrite(CarFile, var);
format(var, 256, "AH_SpawnSaveY=%.1f\n", Carlist[playerid][h][SpawnSaveY]); fwrite(CarFile, var);
format(var, 256, "AH_SpawnSaveZ=%.1f\n", Carlist[playerid][h][SpawnSaveZ]); fwrite(CarFile, var);
format(var, 256, "AH_SpawnSaveRot=%.1f\n", Carlist[playerid][h][SpawnSaveRot]); fwrite(CarFile, var);
format(var, 256, "AH_TankVolumen=%d\n", Carlist[playerid][h][TankVolumen]); fwrite(CarFile, var);
format(var, 256, "AH_RepairTime=%d\n", Carlist[playerid][h][RepairTime]); fwrite(CarFile, var);
format(var, 256, "AH_Versicherung=%d\n", Carlist[playerid][h][Versicherung]); fwrite(CarFile, var);
format(var, 256, "AH_StandTime=%d\n", Carlist[playerid][h][StandTime]); fwrite(CarFile, var);
format(var, 256, "AH_Meter=%d\n", Carlist[playerid][h][Meter]); fwrite(CarFile, var);
fclose(CarFile);
}
}
else
{
if(Carlist[playerid][h][Typ]>=1)
{
new var[1000];
format(var, sizeof(var),
"UPDATE `usercars` SET `AH_Typ`='%d', `AH_X`='%.1f', `AH_Y`='%.1f', `AH_Z`='%.1f', `AH_Rot`='%.1f', `AH_Status`='%d', `AH_Lock`='%d', `AH_Paintjob`='%d', `AH_Farbe1`='%d', `AH_Farbe2`='%d', `AH_mod1`='%d', `AH_mod2`='%d', `AH_mod3`='%d', `AH_mod4`='%d' WHERE `Name`='%dAutoNR%d'",
Carlist[playerid][h][Typ],Carlist[playerid][h][pos_x],Carlist[playerid][h][pos_y],Carlist[playerid][h][pos_z],Carlist[playerid][h][z_angle],Carlist[playerid][h][Status],Carlist[playerid][h][Lock],Carlist[playerid][h][Paintjob],
Carlist[playerid][h][Farbe1],Carlist[playerid][h][Farbe2],Carlist[playerid][h][mod1],Carlist[playerid][h][mod2],Carlist[playerid][h][mod3],Carlist[playerid][h][mod4],PlayerInfo[playerid][pSQLID],h);
self_mysql_queryEx(var);
format(var, sizeof(var),
"UPDATE `usercars` SET `AH_mod5`='%d', AH_mod6`='%d', AH_mod7`='%d', `AH_mod8`='%d', `AH_mod9`='%d', `AH_mod10`='%d', `AH_mod11`='%d', `AH_mod12`='%d', `AH_mod13`='%d', `AH_mod14`='%d', `AH_mod15`='%d', `AH_mod16`='%d', `AH_mod17`='%d' WHERE `Name`='%dAutoNR%d'",
Carlist[playerid][h][mod5],Carlist[playerid][h][mod6], Carlist[playerid][h][mod7],Carlist[playerid][h][mod8],Carlist[playerid][h][mod9],Carlist[playerid][h][mod10],Carlist[playerid][h][mod11],Carlist[playerid][h][mod12],Carlist[playerid][h][mod13],
Carlist[playerid][h][mod14],Carlist[playerid][h][mod15],Carlist[playerid][h][mod16],Carlist[playerid][h][mod17],PlayerInfo[playerid][pSQLID],h);
self_mysql_queryEx(var);
format(var, sizeof(var),
"UPDATE `usercars` SET `AH_SpawnSaveX`='%.1f', `AH_SpawnSaveY`='%.1f', `AH_SpawnSaveZ`='%.1f', `AH_SpawnSaveRot`='%.1f', `AH_TankVolumen`='%d', `AH_RepairTime`='%d', `AH_Versicherung`='%d', `AH_StandTime`='%d', `AH_Meter`='%d' WHERE `Name`='%dAutoNR%d'",
Carlist[playerid][h][SpawnSaveX],Carlist[playerid][h][SpawnSaveY],Carlist[playerid][h][SpawnSaveZ],Carlist[playerid][h][SpawnSaveRot],
Carlist[playerid][h][TankVolumen],Carlist[playerid][h][RepairTime],Carlist[playerid][h][Versicherung],Carlist[playerid][h][StandTime],Carlist[playerid][h][Meter],PlayerInfo[playerid][pSQLID], h);
self_mysql_queryEx(var);
}
}
}
return 1;
}
Alles anzeigen
@Jeffry
Freue mich auf eure Hilfe