Hey bin grade am MySQL speichern aber weiss nicht wie ich das anstellen soll...
momentan:
OnGameModeInit
for(new v = 0; v < MAX_FRACTION_CARS; v++)
{
new frakn[20];
for(new i = 0; i < MAX_PLAYERS; i ++)
{
switch(PlayerInfo[i][pLeader])
{
case 0: { frakn = "Keine"; }
case 1: { frakn = "LSPD"; }
case 2: { frakn = "Feuerwehr"; }
case 3: { frakn = "Medic"; }
case 4: { frakn = "Ordnungsamt"; }
case 5: { frakn = "Spedition"; }
case 6: { frakn = "Termis Bratwa"; }
case 7: { frakn = "Wcc"; }
case 8: { frakn = "Devils"; }
case 9: { frakn = "Grove"; }
}
}
LoadFracCar(v,frakn);
}
OnGameModeExit
new frakn[20];
for(new i = 0; i < MAX_PLAYERS; i ++)
{
switch(PlayerInfo[i][pLeader])
{
case 0: { frakn = "Keine"; }
case 1: { frakn = "LSPD"; }
case 2: { frakn = "Feuerwehr"; }
case 3: { frakn = "Medic"; }
case 4: { frakn = "Ordnungsamt"; }
case 5: { frakn = "Spedition"; }
case 6: { frakn = "Termis Bratwa"; }
case 7: { frakn = "Wcc"; }
case 8: { frakn = "Devils"; }
case 9: { frakn = "Grove"; }
}
}
SaveFracCar(frakn);
Das Speichern
stock CreateFracCar(frak[],model,Float:X,Float:Y,Float:Z,Float:A,farbe1,farbe2)
{
printf("Fraktion %s hat sich ein Car gekauft",frak);
new query[256];
format(query, sizeof(query), "INSERT INTO `frakcar` (`Fraktion`, `Kennzeichen`, `Model`, `PosX`, `PosY`, `PosZ`, `PosA`, `Farbe 1`, `Farbe 2`) VALUES ('%s', '%s', '%d', '%f', '%f', '%f', '%f', '%d', '%d')", frak, frak, model, X,Y,Z,A,farbe1,farbe2);
mysql_query(query);
return true;
}
stock SaveFracCar(frak[])
{
new color1, color2;
new Float:X,Float:Y,Float:Z,Float:A;
for(new i = 0; i < MAX_FRACTION_CARS; i++)
{
GetVehiclePos(i,X,Y,Z);
GetVehicleZAngle(i, A);
GetVehicleColor(i, color1, color2);
new model = GetVehicleModel(i);
mysql_SetString("frakcar", "Kennzeichen", GetVehicleNumberPlate(i), "Fraktion", frak);
mysql_SetInt("frakcar", "Model", model, "Fraktion", frak);
mysql_SetFloat("frakcar", "PosX", X, "Fraktion", frak);
mysql_SetFloat("frakcar", "PosY", Y, "Fraktion", frak);
mysql_SetFloat("frakcar", "PosZ", Z, "Fraktion", frak);
mysql_SetFloat("frakcar", "PosA", A, "Fraktion", frak);
mysql_SetInt("frakcar", "Farbe 1", color1, "Fraktion", frak);
mysql_SetInt("frakcar", "Farbe 2", color2, "Fraktion", frak);
}
return 1;
}
stock LoadFracCar(veh,frak[])
{
mysql_SetString("frakcar", "Kennzeichen", FCInfo[veh][Kennzeichen], "Fraktion", frak);
mysql_SetInt("frakcar", "Model", FCInfo[veh][Model], "Fraktion", frak);
mysql_SetFloat("frakcar", "PosX", FCInfo[veh][fcX], "Fraktion", frak);
mysql_SetFloat("frakcar", "PosY", FCInfo[veh][fcY], "Fraktion", frak);
mysql_SetFloat("frakcar", "PosZ", FCInfo[veh][fcZ], "Fraktion", frak);
mysql_SetFloat("frakcar", "PosA", FCInfo[veh][fcA], "Fraktion", frak);
mysql_SetInt("frakcar", "Farbe 1", FCInfo[veh][Color1], "Fraktion", frak);
mysql_SetInt("frakcar", "Farbe 2", FCInfo[veh][Color2], "Fraktion", frak);
if(!strcmp(frak, "LSPD", false))
{
LSPD[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(LSPD[veh],FCInfo[veh][Kennzeichen]);
}
if(!strcmp(frak, "Feuerwehr", false))
{
fwcar[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(fwcar[veh],FCInfo[veh][Kennzeichen]);
}
if(!strcmp(frak, "Medic", false))
{
MedCar[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(MedCar[veh],FCInfo[veh][Kennzeichen]);
}
if(!strcmp(frak, "Ordnungsamt", false))
{
oAmt[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(oAmt[veh],FCInfo[veh][Kennzeichen]);
}
if(!strcmp(frak, "Trucker", false))
{
SpedCars[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(SpedCars[veh],FCInfo[veh][Kennzeichen]);
}
if(!strcmp(frak, "Termis Bratwa", false))
{
TbCar[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(TbCar[veh],FCInfo[veh][Kennzeichen]);
}
if(!strcmp(frak, "Wcc", false))
{
WccCar[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(WccCar[veh],FCInfo[veh][Kennzeichen]);
}
if(!strcmp(frak, "Devils", false))
{
DilliCar[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(DilliCar[veh],FCInfo[veh][Kennzeichen]);
}
if(!strcmp(frak, "Grove", false))
{
GsCar[veh] = AddStaticVehicleEx(FCInfo[veh][Model], FCInfo[veh][fcX], FCInfo[veh][fcY], FCInfo[veh][fcZ], FCInfo[veh][fcA], FCInfo[veh][Color1], FCInfo[veh][Color2], -1);
SetVehicleNumberPlate(GsCar[veh],FCInfo[veh][Kennzeichen]);
}
return 1;
}
Ich weiss, es sieht sehr kompliziert aus, ich habe nur improvisiert