Save Tune cause Crash ? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Save Tune cause Crash ? (
/showthread.php?tid=601284)
Save Tune cause Crash ? -
Metharon - 19.02.2016
Why is giving my players opcodes, then crash .. ?
pawn Код:
new IDTunabil[MAX_PLAYERS];
function SaveTune(playerid)
{
new i = IDTunabil[playerid];
new c = VehicleInfo[i][vVeh];
new id = i;
VehicleInfo[id][Spoiler] = GetVehicleComponentInSlot(c, CARMODTYPE_SPOILER);
VehicleInfo[id][Hood] = GetVehicleComponentInSlot(c, CARMODTYPE_HOOD);
VehicleInfo[id][Bumper1] = GetVehicleComponentInSlot(c, CARMODTYPE_FRONT_BUMPER);
VehicleInfo[id][Bumper2] = GetVehicleComponentInSlot(c, CARMODTYPE_REAR_BUMPER);
VehicleInfo[id][Hydraulic] = GetVehicleComponentInSlot(c, CARMODTYPE_HYDRAULICS);
VehicleInfo[id][Nitro] = GetVehicleComponentInSlot(c, CARMODTYPE_NITRO);
VehicleInfo[id][Exhaust] = GetVehicleComponentInSlot(c, CARMODTYPE_EXHAUST);
VehicleInfo[id][Lamps] = GetVehicleComponentInSlot(c, CARMODTYPE_LAMPS);
VehicleInfo[id][Roof] = GetVehicleComponentInSlot(c, CARMODTYPE_ROOF);
VehicleInfo[id][Wheels] = GetVehicleComponentInSlot(c, CARMODTYPE_WHEELS);
VehicleInfo[id][SideSkirt] = GetVehicleComponentInSlot(c, CARMODTYPE_SIDESKIRT);
VehicleInfo[id][Spoiler] = GetVehicleComponentInSlot(c, CARMODTYPE_SPOILER);
VehicleInfo[id][Hood] = GetVehicleComponentInSlot(c, CARMODTYPE_HOOD);
VehicleInfo[id][Bumper1] = GetVehicleComponentInSlot(c, CARMODTYPE_FRONT_BUMPER);
VehicleInfo[id][Bumper2] = GetVehicleComponentInSlot(c, CARMODTYPE_REAR_BUMPER);
VehicleInfo[id][Hydraulic] = GetVehicleComponentInSlot(c, CARMODTYPE_HYDRAULICS);
VehicleInfo[id][Nitro] = GetVehicleComponentInSlot(c, CARMODTYPE_NITRO);
VehicleInfo[id][Exhaust] = GetVehicleComponentInSlot(c, CARMODTYPE_EXHAUST);
VehicleInfo[id][Lamps] = GetVehicleComponentInSlot(c, CARMODTYPE_LAMPS);
VehicleInfo[id][Roof] = GetVehicleComponentInSlot(c, CARMODTYPE_ROOF);
VehicleInfo[id][Wheels] = GetVehicleComponentInSlot(c, CARMODTYPE_WHEELS);
VehicleInfo[id][SideSkirt] = GetVehicleComponentInSlot(c, CARMODTYPE_SIDESKIRT);
SaveVehicle(i);
}
Код:
for(new i = 0; i < sizeof(VehicleInfo); i++)
{
if(VehicleInfo[i][vVeh] == c)
{
new id = i;
if(LoadTune == 1)
{
if(VehicleInfo[i][Paintjob] != 0) { ChangeVehiclePaintjob(c, VehicleInfo[i][Paintjob]); }
if(VehicleInfo[id][Spoiler] != 0) { AddVehicleComponent(c, VehicleInfo[id][Spoiler]); }
if(VehicleInfo[id][Hood] != 0) { AddVehicleComponent(c, VehicleInfo[id][Hood]); }
if(VehicleInfo[id][Bumper1] != 0) { AddVehicleComponent(c, VehicleInfo[id][Bumper1]); }
if(VehicleInfo[id][Bumper2] != 0) { AddVehicleComponent(c, VehicleInfo[id][Bumper2]); }
if(VehicleInfo[id][Hydraulic] != 0) { AddVehicleComponent(c, VehicleInfo[id][Hydraulic]); }
if(VehicleInfo[id][Nitro] != 0) { AddVehicleComponent(c, VehicleInfo[id][Nitro]); }
if(VehicleInfo[id][Exhaust] != 0) { AddVehicleComponent(c, VehicleInfo[id][Exhaust]); }
if(VehicleInfo[id][Lamps] != 0) { AddVehicleComponent(c, VehicleInfo[id][Lamps]); }
if(VehicleInfo[id][Roof] != 0) { AddVehicleComponent(c, VehicleInfo[id][Roof]); }
if(VehicleInfo[id][Wheels] != 0) { AddVehicleComponent(c, VehicleInfo[id][Wheels]); }
if(VehicleInfo[id][SideSkirt] != 0) { AddVehicleComponent(c, VehicleInfo[id][SideSkirt]); }
}
GetVehicleParamsEx(c, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsVeh(c, 0, 0, alarm, VehicleInfo[i][vLock], bonnet, boot, objective);
ChangeVehicleColor(c, VehicleInfo[i][vColor1], VehicleInfo[i][vColor2]);
}
}
Re: Save Tune cause Crash ? -
Ahmad45123 - 19.02.2016
What opcodes are shown to player ?
Can you paste it here ?