[Release] vRP/ESX\Standalone Gruppe6Robbing( Now synced between players!) "Armored truck robbing"

Citizen.CreateThread(function()
while true do
 if NetworkIsHost() then
  if (not door) and (not attack) and (not cleanPeds) then
   local GRDpos = GetEntityCoords(thisPatriot)
   local GRDpos2 = GetEntityCoords(thisPatriot2)
   local ARpos = GetOffsetFromEntityInWorldCoords(thisTruck,0.0,-7.5,0.0)
   
   if (Vdist(ARpos.x,ARpos.y,ARpos.z,GRDpos.x,GRDpos.y,GRDpos.z) > 30) then
      Wait(300)
		TaskVehicleDriveToCoordLongrange(Grd_driver,thisPatriot,ARpos.x,ARpos.y,ARpos.z,25.0,524860,2.0)
		if (Vdist(GRDpos.x,GRDpos.y,GRDpos.z,GRDpos2.x,GRDpos2.y,GRDpos2.z) > 30) then
			TaskVehicleDriveToCoordLongrange(Grd_driver2,thisPatriot2,GRDpos.x,GRDpos.y,GRDpos.z,25.0,524860,2.0)
		end
   elseif
     (Vdist(ARpos.x,ARpos.y,ARpos.z,GRDpos.x,GRDpos.y,GRDpos.z) > 10) and (Vdist(ARpos.x,ARpos.y,ARpos.z,GRDpos.x,GRDpos.y,GRDpos.z) < 30)then
      Wait(300)
		TaskVehicleDriveToCoordLongrange(Grd_driver,thisPatriot,ARpos.x,ARpos.y,ARpos.z,15.0,786603,2.0)
		if (Vdist(GRDpos.x,GRDpos.y,GRDpos.z,GRDpos2.x,GRDpos2.y,GRDpos2.z) > 10) and (Vdist(GRDpos.x,GRDpos.y,GRDpos.z,GRDpos2.x,GRDpos2.y,GRDpos2.z) < 30) then
			TaskVehicleDriveToCoordLongrange(Grd_driver2,thisPatriot2,GRDpos.x,GRDpos.y,GRDpos.z,15.0,786603,2.0)
		end

   elseif
     (Vdist(ARpos.x,ARpos.y,ARpos.z,GRDpos.x,GRDpos.y,GRDpos.z) < 10) then
      Wait(300)
		TaskVehicleDriveToCoordLongrange(Grd_driver,thisPatriot,ARpos.x,ARpos.y,ARpos.z,6.0,786603,2.0)
		if (Vdist(GRDpos.x,GRDpos.y,GRDpos.z,GRDpos2.x,GRDpos2.y,GRDpos2.z) < 10) then
			TaskVehicleDriveToCoordLongrange(Grd_driver2,thisPatriot2,GRDpos.x,GRDpos.y,GRDpos.z,6.0,786603,2.0)
		end
		
   end
  end
 end
      Wait(200)
      TruckID = VehToNet(Armored_truck)
      GrdpID = VehToNet(Grd_patriot)
	  Grdp2ID = VehToNet(Grd_patriot2)

      Citizen.InvokeNative(0xE05E81A888FA63C8,TruckID,1)
      Citizen.InvokeNative(0xE05E81A888FA63C8,GrdpID,1)
	  Citizen.InvokeNative(0xE05E81A888FA63C8,GrdpID2,1)

      Wait(250)
      TriggerServerEvent("IDS",TruckID,GrdpID,GrdpID2)
      spawn = false
   end
Citizen.CreateThread(function()
 while true do
 Wait(10000)
  if NetworkIsHost() then
    if cleanPeds then
      Wait(120000)
      SetEntityAsNoLongerNeeded(Armored_truck)
      SetEntityAsNoLongerNeeded(Grd_patriot)
	  SetEntityAsNoLongerNeeded(Grd_patriot2)
      SetEntityAsNoLongerNeeded(driver)
      SetEntityAsNoLongerNeeded(passenger)
      SetEntityAsNoLongerNeeded(Grd_passenger1)
      SetEntityAsNoLongerNeeded(Grd_driver)
      SetEntityAsNoLongerNeeded(Grd_passenger2)
      SetEntityAsNoLongerNeeded(Grd_passenger3)
	  SetEntityAsNoLongerNeeded(Grd_passenger4)
      SetEntityAsNoLongerNeeded(Grd_passenger5)
      SetModelAsNoLongerNeeded(0x63858A4A)
      SetModelAsNoLongerNeeded(0x9114EADA)
      SetModelAsNoLongerNeeded(0xCDEF5408)
      SetModelAsNoLongerNeeded(0xB3F3EE34)
      SetModelAsNoLongerNeeded(0x7A05FA59)
      ClearRelationshipBetweenGroups(0, GetHashKey("Ar_truck"), GetHashKey("PLAYER"))
      ClearRelationshipBetweenGroups(0, GetHashKey("PLAYER"), GetHashKey("Ar_truck"))
      cleanPeds = false
    end
  end
 end
end)

There is some more interactions but yes this is the idea ^^. Don’t forget to duplicate the server side “interactions” to.

Ok it is already working, I was missing some synchronization from the server.
Thankss ^^

1 Like

No problem enjoy dude !

is there a way to make this take an item to get in the armored truck? like the c4 from the bank heist script

1 Like

It seems that every player gets his own truck spawned? how can I disable it. Im running ESX.

1 Like

Doesn’t work on onesync. Doesn’t ironically sync for all players. Robbers gets notified one spawn. The next time it spawn cops get notified

Hi, i don’t use onesync, and don’t know how it work sorry.Pull requests :wink:.

Is there a way to change the item used for the robbery? We really dont want StickyBombs in our server. People tend to get a little crazy.
PS, just read that it says (Or other way you know how)… i mean… a hint would be great :slight_smile: so I can update the alert message.

Hi. Do you mean an other weapon ? I don’t play gta online since 2013, so i don’t know anything about the new stuffs like weapons, cars etc. And if you mean any other way and if you have some little scripting skills so yes, it can be easy.
You can maybe add an item like a key,that drop when a guard is dead.

hello, i have a problem whith entitys IDs .
I am on another framework from esx or vrp, but i think is a compatibility error? tx.

Hi @icik9 , if have make any changes, i’m unable to help you but the only thing that i remember about this error is that you need this in the resource.lua

resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9 ’

thanks, i haven’t modify the script at all and the line "resource_manifest_version ‘05cfa83c-a124-4cfa-a768-c24a5811d8f9 ’’ is same …

I continue searching, thanks :slight_smile:

Which version are you using ? Have you tried both ? One sync ?

all work fine but , if i try config —> config.lua - the reward dont change

@Kass33 Esx or vrp?

@mikou esx

@Kass33 Can you show me your config.lua please? Have you make any modifications to the script?