duduRastaman Posted March 14, 2014 Share Posted March 14, 2014 (edited) [EDITED] Hi guys. its been 3 weeks that i started learnin to script at mta wiki, soo i practically did a small postman job. Almost everything is workin fine but the big problem is when i hit the marker, nothing happens . i tried to look for the problem with debugscript 3, but no errors wheni click the accept button, i get on the vehicle, and i can see the marker to go. but when i go there, and when i hit the marker, i dont get the money:(((( nothin happens heres the code client.lua : postMarker = createMarker(1961.960,-1674.148,15, "cylinder", 1.0,0,125,0,50) createBlipAttachedTo(postMarker, 41) local locations = { { 571, -1307, 17 }, { 1001, -1043, 30 }, { 942, -1817, 12 }, { 1224, -1826, 13 }, { 1777, -1885, 13 } } function postmanGui () postWindow = guiCreateWindow(0.325,0.325,0.35,0.25, "Postman job \"{SMILIES_PATH}/icon_biggrin.gif\" alt=\"\" title=\"Very Happy\" /> ", true) btnAccept = guiCreateButton(0.415,0.7,0.25,0.2, "Accept",true, postWindow) addEventHandler("onClientGUIClick",btnAccept,postAccept) btnReject = guiCreateButton(0.715,0.7,0.25,0.2, "Reject", true, postWindow) addEventHandler("onClientGUIClick",btnReject,postReject) guiSetVisible(postWindow, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () postmanGui () end ) function markerhit(thePlayer, matchingDimension) if ( thePlayer == getLocalPlayer() ) then guiSetVisible(postWindow, true) showCursor(true) end end addEventHandler("onClientMarkerHit", postMarker, markerhit) function postReject () guiSetVisible(postWindow, false) showCursor(false) end addEvent("acceptDaJob", true) addEventHandler("acceptDaJob",root,postReject) function postAccept (thePlayer) triggerServerEvent("givePostJob", getLocalPlayer(), getLocalPlayer() ) end function showmarker (thePlayer) if (thePlayer == getLocalPlayer() ) then local randomNumber = math.random(#locations) daMarker = createMarker(locations [randomNumber] [1], locations [randomNumber] [2], locations [randomNumber] [3], "cylinder", 2, 255,0,0) daBlip = createBlipAttachedTo( daMarker, 41) addEventHandler("OnClientMarkerHit", daMarker, hitDaMarker) end end addEvent("startingJob", true) addEventHandler("startingJob",root,showmarker) function hitDaMarker (hitElement) if (hitElement == getLocalPlayer() ) then triggerServerEvent("playamarker", hitElement, hitElement) end end function destroydamarker (thePlayer) if (thePlayer == getLocalPlayer()) then if (isElement(daMarker)) then destroyElement(daMarker) destroyElement(daBlip) end end end addEvent("destroymarker",true) addEventHandler("destroymarker",root, destroydamarker) server.lua : local allowedVehicles = { [586] = true } function myjob (thePlayer) local postVehicle = createVehicle(586, 1948.318, -1674.251,13.546) warpPedIntoVehicle(thePlayer, postVehicle) triggerClientEvent("acceptDaJob",thePlayer, thePlayer ) triggerClientEvent("startingJob", thePlayer, thePlayer) end addEvent("givePostJob", true) addEventHandler("givePostJob", root, myjob) addEvent("playamarker", true) addEventHandler("playamarker",root, function (thePlayer) local vehicle = getPedOccupiedVehicle ( thePlayer ) if ( vehicle ) then if ( allowedVehicles [ getElementModel ( vehicle ) ] ) then if ( thePlayer == getVehicleOccupant ( vehicle, 0 ) ) then givePlayerMoney ( thePlayer, math.random ( 3000, 6000 ) ) end end end end ) everythin is fine in meta. also guys, i tried to learn by using runcodes and its fun, but some function doesnt work ( 1) cancelEvent("onPlayerDamage", duduRastaman)--- this doesnt work, and i get some errors that is hard to understand O_O 2)setElementAlpha(getPlayerFromName("duduRastaman", 0) -- this also doesnt work -- even when i use getPlayerFromNick codin is fun, only when ur code is workin Help me guys Edited March 14, 2014 by Guest Link to comment
Ab-47 Posted March 14, 2014 Share Posted March 14, 2014 (edited) Removed Edited March 14, 2014 by Guest Link to comment
duduRastaman Posted March 14, 2014 Author Share Posted March 14, 2014 thnks bro but still not working. everything is workin fine, only when i hit the marker, nothin happens. i dont get the money (( Link to comment
duduRastaman Posted March 14, 2014 Author Share Posted March 14, 2014 Ab-47, i just edited the post, cause i did not well explain my problem Link to comment
Ab-47 Posted March 14, 2014 Share Posted March 14, 2014 Ab-47, i just edited the post, cause i did not well explain my problem Silly mistakes are always hidden Change line 43: addEventHandler("OnClientMarkerHit", daMarker, hitDaMarker) to this: addEventHandler("onClientMarkerHit", daMarker, hitDaMarker) Your client event has a capial "O" which shouldn't be there xP tested & confirmed that it works Link to comment
duduRastaman Posted March 15, 2014 Author Share Posted March 15, 2014 ABBBBBBB 47 thnk u bro lol that silly mistake. but bro, can u tell me how to use setElementAlpha ingame with runcode, i cant use it idk why my ingame name is duduRastaman and when i type run setElementAlpha(getPlayerFromName("duduRastaman", 0) i get some errors which i cant understand anyway, thnk u very much for ur reply bro Link to comment
DNL291 Posted March 15, 2014 Share Posted March 15, 2014 but bro, can u tell me how to use setElementAlpha ingame with runcode, i cant use it idk why my ingame name is duduRastaman and when i type run setElementAlpha(getPlayerFromName("duduRastaman", 0) i get some errors which i cant understand setElementAlpha(getPlayerFromName("duduRastaman"), 0) Link to comment
duduRastaman Posted March 22, 2014 Author Share Posted March 22, 2014 hey guys sorry for late reply. i tried as far as i can but O_O i think its server problem, lots of runcode dont work!!! shit, but anyway, God bless u all, thnks breddas Be blessed !!! 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