A little SQL help, please

Althasil

Well-Known Member
Hi,

I'm trying to ensure vehicles will always respawn if they are destroyed, but I'm not familiar enough with SQL to 'say' it correctly. Here's what I have;

Code:
UPDATE 'instance_vehicle'
SET 'damage' = 0, 'worldspace' = 'worldspace'.'world_vehicle', 'inventory' = 'inventory'.'world_vehicle'
WHERE 'damage' = 1
AND 'world_vehicle_id' = 'world_vehicle'.'vehicle_id';

Can I then ensure that this will run either before each restart or once every 6 hours?

Thanks
 
Hey MYSQL you just have to tell it what you want in simple words :p

Code:
UPDATE instance_vehicle iv, world_vehicle wv
  SET iv.worldspace = wv.worldspace, iv.damage ='0', iv.inventory='[[[],[]],[[],[]],[[],[]]]', iv.parts='[]'
WHERE iv.world_vehicle_id = wv.id
  AND iv.instance_id = wv.world_id
  AND iv.damage = '1'

assigns instance_vehicle as iv and world_vehicle table as wv

Changes (SET) The worldspace to the one in world vehicle, then sets iv.parts to [] (SO NO PARTS ARE NEEDED TO FIX IT) and inventory to blank too so peoples crap doesn't come back after stuff blows up.

Only does this change where the damage is 1, instance_id and world Id are the same (just a safeguard for map changes) and where the world vehicle id and id are the same (so that it gets the spawn point from the world vehicle table)


Problems with a purely mysql query spawning script:
Cant easily change spawn points by using the spawn rates set in the world_vehicle table with min max etc etc because queries cant hold data, need php or something


WAYS TO IMPROVE:
iv.inventory= wv.inventory would allow for inventory spawns if set in the world_vehicle table.
 
Back
Top