BriGhtx3 Posted October 4, 2011 Share Posted October 4, 2011 local HalteNr2 function cMarker(thePlayer) local money = vioGetElementData(thePlayer, "money") vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) givePlayerMoney(thePlayer, 50) destroyElement(HalteNr1B) destroyElement(HalteNr1) triggerClientEvent ( thePlayer, "Schrott", getRootElement() ) triggerClientEvent ( thePlayer, "N", getRootElement() ) HalteNr2 = createMarker ( -1923, -1785, 32, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) HalteNr2B = createBlip ( -1923, -1785, 32, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) addEventHandler("onMarkerHit", HalteNr2, dMarker) end I want that the markers are just shown to the driver. Also just the driver should get the money. I start the function with : bindKey ( thePlayer, "sub_mission", "down", startJob ) Link to comment
TAPL Posted October 4, 2011 Share Posted October 4, 2011 (edited) local money = vioGetElementData(thePlayer, "money") vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) wtf is this? correct local money = getElementData(thePlayer, "money") setElementData ( thePlayer, "money", tonumber(money)+50 ) bindKey ( thePlayer, "sub_mission", "down", cMarker ) Edited October 4, 2011 by Guest Link to comment
BriGhtx3 Posted October 4, 2011 Author Share Posted October 4, 2011 Nope your code is not correct. I know that it is getElementData, but this is a own function/command! vio... is right! Then bindkey is also correct because it first starts startJob and that executes cMarker. But I think you don't get the question. I asked why it outputs it to all players in the bus. Link to comment
TAPL Posted October 4, 2011 Share Posted October 4, 2011 show the whole code to can help you Link to comment
BriGhtx3 Posted October 4, 2011 Author Share Posted October 4, 2011 function startJob(thePlayer) local pl = getPlayerName(thePlayer) outputChatBox(thePlayer) HalteNr1 = createMarker ( -2435, -595, 132, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) HalteNr1B = createBlip ( -2435, -595, 132, 0, 2, 255, 0, 0, 255, 0, 99999.0,thePlayer ) triggerClientEvent ( thePlayer, "LTR", getRootElement() ) triggerClientEvent (thePlayer, "infobox_start", getRootElement(), "\nDienst gestartet!", 5000, 125, 0, 0 ) addEventHandler("onMarkerHit", HalteNr1, cMarker) unbindKey ( thePlayer, "sub_mission", "down", startJob ) end local HalteNr2 function cMarker(thePlayer) local money = vioGetElementData(thePlayer, "money") vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) givePlayerMoney(thePlayer, 50) destroyElement(HalteNr1B) destroyElement(HalteNr1) triggerClientEvent ( thePlayer, "Schrott", getRootElement() ) triggerClientEvent ( thePlayer, "N", getRootElement() ) HalteNr2 = createMarker ( -1923, -1785, 32, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) HalteNr2B = createBlip ( -1923, -1785, 32, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) addEventHandler("onMarkerHit", HalteNr2, dMarker) end Link to comment
BinSlayer1 Posted October 4, 2011 Share Posted October 4, 2011 because they all go over the marker? if you want to only make it work for the driver , check that thePlayer is vehicle controller with getVehicleController() https://wiki.multitheftauto.com/wiki/Get ... Controller Link to comment
BriGhtx3 Posted October 4, 2011 Author Share Posted October 4, 2011 Bad 'vehicle' pointer : function startJob(thePlayer) controller = getVehicleController ( --[[What do I have to put in?]] ) Edit : Oh ok I got it, I have to put in the vehicle. But I have no variable for the vehicle oO local vehicle = getPlayerOccupiedVehicle( thePlayer ) local controller = getVehicleController ( vehicle ) Is that right? Cause when I output it it says "Bad argument at outputChatBox" Link to comment
BinSlayer1 Posted October 4, 2011 Share Posted October 4, 2011 local HalteNr2 function cMarker(hitElement) if getElementType(hitElement) ~= "vehicle" then return end local thePlayer = getVehicleController(hitElement) local money = vioGetElementData(thePlayer, "money") vioSetElementData ( thePlayer, "money", tonumber(money)+50 ) givePlayerMoney(thePlayer, 50) destroyElement(HalteNr1B) destroyElement(HalteNr1) triggerClientEvent ( thePlayer, "Schrott", getRootElement() ) triggerClientEvent ( thePlayer, "N", getRootElement() ) HalteNr2 = createMarker ( -1923, -1785, 32, "checkpoint", 10, 125, 0, 0, 255, thePlayer ) HalteNr2B = createBlip ( -1923, -1785, 32, 0, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ) addEventHandler("onMarkerHit", HalteNr2, dMarker) end PS: I took the code from the first post and edited it. I don't know if there were any previous edits, check that out yourself 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