Hallo Freunde,
Ich habe ein Problem mit MySQL, malwieder ich. Ich verstehe nicht warum mein public "OnQueryEnde" nicht ausgeführt wird.
Ich habe es geprintet und es wurde nicht in der Serverlog eingespeichert, was bedeutet das der besagte public nicht ausgeführt wurde,
ich frage mich warum nicht. Ich brauche dringend hilfe, ich komme nicht weiter, hilfe, was ist falsch ?
MySQL-Plugin-Version
R36
public OnGameModeInit()
{
//MySQL
db = mysql_connect(mysqlHost,mysqlUser,mysqlDB,mysqlPass);
}
Das war das allererste, er kann auch zur Datenbank verbinden. Verbindung ist immer erfolgreich.
public OnGameModeInit()
{
//MySQL
mysql_function_query(db,"SELECT * FROM samp_stuff",true,"OnQueryEnde","siii","SELECT * FROM samp_stuff",_SQL_STUFF_INSERT,0,db);
mysql_function_query(db,"SELECT * FROM samp_stuff",true,"OnQueryEnde","siii","SELECT * FROM samp_stuff",_SQL_STUFF_LOAD,0,db);
mysql_function_query(db,"SELECT * FROM samp_fautos",true,"OnQueryEnde","siii","SELECT * FROM samp_fautos",_SQL_FVEH_LOAD,0,db);
}
Die function_query steht allerdings erst nach dem connecten drinne, hat schon seine richtigkeit.
Hier jetzt die Funktion "OnQueryEnde"
public OnQueryEnde(index[],sqlresultid,extraid,SconnectionHandle)
{
new megaquery[4000],result[64],rows,fields;
if(SconnectionHandle!=db||mysql_errno()!=0)
{
getdate(tag,monat,jahr);
gettime(stunde,minute,sekunde);
ForEachPlayer(i)
{
if(IsPlayerConnected(i)&&!IsPlayerNPC(i)&&Spieler[i][pEingeloggt]==1)
{
SpielerSpeichern(i);
}
}
print("Das System muss den Server neustarten. Grund: Dead MySql Connection");
OnGameModeSave();
GameModeExit();
return 1;
}
cache_get_data(rows,fields);
switch(sqlresultid)
{
case _SQL_STUFF_INSERT:
{
cache_get_data(rows,fields);
if(!rows)
{
strcat(megaquery,"INSERT INTO `samp_stuff` (ADPreis,PlayerRekord,Lottojackpot,RentVehsPreis,TerrorSpawn,Lohnsteuer,Kirchensteuer,Mwst,Grundsteuer,OamtStandGebuer,Solidsteuer,PreisLicCar,PreisLicBike,PreisLicRoller,PreisLicPlane,PreisLicHeli,PreisLicBoat,TerrorContractRang,FMeldePreis,NewspaperPreis,NewspaperText1,NewspaperText2,");
strcat(megaquery,"NewspaperText3,NewspaperText4,NewspaperText5,NewspaperText6,NewspaperText7,NewspaperText8,NewsPaperRealeased,NewsPaperLager1,NewsPaperLager2,EisenLagger1,EisenLagger2,Kartfahrer1,KartTime1,FreemanPrice,wHackPrice,SAPDpay,FBIpay,SAFDpay,ARMYpay,OAMTpay,GOVpay,WorkLessMoney,BlitzerToleranz,Reichensteuer,JobSperreFree,AngelLicPrice,PersoLicPrice,WeapPrice,ParkPrice) ");
strcat(megaquery,"VALUES ('250','0','100000','50','0','2.2','1.4','19','2.6','150','1.2','1350','2000','500','10000','6750','4500','2','100','5','NO-ONE','NO-ONE','NO-ONE','NO-ONE','NO-ONE','NO-ONE','NO-ONE','NO-ONE','0','0','0','10000','5000','Niemand','0','100','100','500','500','500','500','500','500','400','5','2.0','500','75','50','5000','10')");
mysql_function_query(db,megaquery,false,"","");
print("- Stuff wurde erstellt -");
}
return 1;
}
case _SQL_STUFF_LOAD:
{
cache_get_data(rows,fields);
if(rows)
{
cache_get_field_content(0,"ADPreis",result);
fsteuern[ADPreis] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"PlayerRekord",result);
fsteuern[PlayerRekord] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"Lottojackpot",result);
fsteuern[Lottojackpot] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"RentVehsPreis",result);
fsteuern[RentVehsPreis] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"TerrorSpawn",result);
fsteuern[TerrorSpawn] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"Lohnsteuer",result);
fsteuern[Lohnsteuer] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"Kirchensteuer",result);
fsteuern[Kirchensteuer] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"Mwst",result);
fsteuern[Mwst] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"Grundsteuer",result);
fsteuern[Grundsteuer] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"OamtStandGebuer",result);
fsteuern[OamtStandGebuer] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"Solidsteuer",result);
fsteuern[Solidsteuer] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"Reichensteuer",result);
fsteuern[Reichensteuer] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"WLS",result);
UseBadWeather[0] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"WSF",result);
UseBadWeather[1] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"WLV",result);
UseBadWeather[2] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"PreisLicCar",result);
fsteuern[PreisLicCar] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"PreisLicBike",result);
fsteuern[PreisLicBike] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"PreisLicRoller",result);
fsteuern[PreisLicRoller] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"PreisLicPlane",result);
fsteuern[PreisLicPlane] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"PreisLicHeli",result);
fsteuern[PreisLicHeli] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"PreisLicBoat",result);
fsteuern[PreisLicBoat] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"TerrorContractRang",result);
fsteuern[TerrorContractRang] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"FMeldePreis",result);
fsteuern[FMeldePreis] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperPreis",result);
fsteuern[NewspaperPreis] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperText1",result);
strmid(fsteuern[NewspaperText1],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperText2",result);
strmid(fsteuern[NewspaperText2],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperText3",result);
strmid(fsteuern[NewspaperText3],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperText4",result);
strmid(fsteuern[NewspaperText4],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperText5",result);
strmid(fsteuern[NewspaperText5],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperText6",result);
strmid(fsteuern[NewspaperText6],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperText7",result);
strmid(fsteuern[NewspaperText7],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewspaperText8",result);
strmid(fsteuern[NewspaperText8],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewsPaperRealeased",result);
fsteuern[NewsPaperRealeased] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewsPaperLager1",result);
fsteuern[NewsPaperLager][0] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NewsPaperLager2",result);
fsteuern[NewsPaperLager][1] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"EisenLagger1",result);
fsteuern[EisenLagger1] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"EisenLagger2",result);
fsteuern[EisenLagger2] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"Kartfahrer1",result);
strmid(fsteuern[Kartfahrer1],result,0,strlen(result),sizeof(result));
strdel(result,0,sizeof(result));
cache_get_field_content(0,"KartTime1",result);
fsteuern[KartTime1] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"FreemanPrice",result);
fsteuern[FreemanPrice] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"wHackPrice",result);
fsteuern[wHackPrice] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"SAPDpay",result);
fsteuern[Fgehalt][1] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"FBIpay",result);
fsteuern[Fgehalt][2] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"SAFDpay",result);
fsteuern[Fgehalt][3] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"ARMYpay",result);
fsteuern[Fgehalt][6] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"OAMTpay",result);
fsteuern[Fgehalt][11] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"GOVpay",result);
fsteuern[Fgehalt][16] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"WorkLessMoney",result);
fsteuern[WorkLessMoney] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"BlitzerToleranz",result);
fsteuern[BlitzerToleranz] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"JobSperreFree",result);
fsteuern[JobSperreFree] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"AngelLicPrice",result);
fsteuern[AngelLicPrice] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"PersoLicPrice",result);
fsteuern[PersoLicPrice] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"WeapPrice",result);
fsteuern[WeapPrice] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"ParkPrice",result);
fsteuern[ParkPrice] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"NextFreeHousekey",result);
fsteuern[NextFreeHousekey] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"HolzLagger1",result);
fsteuern[HolzLagger1] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(0,"HolzLagger2",result);
fsteuern[HolzLagger2] = strval(result);
strdel(result,0,sizeof(result));
print("- Stuff wurde geladen -");
}
}
case _SQL_FVEH_LOAD:
{
cache_get_data(rows,fields);
new fv = 0;
if(rows)
{
while(fv<=rows)
{
cache_get_field_content(fv,"id",result);
Fahrzeug[fv][Carkey] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Fraktion",result);
Fahrzeug[fv][Fraktion] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"modelid",result);
Fahrzeug[fv][modelid] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Farbe1",result);
Fahrzeug[fv][Colour1] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Farbe2",result);
Fahrzeug[fv][Colour2] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Paintjob",result);
Fahrzeug[fv][Paintjob] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"HP",result);
Fahrzeug[fv][HP] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"posx",result);
Fahrzeug[fv][posx] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"posy",result);
Fahrzeug[fv][posy] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"posz",result);
Fahrzeug[fv][posz] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"posa",result);
Fahrzeug[fv][posa] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Abgeschlossen",result);
Fahrzeug[fv][Abgeschlossen] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Interior",result);
Fahrzeug[fv][Interior] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"VirtualWorld",result);
Fahrzeug[fv][VirtualWorld] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Nummernschild",result);
strmid(Fahrzeug[fv][Nummernschild],result,0,strlen(result),64);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Spoiler",result);
Fahrzeug[fv][Spoiler] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Wheels",result);
Fahrzeug[fv][Wheels] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Nitro",result);
Fahrzeug[fv][Nitro] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Roof",result);
Fahrzeug[fv][Roof] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Hood",result);
Fahrzeug[fv][Hood] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Sideskirt",result);
Fahrzeug[fv][Sideskirt] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Lamps",result);
Fahrzeug[fv][Lamps] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Exhaust",result);
Fahrzeug[fv][Exhaust] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Stereo",result);
Fahrzeug[fv][Stereo] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Hydraulics",result);
Fahrzeug[fv][Hydraulics] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"VentRight",result);
Fahrzeug[fv][VentRight] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"VentLeft",result);
Fahrzeug[fv][VentLeft] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"FrontBumper",result);
Fahrzeug[fv][FrontBumper] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"RearBumper",result);
Fahrzeug[fv][RearBumper] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KaufPreis",result);
Fahrzeug[fv][Preis] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"FraktionsRang",result);
Fahrzeug[fv][FraktionsRang] = strval(result);
strdel(result,0,sizeof(result));
Fahrzeug[fv][Vehicle] = CreateVehicleEx(Fahrzeug[fv][modelid],Fahrzeug[fv][posx],Fahrzeug[fv][posy],Fahrzeug[fv][posz],Fahrzeug[fv][posa],Fahrzeug[fv][Colour1],Fahrzeug[fv][Colour2],-1);
SetVehicleNumberPlate(Fahrzeug[fv][Vehicle],Fahrzeug[fv][Nummernschild]);
cache_get_field_content(fv,"Abgeschleppt",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][Abgeschleppt] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"AbgeschlepptPreis",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][AbgeschlepptPreis] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"AbgeschlepptGrund",result);
strmid(vFahrzeug[Fahrzeug[fv][Vehicle]][AbgeschlepptGrund],result,0,strlen(result),128);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Neon",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][Neon] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Motorschaden",result);
MotorDown[Fahrzeug[fv][Vehicle]] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"FailGas",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][FailGas] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Tank",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][Tank] = floatstr(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Kilometerstand",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][Kilometer] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumGanja",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumGanja] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumKokain",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumKokain] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumMaterials",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumMaterials] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumOpium",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumOpium] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumSpice",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumSpice] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumLunchpakete",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumLunchpakete] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumC4",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumC4] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumWerkzeugkasten",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumWerkzeugkasten] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"KofferraumBenzinkanister",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][KofferraumBenzinkanister] = strval(result);
strdel(result,0,sizeof(result));
cache_get_field_content(fv,"Handbremse",result);
vFahrzeug[Fahrzeug[fv][Vehicle]][Handbremse] = strval(result);
strdel(result,0,sizeof(result));
FVehicleTuning(fv);
fv++;
}
}
printf("- Fraktionsfahrzeuge geladen %i/%i -",rows,MAX_FCARS);
return 1;
}
}
return 1;
}
Wenn ihr nicht wisst, dann wisst ihr es ebend nicht. Dumme Kommentare werden gemeldet, Screens kann ich bei Bedarf anhängen.
LG, ich hoffe ihr könnt mir ein bisschen helfen, gerne gebe ich noch weitere Info's, wenn diese nicht ausreichend waren.