Price. Posted February 26, 2014 Share Posted February 26, 2014 got another problem the whole job doesn't work its robbing house job when i take the job i see marked houses on map go to it and rob it but its not working at all Server function HaveCriminalJob() triggerClientEvent(source,"HaveCriminalJob",root,TheX,TheY) setPlayerTeam(source,getTeamFromName("Criminal")) end addEvent ( "HaveCriminalJob", true) addEventHandler("HaveCriminalJob", root, HaveCriminalJob) addEvent ( "givePlayerPay", true ) function givePlayerRobPay () money = math.random ( 150, 2500 ) givePlayerMoney ( source, money ) outputChatBox ( "You successfully robbed the house and made $" ..money, source ) fadeCamera ( source, false, 1, 0, 0, 0 ) setTimer ( fadeCamera, 2500, 1, source, true, 1 ) end addEventHandler ( "givePlayerPay", root, givePlayerRobPay ) Client local robberHouses = { { 1887, -1113, 25 }; { 2092, -1160, 25 }; { 1896, -1165, 22 }; { 2068, -1720, 13 }; { 1970, -1671, 17 }; { 1895, -1071, 23 }; { 1940, -1066, 23 }; { 1955, -1074, 23 }; { 1960, -1069, 23 }; -- add whit { x,y, z}; { 1956, -1115, 26 }; { 1945, -1115, 26 }; { 1924, -1115, 26 }; { 1900, -1114, 26 }; { 2596, -1237, 47 }; { 2595, -1199, 58 }; { 2516, -1028, 69 }; { 2630, -1072, 68 }; { 2794, -1246, 45 }; { 2809, -1176, 25 }; { 2586, -953, 80 }; } function unpackRobberHouses () return unpack ( robberHouses [ math.random ( #robberHouses ) ] ) end jobmarker = createMarker( 2054.4609375, -1759.5224609375, 13.549641609192, "cylinder", 1.5, 255, 153, 0, 150 ) addEventHandler("onResourceStart",jobmarker,function(p) if p == lp and not isPedInVehicle(lp) then guiSetVisible(jobmarker,true) showCursor(true) end end) sx,sy = guiGetScreenSize() -- creates a variable lp = getLocalPlayer() -- creates a variable mr = math.random(1,2) -- creates a variable jobwindow = guiCreateWindow(0.3*sx,0.3*sy,0.4*sx,0.4*sy,"Criminal",false) sx,sy = 0.5*sx,0.5*sy memo = guiCreateMemo(0*sx,0.05*sy,0.8*sx,0.6*sy,"Description here",false,jobwindow) takebutton = guiCreateButton(0.25,0.9,0.2,0.18,"Accept",true,jobwindow) cancbutton = guiCreateButton(0.55,0.9,0.2,0.18,"Cancel",true,jobwindow) guiSetVisible (jobwindow,false) -- makes the gui unvisible guiMemoSetReadOnly(memo,true) -- makes so the memo text cannot be edited. guiWindowSetMovable (jobwindow,false ) -- makes to the window is not moveable guiWindowSetSizable (jobwindow,false ) -- makes so you cannot set the size. addEventHandler("onClientGUIClick",jobwindow, function(b) if b == "left" then if source == takebutton then if getTeamName(getPlayerTeam(lp)) ~= "Criminal" then triggerServerEvent ( "HaveCriminalJob", lp) outputChatBox ("You are now now employed as a Criminal",255,255,0, true) guiSetVisible(jobwindow,false) showCursor(false) end elseif source == cancbutton then guiSetVisible(jobwindow,false) showCursor(false) end end end) addEventHandler("onClientMarkerHit",jobmarker, function(p) if p == lp and not isPedInVehicle(lp) then guiSetVisible(jobwindow,true) showCursor(true) -- sets the cursor visible if getTeamName(getPlayerTeam(lp)) == "Criminal" then outputChatBox ("You already have this job..",0,255,0, true) guiSetVisible(jobwindow,false) showCursor(false) end end end) addEvent("HaveCriminalJob", 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 ) end end ) addEventHandler ( "onClientPedDamage", resourceRoot, function () cancelEvent () end ) no errors or debugscript errors, sorry for double posting. Link to comment
Price. Posted February 27, 2014 Author Share Posted February 27, 2014 any help???!!!!? Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 Well the problem is that you have wrote a wrong eventHandler name here is what you miss > addEvent("HaveCriminalJob", 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 ( "createHousesEvent", root, createHouses ) --Fixed addEvent("HaveCriminalJob", 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 ( "HaveCriminalJob", root, createHouses ) I hope that i helped --BTW you have to add after robbing a house > math.random to create another marker house to rob. Link to comment
Price. Posted February 27, 2014 Author Share Posted February 27, 2014 wow really helped but uhm i wanna make some random wanted system if i robbed i get 2 stars do i use setPlayerWantedLevel ??? also how to use it ? i want the anyone when robbing house gets 2 stars in the first robbing then keeps getting 1 more every rob. Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 (edited) wow really helped but uhm i wanna make some random wanted system if i robbed i get 2 starsdo i use setPlayerWantedLevel ??? Yup. it will be something like this > Stars = math.random ( 1, 6 ) setPlayerWantedLevel ( thePlayer, Start ) outputChatBox ( "You've got " .. Stars .. " Stars For trying to rob a house", thePlayer ) Edited February 27, 2014 by Guest Link to comment
Price. Posted February 27, 2014 Author Share Posted February 27, 2014 where should i put it, it should be in the server side since setplayerwantedlevel is a server side function but where ? which line? Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 setPlayerWanted level is a server body function .. Here is your script with the stars math.random > function HaveCriminalJob() triggerClientEvent(source,"HaveCriminalJob",root,TheX,TheY) setPlayerTeam(source,getTeamFromName("Criminal")) end addEvent ( "HaveCriminalJob", true) addEventHandler("HaveCriminalJob", root, HaveCriminalJob) addEvent ( "givePlayerPay", true ) function givePlayerRobPay () money = math.random ( 150, 2500 ) givePlayerMoney ( source, money ) outputChatBox ( "You successfully robbed the house and made $" ..money, source ) Stars = math.random ( 1, 6 ) setPlayerWantedLevel ( source, Stars ) outputChatBox ( "You've got " .. Stars .. " Stars For trying to rob a house", source ) fadeCamera ( source, false, 1, 0, 0, 0 ) setTimer ( fadeCamera, 2500, 1, source, true, 1 ) end addEventHandler ( "givePlayerPay", root, givePlayerRobPay ) i advice to make the math.random between 1, 2 Link to comment
Price. Posted February 27, 2014 Author Share Posted February 27, 2014 thx but the blip is not working Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 thx but the blip is not working the blip which i added ?, if "Yes", its working for me. Link to comment
Price. Posted February 27, 2014 Author Share Posted February 27, 2014 I copied the whole server script u gave me and replaced it with the one i have still no blip Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 I copied the whole server script u gave me and replaced it with the one i have still no blip Which blip there is no blips at the server side .. any way if you want a blip copy this whole client script and paste it with yours. local robberHouses = { { 1887, -1113, 25 }; { 2092, -1160, 25 }; { 1896, -1165, 22 }; { 2068, -1720, 13 }; { 1970, -1671, 17 }; { 1895, -1071, 23 }; { 1940, -1066, 23 }; { 1955, -1074, 23 }; { 1960, -1069, 23 }; -- add whit { x,y, z}; { 1956, -1115, 26 }; { 1945, -1115, 26 }; { 1924, -1115, 26 }; { 1900, -1114, 26 }; { 2596, -1237, 47 }; { 2595, -1199, 58 }; { 2516, -1028, 69 }; { 2630, -1072, 68 }; { 2794, -1246, 45 }; { 2809, -1176, 25 }; { 2586, -953, 80 }; } function unpackRobberHouses () return unpack ( robberHouses [ math.random ( #robberHouses ) ] ) end jobmarker = createMarker( 2054.4609375, -1759.5224609375, 13.549641609192, "cylinder", 1.5, 255, 153, 0, 150 ) createBlip ( 2054.4609375, -1759.5224609375, 13.549641609192, 52 ) addEventHandler("onResourceStart",jobmarker,function(p) if p == lp and not isPedInVehicle(lp) then guiSetVisible(jobmarker,true) showCursor(true) end end) sx,sy = guiGetScreenSize() -- creates a variable lp = getLocalPlayer() -- creates a variable mr = math.random(1,2) -- creates a variable jobwindow = guiCreateWindow(0.3*sx,0.3*sy,0.4*sx,0.4*sy,"Criminal",false) sx,sy = 0.5*sx,0.5*sy memo = guiCreateMemo(0*sx,0.05*sy,0.8*sx,0.6*sy,"Description here",false,jobwindow) takebutton = guiCreateButton(0.25,0.9,0.2,0.18,"Accept",true,jobwindow) cancbutton = guiCreateButton(0.55,0.9,0.2,0.18,"Cancel",true,jobwindow) guiSetVisible (jobwindow,false) -- makes the gui unvisible guiMemoSetReadOnly(memo,true) -- makes so the memo text cannot be edited. guiWindowSetMovable (jobwindow,false ) -- makes to the window is not moveable guiWindowSetSizable (jobwindow,false ) -- makes so you cannot set the size. addEventHandler("onClientGUIClick",jobwindow, function(b) if b == "left" then if source == takebutton then if getTeamName(getPlayerTeam(lp)) ~= "Criminal" then triggerServerEvent ( "HaveCriminalJob", lp) outputChatBox ("You are now now employed as a Criminal",255,255,0, true) guiSetVisible(jobwindow,false) showCursor(false) end elseif source == cancbutton then guiSetVisible(jobwindow,false) showCursor(false) end end end) addEventHandler("onClientMarkerHit",jobmarker, function(p) if p == lp and not isPedInVehicle(lp) then guiSetVisible(jobwindow,true) showCursor(true) -- sets the cursor visible if getTeamName(getPlayerTeam(lp)) == "Criminal" then outputChatBox ("You already have this job..",0,255,0, true) guiSetVisible(jobwindow,false) showCursor(false) end end end) addEvent("HaveCriminalJob", 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 ( "HaveCriminalJob", 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 ) end end ) addEventHandler ( "onClientPedDamage", resourceRoot, function () cancelEvent () end ) Link to comment
Price. Posted February 27, 2014 Author Share Posted February 27, 2014 oh nvm its working absolutly great, but uhm just a question this means if there is a Criminal team so it will turn me to Criminal? Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 oh i need to recreate a team add this line to the server side > Criminal = createTeam ( "Criminal", 255, 0, 0 ) Link to comment
Price. Posted February 27, 2014 Author Share Posted February 27, 2014 oh nvm its working absolutly great, but uhm just a question this means if there is a Criminal team so it will turn me to Criminal? Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 oh nvm its working absolutly great, but uhm just a question this means if there is a Criminal team so it will turn me to Criminal? Yes, just add the line that i gave to the server side and it will work perfectly, when you press accept you will be at the criminal team, all what you need is to add the team. Link to comment
Price. Posted February 27, 2014 Author Share Posted February 27, 2014 wow this is awesome, thx bro! Link to comment
Hell-Mate Posted February 27, 2014 Share Posted February 27, 2014 wow this is awesome, thx bro! No problem Link to comment
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