Sziasztok!
Régebben találtam még hív fórumon egy olyan fs-t amin ha parancsot beírjuk akkor objecteket rak a kocsira!
Nos az elején ment minden tökéletesen ámde, mostanában a szerver \"nem ismeri fel\" a parancsot, és még bugolni is szokott!
Tehát a bug alatt azt értem, hogy ha fenntvoltunk öten akkor én beírtam a parancsot minden jó, de mikor más beírta a parancsot eltűnt az én járművemről az object és az övére ment át!
Itt a kód:
new obj[MAX_PLAYERS] = { INVALID_OBJECT_ID, ... };
new obj2[MAX_PLAYERS] = { INVALID_OBJECT_ID, ... };
new obj3[MAX_PLAYERS] = { INVALID_OBJECT_ID, ... };
new LightPwr[MAX_VEHICLES];
new Flasher[MAX_VEHICLES] = 0;
new FlasherState[MAX_VEHICLES];
new FlashTimer;
public OnGameModeInit()
{
FlashTimer = SetTimer(\"FlasherFunc\",200,1); // \"200\" is the speed from the flashing headlights
return 1;
}
public OnGameModeExit()
{
KillTimer(FlashTimer);
return 1;
}
CMD:flash(playerid)
{
new vehicleid,panels,doors,lights,tires;
vehicleid = GetPlayerVehicleID(playerid);
if(!Flasher[vehicleid])
{
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
return SendClientMessage(playerid, 0xff0000ff, \"Nem vagy kocsiban vagy nem te vagy a sofőr!\");
}
if (!GetVehicleModel(vehicleid)) return SendClientMessage(playerid, 0xff0000ff, \"Erre a kocsira nem tehetsz villogót\");
if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid]) || IsValidObject(obj3[vehicleid]))
{
DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]), DestroyObject(obj3[vehicleid]);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
if(LightPwr[vehicleid] == 1)
UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);
else
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
Flasher[vehicleid] = 0;
}
switch (GetVehicleModel(vehicleid))
{
case 596://lspd
{
if (AVehicleData[vehicleid][staticVehicle] == true)
{
// Check if the entered vehicle is a cop vehicle
switch (GetVehicleModel(vehicleid))
{
case VehiclePoliceLSPD:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
}
}
}
case 597://sfpd
{
if (AVehicleData[vehicleid][staticVehicle] == true)
{
// Check if the entered vehicle is a cop vehicle
switch (GetVehicleModel(vehicleid))
{
case VehiclePoliceSFPD:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
}
}
}
case 598://lvpd
{
if (AVehicleData[vehicleid][staticVehicle] == true)
{
// Check if the entered vehicle is a cop vehicle
switch (GetVehicleModel(vehicleid))
{
case VehiclePoliceLVPD:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
}
}
}
case 599://police ranger
{
if (AVehicleData[vehicleid][staticVehicle] == true)
{
// Check if the entered vehicle is a cop vehicle
switch (GetVehicleModel(vehicleid))
{
case VehiclePoliceRanger:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
}
}
}
case 541://bullet
{
if (AVehicleData[vehicleid][staticVehicle] == true)
{
// Check if the entered vehicle is a cop vehicle
switch (GetVehicleModel(vehicleid))
{
case VehiclePoliceBullet:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.51320, -0.14420, 0.62810, 0.00000, 0.00000, 0.00000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
}
}
}
case 560://sultan
{
if (AVehicleData[vehicleid][staticVehicle] == true)
{
// Check if the entered vehicle is a cop vehicle
switch (GetVehicleModel(vehicleid))
{
case VehiclePoliceSultan:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, -0.53010, -0.13570, 0.84, 0.00000, 0.00000, 0.00000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
}
}
}
case 411://infernus
{
if (AVehicleData[vehicleid][staticVehicle] == true)
{
// Check if the entered vehicle is a cop vehicle
switch (GetVehicleModel(vehicleid))
{
case VehiclePoliceInfernus:
{
obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.49490, 0.10620, 0.70570, 0.00000, 0.00000, 0.00000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
}
}
}
case 525://tow truck
{
if (AVehicleData[vehicleid][staticVehicle] == true)
{
// Check if the entered vehicle is a cop vehicle
switch (GetVehicleModel(vehicleid))
{
case VehicleTowTruck:
{
obj[vehicleid] = CreateObject(19294, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
AttachObjectToVehicle(obj[vehicleid], vehicleid, -0.52110, -0.47140, 1.45000, 0.00000, 0.00000, 0.00000);
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
Flasher[vehicleid] = 1;
}
}
}
}
}
return 1;
}
else
{
if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
return SendClientMessage(playerid, 0xff0000ff, \"Nem vagy kocsiban!/Nem te vagy a sofőr!\");
}
if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid]) || IsValidObject(obj3[vehicleid]))
{
DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]), DestroyObject(obj3[vehicleid]);
}
GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
if(LightPwr[vehicleid] == 1)
UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);
else
UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
Flasher[vehicleid] = 0;
}
return 1;
forward FlasherFunc();
public FlasherFunc() {
new panelsx,doorsx,lightsx,tiresx;
for (new p=0; p<MAX_VEHICLES; p++)
{
if (Flasher[p] == 1)
{
if (FlasherState[p] == 1)
{
GetVehicleDamageStatus(p,panelsx,doorsx,lightsx,tiresx);
UpdateVehicleDamageStatus(p, panelsx, doorsx, 4, tiresx);
FlasherState[p] = 0;
}
else
{
GetVehicleDamageStatus(p,panelsx,doorsx,lightsx,tiresx);
UpdateVehicleDamageStatus(p, panelsx, doorsx, 1, tiresx);
FlasherState[p] = 1;
}
}
}
}
Válaszokat és a megoldásokat köszönöm előre is!