Random Vehicle tuning crash -
knackworst - 12.11.2011
Hello, I'm sorry for my frequent post :/
anyways I was making a random tune system for my server, very easy, u type /tune and your vehicle gets randomly tuned...
this is what I came up with:
pawn Код:
if(!strcmp("/tune", cmdtext, true))
{
new model = GetVehicleModel(GetPlayerVehicleID(playerid));
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "Wait, are you trying to tune yourself??!");
AddVehicleComponent(GetPlayerVehicleID(playerid), random(3) + 1000); //Adding the spoiler
AddVehicleComponent(GetPlayerVehicleID(playerid), random(1) + 1004); //Adding the hood
AddVehicleComponent(GetPlayerVehicleID(playerid), 1006); //Adding the roof
AddVehicleComponent(GetPlayerVehicleID(playerid), 1007); //Adding the SideSkirt
AddVehicleComponent(GetPlayerVehicleID(playerid), 1013); //Adding the Lamps
AddVehicleComponent(GetPlayerVehicleID(playerid), 1017); //Adding the Other SideSkirt
AddVehicleComponent(GetPlayerVehicleID(playerid), random(4) + 1018); //Adding the Exhaust
AddVehicleComponent(GetPlayerVehicleID(playerid), random(12) + 1073); //Adding the Wheels
AddVehicleComponent(GetPlayerVehicleID(playerid), 1087); //Adding the Hydralics
if(model == 483 || model == 534 || model == 535 || model == 536 || model == 558 || model == 559 || model == 560 || model == 561 || model == 562 || model == 565 || model == 567 || model == 575 || model == 576)
{
switch(model)
{
case 483: ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), 0);
case 534 .. 536: ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), random(2));
case 558 .. 562: ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), random(2));
case 565: ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), random(2));
case 567: ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), random(2));
case 575: ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), random(1));
case 576: ChangeVehiclePaintjob(GetPlayerVehicleID(playerid), random(2));
}
}
else
{
ChangeVehicleColor(GetPlayerVehicleID(playerid), random(7) + 144, random(7) + 144);
}
SendClientMessage(playerid, COLOR_YELLOW, "Your vehicle was randomly tuned, to choose your own tunings teleport to garages.");
PlayerPlaySound(playerid,1133,0.0,0.0,0.0); // Sound of vehicle improving
return 1;
}
when I go ingame and I test /tune in f.e a sultan, i get this tunings and a nice paintjob, however when I use a regular vehicle (no special tunings), the color changes, the wheels change, and theere are hydralics added, but I get 2 warning opcodes in game, and sometimes my game crashes...
any help?
thanks in advance
rep for helper
Re: Random Vehicle tuning crash -
GangsTa_ - 12.11.2011
Try the crashdetect plugin.
Re: Random Vehicle tuning crash -
knackworst - 12.11.2011
Yes but its very badly explained how to use it :/
Re: Random Vehicle tuning crash -
Wesley221 - 12.11.2011
Not every component is compatible with every vehicle.
You have to find them all for every vehicle by yourself.
If im right there is an include or filterscript around, imma check it right now; editing post if i found it
Edit:
Found an include, might help you with this
https://sampforum.blast.hk/showthread.php?tid=286170
Re: Random Vehicle tuning crash -
knackworst - 12.11.2011
thank you!