Minek ide skype. Megoldás egy alapvető kész modból. itt tekintek ZeroMTA-ra akár. átmásolod a c_vehicle és az s_vehicle globalst
c_vehicle_globals
local factor = 1.5
function relateVelocity(speed)
return factor * speed
end
function getVehicleVelocity(vehicle)
speedx, speedy, speedz = getElementVelocity (vehicle)
return relateVelocity((speedx^2 + speedy^2 + speedz^2)^(0.5)*100)
end
s_vehicle_globals
function getVehiclesOwnedByCharacter(thePlayer)
local dbid = tonumber(getElementData(thePlayer, \"dbid\"))
local carids = { }
local numcars = 0
local indexcars = 1
for key, value in ipairs(exports.pool:getPoolElementsByType(\"vehicle\")) do
local owner = tonumber(getElementData(value, \"owner\"))
if (owner) and (owner==dbid) then
local id = getElementData(value, \"dbid\")
carids[numcars+1] = id
numcars = numcars + 1
end
end
return numcars, carids
end
function canPlayerBuyVehicle(thePlayer)
if (isElement(thePlayer)) then
if getElementData(thePlayer, \"loggedin\") == 1 then
local maxvehicles = getElementData(thePlayer, \"maxvehicles\") or 0
local novehicles, veharray = getVehiclesOwnedByCharacter(thePlayer)
if (novehicles < maxvehicles) then
return true
end
return false, \"Túl sok jármű\"
end
return false, \"Játékos nincs bejelentkezve\"
end
return false, \"Element not found\"
end