tosfera Posted February 17, 2013 Share Posted February 17, 2013 Hey, Okee so I'll ask one more question. And that will be it!! ( I hope), I wrote this script, it will give you a job, a truck + a trailer. it will create a marker and blip CLIENT SIDED. BUT! When I start the job, and a friend of me starts it to, only one of us can finish it. :\ I tought that client was only for 1 player, and not for everyone... So, here's the script: addEvent("startJob_trucker", true) addEventHandler("startJob_trucker", root, function (source) --local places = { {"2754", "-2455", "13"}, {"364", "-2026", "7"} } local places = { {"2405","-2093","13"} } local randJob = math.random(1, 1) finishTrucker = createMarker(places[randJob][1], places[randJob][2], places[randJob][3], "cylinder", 2, 255, 0, 0, 150) blipTrucker = createBlip(places[randJob][1], places[randJob][2], places[randJob][3], 41) outputChatBox(places[randJob][1]) if finish then errorMsg("Deliver this delivery quick!") end end ) addEventHandler("onClientMarkerHit", root, function (hitPlayer) if source == finishTrucker then local v = getPedOccupiedVehicle(hitPlayer) if v then local model = getElementModel(v) local team = getPlayerTeam(hitPlayer) if model == 515 and team then local teamName = getTeamName(team) if teamName == "Trucker" then destroyElement(finishTrucker) destroyElement(blipTrucker) triggerServerEvent("jobFinish_trucker", getLocalPlayer(), hitPlayer, v) end end end end end ) Link to comment
Shazzimal Posted February 17, 2013 Share Posted February 17, 2013 What is server-side you made? Link to comment
tosfera Posted February 17, 2013 Author Share Posted February 17, 2013 Let me get the parts that you need; resource start (crap) addEventHandler("onResourceStart", root, function () Trucker = createTeam ( "Trucker", 255, 234, 0 ) end ) ] okee, when he enters the marker, it all starts here: addEventHandler("onMarkerHit", jobMarker_trucker1, function ( source, hitPlayer ) if getElementType( source ) == "player" then local isTeam = getPlayerTeam( source ) if isTeam then local team = getTeamName( getPlayerTeam ( source ) ) if team and team == "Trucker" then local job = getAccountData(getPlayerAccount(source), "player-job") if job == false then triggerClientEvent(source, "startJob_trucker", root) startJob_trucker_marker1() setAccountData(getPlayerAccount(source), "player-job", true) else triggerClientEvent(source, "errorMsg", root, "You are already on a job") end end end end end ) Link to comment
Shazzimal Posted February 17, 2013 Share Posted February 17, 2013 I don't really know what do but firt, try this out? There was an error in the 2nd script you sent. addEventHandler("onMarkerHit", jobMarker_trucker1, function ( source, hitPlayer ) if getElementType( source ) == "player" then local isTeam = getPlayerTeam( source ) if isTeam then local team = getTeamName( getPlayerTeam ( source ) ) if team and team == "Trucker" then local job = getAccountData(getPlayerAccount(source), "player-job") if job == false then triggerClientEvent(source, "startJob_trucker", root) startJob_trucker_marker1() setAccountData(getPlayerAccount(source), "player-job", true) else triggerClientEvent(source, "errorMsg", root, "You are already on a job") end end end end end) Link to comment
tosfera Posted February 17, 2013 Author Share Posted February 17, 2013 I don't really know what do but firt, try this out? There was an error in the 2nd script you sent. addEventHandler("onMarkerHit", jobMarker_trucker1, function ( source, hitPlayer ) if getElementType( source ) == "player" then local isTeam = getPlayerTeam( source ) if isTeam then local team = getTeamName( getPlayerTeam ( source ) ) if team and team == "Trucker" then local job = getAccountData(getPlayerAccount(source), "player-job") if job == false then triggerClientEvent(source, "startJob_trucker", root) startJob_trucker_marker1() setAccountData(getPlayerAccount(source), "player-job", true) else triggerClientEvent(source, "errorMsg", root, "You are already on a job") end end end end end) Nothing changed hahaha, you just replaced my if, and my last bracket. Its just a coding standart. Thats all. ;o Link to comment
Shazzimal Posted February 17, 2013 Share Posted February 17, 2013 changed your if? i didn't. Link to comment
tosfera Posted February 17, 2013 Author Share Posted February 17, 2013 I mean you changed the position of it, not the code it self Link to comment
Shazzimal Posted February 17, 2013 Share Posted February 17, 2013 What i did is, fixed the ends on the end, couse they were not good. Link to comment
tosfera Posted February 17, 2013 Author Share Posted February 17, 2013 Yeah, well. After changing that, it still didn't work. Link to comment
Castillo Posted February 17, 2013 Share Posted February 17, 2013 Try this: addEvent("startJob_trucker", true) addEventHandler("startJob_trucker", root, function (source) --local places = { {"2754", "-2455", "13"}, {"364", "-2026", "7"} } local places = { {"2405","-2093","13"} } local randJob = math.random(1, 1) finishTrucker = createMarker(places[randJob][1], places[randJob][2], places[randJob][3], "cylinder", 2, 255, 0, 0, 150) blipTrucker = createBlip(places[randJob][1], places[randJob][2], places[randJob][3], 41) outputChatBox(places[randJob][1]) if finish then errorMsg("Deliver this delivery quick!") end end ) addEventHandler("onClientMarkerHit", root, function (hitPlayer) if ( source == finishTrucker ) and ( hitPlayer == localPlayer ) then local v = getPedOccupiedVehicle(hitPlayer) if v then local model = getElementModel(v) local team = getPlayerTeam(hitPlayer) if model == 515 and team then local teamName = getTeamName(team) if teamName == "Trucker" then destroyElement(finishTrucker) destroyElement(blipTrucker) triggerServerEvent("jobFinish_trucker", getLocalPlayer(), hitPlayer, v) end end end end end ) Link to comment
Anderl Posted February 17, 2013 Share Posted February 17, 2013 What i did is, fixed the ends on the end, couse they were not good. I don't see any problem with the 'end's. Link to comment
tosfera Posted February 17, 2013 Author Share Posted February 17, 2013 Try this: addEvent("startJob_trucker", true) addEventHandler("startJob_trucker", root, function (source) --local places = { {"2754", "-2455", "13"}, {"364", "-2026", "7"} } local places = { {"2405","-2093","13"} } local randJob = math.random(1, 1) finishTrucker = createMarker(places[randJob][1], places[randJob][2], places[randJob][3], "cylinder", 2, 255, 0, 0, 150) blipTrucker = createBlip(places[randJob][1], places[randJob][2], places[randJob][3], 41) outputChatBox(places[randJob][1]) if finish then errorMsg("Deliver this delivery quick!") end end ) addEventHandler("onClientMarkerHit", root, function (hitPlayer) if ( source == finishTrucker ) and ( hitPlayer == localPlayer ) then local v = getPedOccupiedVehicle(hitPlayer) if v then local model = getElementModel(v) local team = getPlayerTeam(hitPlayer) if model == 515 and team then local teamName = getTeamName(team) if teamName == "Trucker" then destroyElement(finishTrucker) destroyElement(blipTrucker) triggerServerEvent("jobFinish_trucker", getLocalPlayer(), hitPlayer, v) end end end end end ) hmmm I see, this did the trick; if ( source == finishTrucker ) and ( hitPlayer == localPlayer ) then Nothing else is changes, as I see. Thanks! Learned something again Link to comment
Castillo Posted February 17, 2013 Share Posted February 17, 2013 Yes, that's what I added, since "onClientMarkerHit" is triggered by remote players as well. You're welcome. Link to comment
tosfera Posted February 17, 2013 Author Share Posted February 17, 2013 Yes, that's what I added, since "onClientMarkerHit" is triggered by remote players as well.You're welcome. Hmm,, since you're still here. It doesn't destroy the element after 3 times. O_O, like, I'm becoming a trucker, doing 3 runs, and the third time, the markers doens't get destroyed. but I am getting an error, dont know if thats the problem. Bad 'ped' pointer @ getPedOccupiedVehicle He's crying about this part; (server scripts btw) addEventHandler("onMarkerHit", jobMarker_trucker_newTrailer, function ( hitPlayer, source ) local v = getPedOccupiedVehicle( hitPlayer ) if v then local model = getElementModel(v) if model == 515 then if job then triggerClientEvent(hitPlayer, "errorMsg", root, "You still got a delivery to do!") else triggerClientEvent(hitPlayer, "errorMsg", root, "Great work, keep it up!") triggerClientEvent(hitPlayer, "startJob_trucker", root) end end end end ) Link to comment
Castillo Posted February 17, 2013 Share Posted February 17, 2013 Try this: addEventHandler ( "onMarkerHit", jobMarker_trucker_newTrailer, function ( hitPlayer ) if ( getElementType ( hitPlayer ) == "player" ) then local v = getPedOccupiedVehicle ( hitPlayer ) if ( v ) then local model = getElementModel ( v ) if ( model == 515 ) then if ( job ) then triggerClientEvent ( hitPlayer, "errorMsg", root, "You still got a delivery to do!" ) else triggerClientEvent ( hitPlayer, "errorMsg", root, "Great work, keep it up!" ) triggerClientEvent ( hitPlayer, "startJob_trucker", root ) end end end end end ) Link to comment
tosfera Posted February 17, 2013 Author Share Posted February 17, 2013 Try this: addEventHandler ( "onMarkerHit", jobMarker_trucker_newTrailer, function ( hitPlayer ) if ( getElementType ( hitPlayer ) == "player" ) then local v = getPedOccupiedVehicle ( hitPlayer ) if ( v ) then local model = getElementModel ( v ) if ( model == 515 ) then if ( job ) then triggerClientEvent ( hitPlayer, "errorMsg", root, "You still got a delivery to do!" ) else triggerClientEvent ( hitPlayer, "errorMsg", root, "Great work, keep it up!" ) triggerClientEvent ( hitPlayer, "startJob_trucker", root ) end end end end end ) Thanks! You're like,,, god or something. back in the days when we still talked, you were good. But now, FCK ITS INSANE! 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