--server
trucssker = createTeam ( "Electricity fix", 255, 255, 0 )
addEvent( "doSomething", true)
addEventHandler("doSomething", root,
function ()
setElementModel(source,153)
setPlayerTeam(source,trucssker)
setPlayerNametagColor ( source, 255, 255, 0 )
end
)
addEventHandler("doSomethin", root, doStuf)
local vehicleTable = {}
addEvent( "sum", true)
addEventHandler("sum", getRootElement(),
function(car)
local truck = vehicleTable[source] --
if truck then --
if isElement( truck ) then
destroyElement( truck )
end
vehicleTable[source]= nil --
end
if isElement(source) then
local truck = createVehicle ( 546, -1708.04919,983.96619,17.58594 )
warpPedIntoVehicle ( source, truck )
vehicleTable[source]= truck
end
end
)
addEventHandler("onPlayerQuit",root,
function ()
local truck = vehicleTable[source]
if truck then
if isElement( truck ) then
destroyElement( truck )
end
vehicleTable[source]= nil
end
end)
--doSomething
function HaveTruckerJob()
setPlayerTeam(source,getTeamFromName("Drug Job"))
end
addEvent ( "HaveTruckerJob", true)
addEventHandler("HaveTruckerJob", root, HaveTruckerJob)
addEvent ( "givePlayerPay", true )
function givePlayerRobPay ()
money = math.random ( 1500, 2000 )
givePlayerMoney ( source, money )
Stars = math.random ( 1, 1 )
setPlayerWantedLevel ( source, Stars )
fadeCamera ( source, false, 1, 0, 0, 0 )
setTimer ( fadeCamera, 2500, 1, source, true, 1 )
end
addEventHandler ( "givePlayerPay", root, givePlayerRobPay )
--client
local blip = createBlip ( 693.62897,1967.65674,5.53906, 56 )
local skin1 = createPed ( 153, 693.62897,1967.65674,5.53906, 180 )
local getjobmarker = createMarker ( 693.62897,1967.65674,5.53906, "cylinder", 2, 0, 0, 0, 0 )
setElementFrozen(skin1,true)
addEventHandler("onClientPedDamage",root,
function ()
if source == skin1 then
cancelEvent()
end
end)
addEventHandler("onClientRender", getRootElement(),
function()
local x, y, z = getElementPosition(skin1)
local x2, y2, z2 = getElementPosition(localPlayer)
if(isLineOfSightClear(x, y, z, x2, y2, z2, true, true, false, true)) then
local sx, sy = getScreenFromWorldPosition(x, y, z+1.3)
if(sx) and (sy) then
local distance = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2)
if(distance < 30) then
dxDrawText("Electricity fix", sx+2, sy+2, sx, sy, tocolor(0,0,0), 2-(distance/20), "arial", "center", "center")
dxDrawText("Electricity fix", sx, sy, sx, sy, tocolor(255,255,0), 2-(distance/20), "arial", "center", "center")
end
end
end
end)
local x,y = guiGetScreenSize()
addEventHandler("onClientMarkerHit",root,
function (hit)
if source == getjobmarker then
if localPlayer == hit then
guiSetVisible(GUIEditor.window[1],true)
showCursor(true)
end
end
end)
GUIEditor = {
gridlist = {},
window = {},
button = {}
}
function unpackDestinations ()--
return unpack ( destinations [ math.random ( #destinations ) ] )--
end--
addEventHandler("onResourceStart",getjobmarker,
function(p)
if p == lp and not isPedInVehicle(lp) then
guiSetVisible(getjobmarker,true)
showCursor(true)
end
end)--
local x = x - 332
local y = y - 333
GUIEditor.window[1] = guiCreateWindow(259,10,332,518 , "Electricity fix Jop", false)
guiWindowSetSizable(GUIEditor.window[1], false)
guiSetVisible(GUIEditor.window[1],false)
GUIEditor.button[1] = guiCreateButton(1,451,153,41, "Take Job", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA")
GUIEditor.button[2] = guiCreateButton(170, 450, 189, 41, "Cancel", false, GUIEditor.window[1])
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA")
Memo1 = guiCreateMemo(9,25,314,261, "قم بالذهاب الى عامود الكهرباء لبدء تصليحه,العلامه \nالحمراء في الخريطه علامة العامود الذي سيتم تصليحه.\nيجب تركيب سلم عند الذهاب الى العامود لكي تبدأ التصليح\nبعد تصليح العامود سيتم اعطائك مال من قبل الشركه \n", false, GUIEditor.window[1])
guiMemoSetReadOnly(Memo1, true)
GUIEditor.gridlist[1] = guiCreateGridList(12, 300, 310, 140, false, GUIEditor.window[1])
guiGridListAddColumn(GUIEditor.gridlist[1], "skin", 0.3)
guiGridListAddColumn(GUIEditor.gridlist[1], "", 0.3)
guiGridListAddColumn(GUIEditor.gridlist[1], "", 0.3)
for i = 1, 3 do
guiGridListAddRow(GUIEditor.gridlist[1])
end
guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "153", false, false)
guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "1", false, false)
guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "", false, false)
guiGridListSetItemText(GUIEditor.gridlist[1], 0, 3, "", false, false)
addEventHandler("onClientGUIClick",root,
function()
if source == GUIEditor.button[1] then
outputChatBox ("you has been Successfully took Drug Job",0,255,0, true)
outputChatBox ("Please back to the Skin to get the Vehicle",0,255,0, true)
triggerServerEvent ( "doSomething", localPlayer)
showCursor(false)
guiSetVisible ( GUIEditor.window[1], false )
end
end
)
addEventHandler("onClientGUIClick",GUIEditor.window[1],
function(b,thePlayer)
if b == "left" then
if source == GUIEditor.button[2] then
guiSetVisible(GUIEditor.window[1],false)
showCursor(false)
end
end
end)
local destinationsMrker = {
{694.29437,1958.26221,5.53906},
{702.38892,1941.66589,5.53906}
}
function unpackDestinations ()
return unpack ( destinations [ math.random ( #destinationsMrker ) ] )
end
addEventHandler("onClientResourceStart",root,
function()
if getElementType(player) == "player" then
if not ( isPedInVehicle ( player ) ) then
guiSetVisible(GUIEditor.window[1],true)
showCursor(true)
end
end
end)
addEvent("createMssssrMarkers",true)
addEventHandler("createMssssrMarkers",root,
function ()
local num = math.random (#destinationsMrker)
local x = destinations [num][1]
local y = destinations [num][2]
local z = destinations [num][3]
truckerMarker = createMarker(x,y,z,"cylinder",2.0,255,255,0,255)
truckerBlip = createBlip(x,y,z,41)
end
)