Valhallából szedtem ki ezeket a sorokat, szerintem neked is jól jönne.
Nyisd meg a global mappát, azon belül az s_vehicle_globals.lua-t és a benne lévők helyett ezt írd be:
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, \"Too much vehicles\"
end
return false, \"Player not logged in\"
end
return false, \"Element not found\"
end
Az egészet törölheted! Ha gondolod, akkor másolok be neked egy alap scriptet, amit még magamnak írtam.
Nem biztos, h jó, még nem teszteltem le.
szerelo1 = createColSphere( 1448.154296875, -1448.8037109375, 13.545628547668, 10)
exports.rp_core:allocateElement(szerelo)
setElementInterior(szerelo, 0)
setElementDimension(szerelo, 0)
function GetClosestVehicle(p1)
local x, y, z = getElementPosition(p1)
local dis = 99999
local dis2 = 0
local cid = -1
local type = \"vehicle\"
for key,value in ipairs(getElementsByType(type)) do
if value ~= p1 then
local x2, y2, z2 = getElementPosition(value)
dis2 = getDistanceBetweenPoints3D ( x, y, z, x2, y2, z2 )
if tonumber(dis2) < tonumber(dis) then
dis = dis2;
cid = value;
end
end
end
return cid
end
function megjavitscript(player)
local csapat = getPlayerTeam(player)
local id = getElementData(csapat, \"id\")
local factionrank = getElementData(player,\"factionrank\")
if id == 4 and factionrank >=1 then
local kocsi = GetClosestVehicle (player)
if kocsi and isElementWithinColShape(player, szerelo) then
local x, y, z = getElementPosition( player )
if getDistanceBetweenPoints3D( x, y, z, getElementPosition( kocsi ) ) < 5 then
fixVehicle(kocsi)
outputChatBox (\"Sikeresen megjavítottad a kocsit!\", player)
else
outputChatBox (\"Nincs kocsi a közeledben!\", player)
end
else
outputChatBox(\"Nem vagy a szerelő zónában!\",player)
end
else
outputChatBox(\"Nem vagy az EverLife City szerelők tagja!\",player)
end
end
addCommandHandler (\"megjavit\" , megjavitscript)