Jump to content

Just showing to one player


BriGhtx3

Recommended Posts

  
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
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 by Guest
Link to comment

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
  
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

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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...