Hallo liebe Community ich habe Folgendes Problem,
ich habe einen Befehl gemacht (/accar) der InGame Autos Erstellt und Sofort Saved und beim Start des Servers auch alle Automatisch laden tut (über dini) dazu habe ich noch nen Tank System gemacht der auch Super funktioniert aber beim laden der Autos nur ein Auto den geladenen Tank beckommt und aller ander nicht (sprich ein auto Tank=100 alle anderen Tank=0) und weis einfach nicht wo der Fehler liegt
ocmd:accar(playerid,params[])
{
new vID,fID, staat, Float:x, Float:z, Float:y, Float:r, Color1, Color2;
GetPlayerPos(playerid,x,y,z);
GetPlayerFacingAngle(playerid,r);
if(sscanf(params,"iiiii",vID,Color1,Color2,fID,staat))return SendClientMessage(playerid,rot,"/accar [Vehicle ID][Farbe 1][Farbe 2][Fraktions ID (Wenn Staatfahrzeug 0)][Staat (Wenn ein Staats Fahrzeug 1)]");
if(vID<400||vID>611)return SendClientMessage(playerid,rot,"Die Vehicle ID muss zwischen 400 und 611 liegen!");
if(fID==0)
{
if(staat==0)
{
SendClientMessage(playerid, rot,"Du musst endweder das Auto als Staats oder als Fraktions Fahrzeug Melden!");
return 1;
}
}
new i = getFreeCarID()+1;
new string[164];
format(string,sizeof string,"/autos/car %i.txt",i);
dini_Create(string);
dini_FloatSet(string,"x",x);
dini_FloatSet(string,"y",y);
dini_FloatSet(string,"z",z);
dini_FloatSet(string,"r",r);
dini_IntSet(string,"VehicleID",vID);
dini_IntSet(string,"Color_1",Color1);
dini_IntSet(string,"Color_2",Color2);
dini_IntSet(string,"Fraktion",fID);
dini_IntSet(string,"Staat",staat);
new mycar;
mycar=CreateVehicle(vID,x,y,z,r,Color1,Color2,0);
PutPlayerInVehicle(playerid,mycar,0);
new tID = getFreeTankID();
VEHICLE_TANK[tID][td_tank]= 100.0;
VEHICLE_TANK[tID][td_vehicle_id]= mycar;
VEHICLE_TANK[tID][td_status]=1;
return 1;
}
LoadCars()
{
for( new i=1; i<sizeof vInfo; i++)
{
if(vInfo[i][v_id_x]!=0)continue;
new string[164];
format(string,sizeof string,"/autos/car %i.txt",i);
if(!dini_Exists(string))continue;
new vID = getFreeCarID();
SetVehicleParamsEx(i,0,0,0,0,0,0,0);
vInfo[vID][v_db_id]= i;
vInfo[vID][v_vehicleid]= dini_Int(string,"VehicleID");
vInfo[vID][v_x]= dini_Float(string,"x");
vInfo[vID][v_y]= dini_Float(string,"y");
vInfo[vID][v_z]= dini_Float(string,"z");
vInfo[vID][v_r]= dini_Float(string,"r");
vInfo[vID][v_paintjob]=dini_Int(string,"v_paintjob");
vInfo[vID][v_color_1]= dini_Int(string,"Color_1");
vInfo[vID][v_color_2]= dini_Int(string,"Color_2");
vInfo[vID][v_fraktion]= dini_Int(string,"Fraktion");
new tID = getFreeTankID();
VEHICLE_TANK[tID][td_tank]= dini_Float(string,"Tank");
vInfo[vID][v_id_x]=CreateVehicle(vInfo[vID][v_vehicleid],vInfo[vID][v_x],vInfo[vID][v_y],vInfo[vID][v_z],vInfo[vID][v_r],vInfo[vID][v_color_1],vInfo[vID][v_color_2],0);
ChangeVehiclePaintjob(vInfo[vID][v_id_x],vInfo[vID][v_paintjob]);
VEHICLE_TANK[tID][td_vehicle_id]= vInfo[vID][v_id_x];
VEHICLE_TANK[tID][td_status]=1;
SetVehicleParamsEx(vInfo[vID][v_id_x],0,0,0,0,0,0,0);
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_spoiler"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_hood"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_roof"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_sideskirt"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_lamps"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_nitro"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_exhaust"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_wheels"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_stereo"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_hydraulics"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_front_bumper"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_rear_bumper"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_vent_left"));
AddVehicleComponent(vInfo[vID][v_id_x],dini_Int(string,"v_vent_right"));
printf("Auto// Verzeichnes: ../scriptfiles%s ID: %i geladen!",string,vID);
}
return 1;
}
SaveCars()
{
for(new i=0; i<sizeof(vInfo); i++)
{
if(vInfo[i][v_id_x]==0)continue;
new id_x = vInfo[i][v_db_id];
new string[164];
format(string,sizeof string,"/autos/car %i.txt",id_x);
new color1,color2;
for(new io=0; io<sizeof VEHICLE_TANK; io++)
{
new tID=VEHICLE_TANK[io][td_vehicle_id];
dini_FloatSet(string,"Tank",VEHICLE_TANK[tID][td_tank]);
}
GetVehicleColor(id_x, color1,color2);
vInfo[id_x][v_color_1]=color1;
vInfo[id_x][v_color_2]=color2;
vInfo[id_x][v_spoiler]=GetVehicleComponentInSlot(id_x,0);
vInfo[id_x][v_hood]=GetVehicleComponentInSlot(id_x,1);
vInfo[id_x][v_roof]=GetVehicleComponentInSlot(id_x,2);
vInfo[id_x][v_sideskirt]=GetVehicleComponentInSlot(id_x,3);
vInfo[id_x][v_lamps]=GetVehicleComponentInSlot(id_x,4);
vInfo[id_x][v_nitro]=GetVehicleComponentInSlot(id_x,5);
vInfo[id_x][v_exhaust]=GetVehicleComponentInSlot(id_x,6);
vInfo[id_x][v_wheels]=GetVehicleComponentInSlot(id_x,7);
vInfo[id_x][v_stereo]=GetVehicleComponentInSlot(id_x,8);
vInfo[id_x][v_hydraulics]=GetVehicleComponentInSlot(id_x,9);
vInfo[id_x][v_front_bumper]=GetVehicleComponentInSlot(id_x,10);
vInfo[id_x][v_rear_bumper]=GetVehicleComponentInSlot(id_x,11);
vInfo[id_x][v_vent_left]=GetVehicleComponentInSlot(id_x,12);
vInfo[id_x][v_vent_right]=GetVehicleComponentInSlot(id_x,13);
ChangeVehiclePaintjob(vInfo[id_x][v_id_x],vInfo[id_x][v_paintjob]);
dini_IntSet(string,"Color_1",vInfo[id_x][v_color_1]);
dini_IntSet(string,"Color_2",vInfo[id_x][v_color_2]);
dini_IntSet(string,"v_spoiler",vInfo[id_x][v_spoiler]);
dini_IntSet(string,"v_hood",vInfo[id_x][v_hood]);
dini_IntSet(string,"v_roof",vInfo[id_x][v_roof]);
dini_IntSet(string,"v_sideskirt",vInfo[id_x][v_sideskirt]);
dini_IntSet(string,"v_lamps",vInfo[id_x][v_lamps]);
dini_IntSet(string,"v_nitro",vInfo[id_x][v_nitro]);
dini_IntSet(string,"v_exhaust",vInfo[id_x][v_exhaust]);
dini_IntSet(string,"v_wheels",vInfo[id_x][v_wheels]);
dini_IntSet(string,"v_stereo",vInfo[id_x][v_stereo]);
dini_IntSet(string,"v_hydraulics",vInfo[id_x][v_hydraulics]);
dini_IntSet(string,"v_front_bumper",vInfo[id_x][v_front_bumper]);
dini_IntSet(string,"v_rear_bumper",vInfo[id_x][v_rear_bumper]);
dini_IntSet(string,"v_vent_left",vInfo[id_x][v_vent_left]);
dini_IntSet(string,"v_vent_right",vInfo[id_x][v_vent_right]);
dini_IntSet(string,"v_paintjob",vInfo[id_x][v_paintjob]);
}
return 1;
}
public Sekunde()
{
for(new i=0; i<sizeof vInfo; i++)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine==0)continue;
new tID;
for(new ipp=0; ipp<sizeof VEHICLE_TANK; ipp++)
{
if(VEHICLE_TANK[ipp][td_status]==0)continue;
tID=ipp;
}
printf("Auto %i Tank %i",i,VEHICLE_TANK[tID][td_tank]);
print("Motor ist an!");
VEHICLE_TANK[tID][td_tank]=VEHICLE_TANK[tID][td_tank]-VEHICLE_TANK_ABZUG;
printf("0.2L wurden abgezogen Jetzt: %f",VEHICLE_TANK[tID][td_tank]);
for(new pi=0; pi<MAX_PLAYERS; pi++)
{
if(GetPlayerVehicleID(pi)==VEHICLE_TANK[tID][td_vehicle_id])
{
if(VEHICLE_TANK[tID][td_tank]<=0)
{
engine=0;
SetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
SendClientMessage(pi,rot," Der Tank ist Leer!");
return 1;
}
}
if(GetVehicleModel(i)==462)
{
VEHICLE_TANK[tID][td_tank]=100.0;
new string[164];
format(string,sizeof string,"Tank: %iL",floatround(VEHICLE_TANK[tID][td_tank]));
PlayerTextDrawSetString(pi,Tacho_Fuel[pi],string);
return 1;
}
if(vInfo[i][v_vehicleid]==462)
{
VEHICLE_TANK[tID][td_tank]=100.0;
new string[164];
format(string,sizeof string,"Tank: %iL",floatround(VEHICLE_TANK[tID][td_tank]));
PlayerTextDrawSetString(pi,Tacho_Fuel[pi],string);
return 1;
}
new string[164];
if(!IsPlayerInAnyVehicle(pi))continue;
print("Spieler gefunden!");
if(GetPlayerVehicleSeat(pi)==0)
{
print("fahrer gefunden");
format(string,sizeof string,"Tank: %iL",floatround(VEHICLE_TANK[tID][td_tank]));
PlayerTextDrawSetString(pi,Tacho_Fuel[pi],string);
print("Anzeige aktualisiert!");
if(VEHICLE_TANK[tID][td_tank]<=0)
{
SendClientMessage(pi,rot,"Dein Tank ist leer!");
engine=0;
SetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
}
}
}
}
}
Schonmal Vielen dank für alle Hilfreichen Antworten
LG: xlTreasurelx