Jump to content

Spellbreaker

Member
  • Posts

    1
  • Joined

  • Last visited

Spellbreaker's Achievements

  1. HI. I want to control condition of specific part of vehicle controlled by player. Or another vehicle damaged by player vehicle. Currently my code works only for my character but not for others on my local hosted server. I'm doing for loop over players vehicles and changing state of every part to 100. It seems part.setCondition() has limited access to actual vehicle state. On player side it changes only visual state this script in "server" folder function OnTick() -- if isClient() then return end for playerIndex=0, getNumActivePlayers()-1 do local player = getSpecificPlayer(playerIndex); if player and not player:isDead() then CheckPlayerVehicle(player); end end end function CheckPlayerVehicle(player) local vehicle = player.getVehicle and player:getVehicle() or nil if vehicle == nil or not vehicle:isDriver(player) then return end local partCount = vehicle:getPartCount(); for i=0, partCount-1 do local part = vehicle:getPartByIndex(i); local partHP = part:getCondition(); if (partHP < 100) then part:setCondition(100); partHP = part:getCondition(); print(part:getId() .. " current hp " .. partHP); end end end Events.OnTick.Add(OnTick);
×
×
  • Create New...