-- Client Side
local key = "o"
GUIEditor.window is delete
function Show_Hide()
if guiGetVisible(GUIEditor.window[1]) == false then
guiSetVisible(GUIEditor.window[1], true)
showCursor(true)
else
guiSetVisible(GUIEditor.window[1], false)
showCursor(false)
end
end
bindKey(key,"down",Show_Hide)
for id = 400, 611 do
if getVehicleNameFromModel(id) ~= "" then
local row = guiGridListAddRow(GUIEditor.gridlist[1])
guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, getVehicleNameFromModel(id), false, false)
guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, tostring(id), false, false)
end
end
addEventHandler( 'onClientGUIClick', root,
function()
local sel = guiGridListGetSelectedItem(GUIEditor.gridlist[1])
local ID = guiGridListGetItemText(GUIEditor.gridlist[1],sel,1)
if (source == GUIEditor.button[1]) then
triggerServerEvent("SpawnMyVehicle", localPlayer, ID)
elseif (source == GUIEditor.button[2]) then
triggerServerEvent("DestroyMyVehicle", localPlayer)
elseif (source == GUIEditor.button[5]) then
triggerServerEvent( 'WVehicleToMe', localPlayer )
elseif (source == GUIEditor.button[4]) then
triggerServerEvent( 'WMEToVehicle', localPlayer )
end
end )
addEventHandler( 'onClientGUIClick', root,
function()
if (source == GUIEditor.button[6]) then
guiSetVisible( GUIEditor.window[1], false)
guiSetInputEnabled(false)
showCursor(false)
outputChatBox('[RentSystem]: تم قفل لوحة نظام الاستئجار ',255,0,0,true )
end
end
)
addEventHandler("onClientGUIClick", root,function()
if source == GUIEditor.checkbox[2] and guiCheckBoxGetSelected (GUIEditor.checkbox[2]) == true then
triggerServerEvent('StartRandomColor',localPlayer)
elseif source == GUIEditor.checkbox[2] and guiCheckBoxGetSelected (GUIEditor.checkbox[2]) == false then
triggerServerEvent('StopRandomColor',localPlayer)
end
end
)
-- Client
addEventHandler('onClientGUIClick',root,
function ()
if source == GUIEditor.checkbox[3] and guiCheckBoxGetSelected(GUIEditor.checkbox[3]) == true then
triggerServerEvent('Create',localPlayer)
elseif source == GUIEditor.checkbox[3] and guiCheckBoxGetSelected(GUIEditor.checkbox[3]) == false then
triggerServerEvent('Destroy',localPlayer)
end
end
)
addEventHandler('onClientGUIClick',root,function ()
if source == GUIEditor.checkbox[4] then
triggerServerEvent('VehicleDamageProof',localPlayer)
end
end)
-- Client
addEventHandler('onClientGUIClick',root,
function ()
if source == GUIEditor.checkbox[1] and guiCheckBoxGetSelected (GUIEditor.checkbox[1]) == true then
triggerServerEvent('nitro',localPlayer)
elseif source == GUIEditor.checkbox[1] and guiCheckBoxGetSelected (GUIEditor.checkbox[1]) == false then
triggerServerEvent('StopNitro',localPlayer)
end
end
)
addEventHandler ("onClientGUIClick",resourceRoot,
function ()
if ( source == GUIEditor.button[3] ) then
triggerServerEvent("FixCar",root)
end
end
)
setTimer(function()
guiSetProperty(GUIEditor.checkbox[1], "NormalTextColour", string.format("%.2X%.2X%.2X%.2X", 255, math.random(255), math.random(255), math.random(255)))
end, 50, 0)
server side
vehicle = {}
--Server Side
addEvent('SpawnMyVehicle', true)
addEventHandler( 'SpawnMyVehicle', root,
function ( ID )
if isElement(vehicle[source]) then destroyElement(vehicle[source]) end
local SerialPlayer , x, y, z = getPlayerSerial(source) , getElementPosition(source)
vehicle[source] = createVehicle( tonumber(ID), x + 2, y + 2, z + 1)
setElementData(vehicle[source],'VehicleSerial',SerialPlayer)
warpPedIntoVehicle ( source, vehicle[source] )
outputChatBox('[RentSystem]: مرحبا بك في سيارتك ', source ,0,255,0,true )
end )
addEvent( 'DestroyMyVehicle', true )
addEventHandler( 'DestroyMyVehicle', root,
function ( )
if not isElement(vehicle[source]) then
outputChatBox("[RentSystem]: ليس هناك سيارة لازالتها", source, 255, 0, 0, true) else
if vehicle[source] and isElement(vehicle[source]) then
destroyElement(vehicle[source])
outputChatBox('[RentSystem]: تم ازالة سيارتك بنجاح ', source ,0,255,0,true )
end
end
end )
addEvent( 'WVehicleToMe', true )
addEventHandler( 'WVehicleToMe', root,
function()
if not isElement(vehicle[source]) then
outputChatBox("[RentSystem]: ليس هناك سيارة لسحبها", source, 255, 0, 0, true) else
local x, y, z = getElementPosition(source)
setElementPosition(vehicle[source], x, y, z)
warpPlayerIntoVehicle(source, vehicle[source])
outputChatBox('[RentSystem]: تم نقلك الي سحب سيارتك بنجاح ', source ,0,255,0,true )
end
end
)
addEvent( 'WMEToVehicle', true )
addEventHandler( 'WMEToVehicle', root,
function()
if not isElement(vehicle[source]) then
outputChatBox("[RentSystem]: ليس هناك سيارة لنقلك لها", source, 255, 0, 0, true) else
local x, y, z = getElementPosition(vehicle[source])
setElementPosition(source, x, y, z)
warpPlayerIntoVehicle(source, vehicle[source])
outputChatBox('[RentSystem]: تم نقلك الي سيارتك بنجاح ', source ,0,255,0,true )
end
end
)
addEventHandler("onPlayerQuit",root,
function ()
if vehicle[source] and isElement(vehicle[source]) then
destroyElement(vehicle[source])
end
end
)
addEvent("StartRandomColor", true)
addEventHandler('StartRandomColor', root,function( )
local vehicle = getPedOccupiedVehicle(source)
Timer[pla] = setTimer(function( pla )
setVehicleColor(vehicle, math.random(0,255), math.random(0,255), math.random(0,255) )
end, 100,100 ,pla)
outputChatBox('[RentSystem]: لقد تم تشغيل الأوان العشوائية بنجاح ', source)
end)
addEvent("StopRandomColor", true)
addEventHandler('StopRandomColor',root,
function ()
if isTimer( Timer) then return killTimer(Timer) end
end
)
--server
Object = { }
addEvent('Create', true)
addEventHandler('Create',root,
function ( )
outputChatBox('[RentSystem]: لقد تم اظهار السهم بنجاح ', source ,0 , 255, 0 , true )
local Interior , Dimension , xPosition, yPosition, zPosition = getElementInterior( source ) , getElementDimension( source) , getElementPosition( source )
Object[source] = createObject(1318,xPosition, yPosition + 3, zPosition )
setElementInterior( Object[source] , Interior )
setElementDimension( Object[source] , Dimension )
addEvent('Delete', true)
addEventHandler('Delete',root,
function ( )
if ( isElement( Object[source] ) ) then
outputChatBox("[RentSystem]: تم اخفاء السهم بنجاح", source, 255, 0, 0, true)
destroyElement( Object[source] )
end
end )
end )
addEvent('VehicleDamageProof',true)
addEventHandler('VehicleDamageProof',root,function ()
local vehicle = getPedOccupiedVehicle ( source )
if vehicle then
isProof = isVehicleDamageProof(vehicle)
setVehicleDamageProof(vehicle, not isProof)
outputChatBox(isProof and "تم حماية السياره من الانفجار" or "تم فك الحمايه")
end
end)
addEvent('nitro', true)
addEventHandler('nitro',root,
function ( )
local Veh = getPedOccupiedVehicle ( source )
addVehicleUpgrade(Veh,1010)
end )
addEvent("StopNitro", true)
addEventHandler('StopNitro',root,
function ()
local Veh = getPedOccupiedVehicle ( source )
if not addVehicleUpgrade(Veh,1010) then return end
removeVehicleUpgrade(Veh,1010)
end
)
--Server
addEvent('FixCar', true)
addEventHandler( 'FixCar', root,
function ( )
if isPedInVehicle ( source ) then
local Veh = getPedOccupiedVehicle ( source )
fixVehicle(Veh)
outputChatBox('[RentSystem]: تم اصلاح سيارتك بنجاح ', source ,0,255,0,true )
else
outputChatBox('[RentSystem]: لايوجد سيارة لاصلاحها ', source ,0,255,0,true )
end
end
)