Infiniuh Posted October 12, 2014 Posted October 12, 2014 So i found this script, i've tested it out. It doesn't make a blip on the random marker from "robberHouses" list. Any help? local robberHouses = { { -683.95148, 939.66760, 13.63281 }; -- change to your values. { -669.77100, 964.31586, 11.63281 } } function unpackRobberHouses () return unpack ( robberHouses [ math.random ( #robberHouses ) ] ) end function resourceBootUp () ourPed = createPed ( 7, -705.94788, 940.12787, 12.42719 ) ourBlip = createBlipAttachedTo ( ourPed, 41 ) setBlipVisibleDistance ( ourBlip, 300 ) setElementFrozen ( ourPed, true ) setElementRotation ( ourPed, 0, 0, 0 ) setElementInterior ( ourPed, 0 ) setElementDimension ( ourPed, 0 ) end addEventHandler ( "onClientResourceStart", resourceRoot, resourceBootUp ) local robberWindow = guiCreateWindow ( 0.314, 0.2513, 0.3809, 0.3893, "JOB", true ) local robberLabel = guiCreateLabel ( 0.0193, 0.0736, 0.9903, 0.1104, "Criminal Job", true, robberWindow ) guiLabelSetColor ( robberLabel, 255, 0, 0 ) guiLabelSetHorizontalAlign ( robberLabel, "center", false ) guiSetFont ( robberLabel, "default-bold-small" ) local robberInfoLabel = guiCreateLabel ( 0.0309, 0.2441, 0.944, 0.3077, "If you accept this job, you will be able to rob houses, hijack cars for money and rob banks (WIP). Go to the blip created on \nyour minimap (red house icon). Once you enter the marker you will steal some money and you have a chance to get wanted.", true, robberWindow ) local robberAcceptButton = guiCreateButton ( 0.3533 ,0.7993, 0.1409, 0.1204, "Accept", true, robberWindow ) local robberCloseButton = guiCreateButton ( 0.5309, 0.7993, 0.1409, 0.1204, "Close", true, robberWindow ) guiSetVisible ( robberWindow, false ) function detectClickOnPed ( button, state, absX, absY, wx, wy, wz, element ) if ( element and element == ourPed and not isPedInVehicle ( localPlayer ) ) then local x, y, z = getElementPosition ( localPlayer ) if ( getDistanceBetweenPoints3D ( x, y, z, wx, wy, wz ) <= 3 ) then guiSetVisible ( robberWindow, true ) end end end addEventHandler ( "onClientClick", root, detectClickOnPed ) function buttonClick ( button ) if ( button ~= "left" ) then return end if ( source == robberCloseButton ) then guiSetVisible ( robberWindow, false ) showCursor ( false ) elseif ( source == robberAcceptButton ) then destroyElement ( robhouseMarker ) destroyElement ( robhouseBlip ) triggerServerEvent ( "robberJobAccepted", localPlayer ) guiSetVisible ( robberWindow, false ) showCursor ( false ) triggerEvent ( "createHouseEvent", localPlayer ) outputChatBox ( "You are now employed as a Robber!" ) end end addEventHandler ( "onClientGUIClick", resourceRoot, buttonClick ) addEvent ( "createHouseEvent", true ) function createHouses () x, y, z = unpackRobberHouses () robhouseMarker = createMarker ( x, y, z, "cylinder", 3, 255, 51, 102, 85, localPlayer ) robhouseBlip = createBlipAttachedTo ( robhouseMarker, 32, localPlayer ) end addEventHandler ( "createHouseEvent", root, createHouses ) addEventHandler ( "onClientMarkerHit", root, function ( hitElement ) if ( source == robhouseMarker and not isPedInVehicle ( localPlayer ) and hitElement == localPlayer ) then triggerServerEvent ( "givePlayerPay", localPlayer ) destroyElement ( robhouseMarker ) destroyElement ( robhouseBlip ) triggerEvent ( "createHouseEvent", localPlayer ) playSound ( "files/cash.mp3", false ) end end ) addEventHandler ( "onClientPedDamage", resourceRoot, function () cancelEvent () end )
Infiniuh Posted October 13, 2014 Author Posted October 13, 2014 Here is the server side: ]] function createRobberTeam () robberTeam = createTeam ( "Criminal", 202, 12, 57 ) end addEventHandler ( "onResourceStart", resourceRoot, createRobberTeam ) addEvent ( "robberJobAccepted", true ) function givePlayerJob ( ) setPlayerTeam ( source, robberTeam ) setElementModel ( source, 2 ) end addEventHandler ( "robberJobAccepted", root, givePlayerJob ) addEvent ( "givePlayerPay", true ) function givePlayerRobPay () money = math.random ( 350, 1020 ) givePlayerMoney ( source, money ) outputChatBox ( "You succesfully robbed the house and made $" ..money, source ) fadeCamera ( source, false, 1, 0, 0, 0 ) setTimer ( fadeCamera, 1000, 1, source, true, 1 ) end addEventHandler ( "givePlayerPay", root, givePlayerRobPay )
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now