Jump to content

help in truker mission


Recommended Posts

hi guys i m make this script for rpg server the palyer can have the truker job and make money withe it but when i test the mod is not woork idk why this is the lua any help ???

truckercolsphere = createColSphere ( 2360.6616210938, 2774.1604003906, 9.8703269958496, 5 ) 
truckerjobmarker = createMarker ( 2360.6616210938, 2774.1604003906, 9.8703269958496, "cylinder", 2, 0, 0, 255 ) 
createBlip ( 2360.6616210938, 2774.1604003906, 9.8703269958496, 51 ) 
  
  
function truckerStart ( thePlayer ) 
        if ( player ) then 
            local dim = math.random ( 1, 50000 ) 
            local finish = math.random ( 1, 3 ) 
            local truckerid = "Trucker" .. tostring ( dim ) 
            local finishid = "Finish" .. tostring ( dim ) 
            setElementData ( thePlayer, "TruckID", tostring ( dim ) ) 
            setElementID ( createVehicle ( 515, 2367.9216308594, 2754.8811035156, 12.500002861023, 0, 0, 180.75, "Truck" ), truckerid ) 
            setElementDimension ( getElementByID ( truckerid ), dim ) 
            setElementDimension ( thePlayer, dim ) 
            warpPedIntoVehicle ( thePlayer, getElementByID ( truckerid ), 0 ) 
                if ( finish == 1 ) then 
                    setElementID ( createMarker ( 2293.8217773438, 91.259262084961, 26.3359375, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( 2293.8217773438, 91.259262084961, 26.3359375, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                elseif ( finish == 2 ) then 
                    setElementID ( createMarker ( 365.3349609375, 2541.84765625, 16.598960876465, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( 365.3349609375, 2541.84765625, 16.598960876465, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                elseif ( finish == 3 ) then 
                    setElementID ( createMarker ( -2264.2666015625, 2304.548828125, 5.5566072463989, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( -2264.2666015625, 2304.548828125, 5.5566072463989, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                end 
                setElementDimension ( getElementByID ( "blip" .. tostring ( dim ) ), dim ) 
            setElementData ( thePlayer, "onTruck", 1 ) 
            outputChatBox ( "Deliver a charge from the destination!", thePlayer ) 
            setVehicleEngineState ( getElementByID ( truckerid ), true ) 
        else 
            outputChatBox ( "You are not truck drivers!", thePlayer ) 
        end 
    end 
end 
addCommandHandler ( "truckerstart", truckerStart ) 
  
function finishTrucker ( hitPlayer, matchingDimension ) 
if ( source == getElementByID ( "Finish" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) then 
    if ( getElementData ( hitPlayer, "onTruck" ) == 1 ) then 
        outputChatBox ( "We have earned $ 500 to deliver the payload successfully", hitPlayer ) 
        removePedFromVehicle ( hitPlayer ) 
        destroyElement ( source ) 
        destroyElement ( getElementByID ( "blip" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) 
        givePlayerMoney ( hitPlayer, 3000 ) 
        setElementData ( hitPlayer, "onTruck", 0 ) 
        setElementDimension ( hitPlayer, 0 ) 
        setElementPosition ( hitPlayer, 2361.109375, 2778.4375, 10.8203125 ) 
        setPedRotation ( hitPlayer, 90 ) 
    end 
end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), finishTrucker ) 
  
function truckerjobhelp ( hitPlayer, matchingDimension ) 
local playeraccount = getPlayerAccount ( hitPlayer ) 
local playerjob = getAccountData ( playeraccount, "job" ) 
    if ( playerjob == 3 ) then 
        outputChatBox ( "Tip /truckerstart to get a job!", hitPlayer ) 
    elseif ( playerjob == 0 ) then 
        outputChatBox ( "Type / job to work as truck drivers!", hitPlayer ) 
    else 
        outputChatBox ( "You already have another job!", hitPlayer ) 
    end 
end 
addEventHandler ( "onColShapeHit", truckercolsphere, truckerjobhelp ) 
  
function truckerfahrer(player,command) 
    local playeraccount = getPlayerAccount( player ) 
    if getAccountData ( playeraccount, "job" ) ~= 0 then 
        outputChatBox("Du hast bereits einen Job!", player, 255,0,0) 
    else 
        if ( isElementWithinColShape ( player, truckercolsphere ) ) then 
            if ( getAccountData ( playeraccount, "lica" ) == 1 ) then 
                setAccountData(playeraccount, "job", 3) 
                outputChatBox("You are now truck drivers", player,0,255,0) 
            else 
                outputChatBox("You need Class A License", player, 255, 0, 0 ) 
            end 
        end 
    end 
end 
addCommandHandler("job", truckerfahrer) 
  
function onTruckCancelExit ( thePlayer ) 
    if ( getElementData ( thePlayer, "onTruck" ) ~= false ) then 
        if ( getElementData ( thePlayer, "onTruck" ) == 1 ) then 
            cancelEvent() 
            outputChatBox ( "You can not leave the truck so easy!", thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onVehicleStartExit", getRootElement(), onTruckCancelExit ) 

i hop you will help me and thx

Link to comment

truckercolsphere = createColSphere ( 2360.6616210938, 2774.1604003906, 9.8703269958496, 5 ) 
truckerjobmarker = createMarker ( 2360.6616210938, 2774.1604003906, 9.8703269958496, "cylinder", 2, 0, 0, 255 ) 
createBlip ( 2360.6616210938, 2774.1604003906, 9.8703269958496, 51 ) 
  
  
function truckerStart ( thePlayer ) 
        if ( player ) then 
            local dim = math.random ( 1, 50000 ) 
            local finish = math.random ( 1, 3 ) 
            local truckerid = "Trucker" .. tostring ( dim ) 
            local finishid = "Finish" .. tostring ( dim ) 
            setElementData ( thePlayer, "TruckID", tostring ( dim ) ) 
            setElementID ( createVehicle ( 515, 2367.9216308594, 2754.8811035156, 12.500002861023, 0, 0, 180.75, "Truck" ), truckerid ) 
            setElementDimension ( getElementByID ( truckerid ), dim ) 
            setElementDimension ( thePlayer, dim ) 
            warpPedIntoVehicle ( thePlayer, getElementByID ( truckerid ), 0 ) 
                if ( finish == 1 ) then 
                    setElementID ( createMarker ( 2293.8217773438, 91.259262084961, 26.3359375, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( 2293.8217773438, 91.259262084961, 26.3359375, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                elseif ( finish == 2 ) then 
                    setElementID ( createMarker ( 365.3349609375, 2541.84765625, 16.598960876465, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( 365.3349609375, 2541.84765625, 16.598960876465, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                elseif ( finish == 3 ) then 
                    setElementID ( createMarker ( -2264.2666015625, 2304.548828125, 5.5566072463989, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( -2264.2666015625, 2304.548828125, 5.5566072463989, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                end 
                setElementDimension ( getElementByID ( "blip" .. tostring ( dim ) ), dim ) 
            setElementData ( thePlayer, "onTruck", 1 ) 
            outputChatBox ( "Deliver a charge from the destination!", thePlayer ) 
            setVehicleEngineState ( getElementByID ( truckerid ), true ) 
        else 
            outputChatBox ( "You are not truck drivers!", thePlayer ) 
        end 
    end 
addCommandHandler ( "truckerstart", truckerStart ) 
  
function finishTrucker ( hitPlayer, matchingDimension ) 
if ( source == getElementByID ( "Finish" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) then 
    if ( getElementData ( hitPlayer, "onTruck" ) == 1 ) then 
        outputChatBox ( "We have earned $ 500 to deliver the payload successfully", hitPlayer ) 
        removePedFromVehicle ( hitPlayer ) 
        destroyElement ( source ) 
        destroyElement ( getElementByID ( "blip" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) 
        givePlayerMoney ( hitPlayer, 3000 ) 
        setElementData ( hitPlayer, "onTruck", 0 ) 
        setElementDimension ( hitPlayer, 0 ) 
        setElementPosition ( hitPlayer, 2361.109375, 2778.4375, 10.8203125 ) 
        setPedRotation ( hitPlayer, 90 ) 
    end 
end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), finishTrucker ) 
  
function truckerjobhelp ( hitPlayer, matchingDimension ) 
local playeraccount = getPlayerAccount ( hitPlayer ) 
local playerjob = getAccountData ( playeraccount, "job" ) 
    if ( playerjob == 3 ) then 
        outputChatBox ( "Tip /truckerstart to get a job!", hitPlayer ) 
    elseif ( playerjob == 0 ) then 
        outputChatBox ( "Type / job to work as truck drivers!", hitPlayer ) 
    else 
        outputChatBox ( "You already have another job!", hitPlayer ) 
    end 
end 
addEventHandler ( "onColShapeHit", truckercolsphere, truckerjobhelp ) 
  
function truckerfahrer(player,command) 
    local playeraccount = getPlayerAccount( player ) 
    if getAccountData ( playeraccount, "job" ) ~= 0 then 
        outputChatBox("Du hast bereits einen Job!", player, 255,0,0) 
    else 
        if ( isElementWithinColShape ( player, truckercolsphere ) ) then 
            if ( getAccountData ( playeraccount, "lica" ) == 1 ) then 
                setAccountData(playeraccount, "job", 3) 
                outputChatBox("You are now truck drivers", player,0,255,0) 
            else 
                outputChatBox("You need Class A License", player, 255, 0, 0 ) 
            end 
        end 
    end 
end 
addCommandHandler("job", truckerfahrer) 
  
function onTruckCancelExit ( thePlayer ) 
    if ( getElementData ( thePlayer, "onTruck" ) ~= false ) then 
        if ( getElementData ( thePlayer, "onTruck" ) == 1 ) then 
            cancelEvent() 
            outputChatBox ( "You can not leave the truck so easy!", thePlayer ) 
        end 
    end 
addEventHandler ( "onVehicleStartExit", getRootElement(), onTruckCancelExit ) 
Link to comment
truckercolsphere = createColSphere ( 2360.6616210938, 2774.1604003906, 9.8703269958496, 5 ) 
truckerjobmarker = createMarker ( 2360.6616210938, 2774.1604003906, 9.8703269958496, "cylinder", 2, 0, 0, 255 ) 
createBlip ( 2360.6616210938, 2774.1604003906, 9.8703269958496, 51 ) 
  
  
function truckerStart ( thePlayer ) 
        if ( player ) then 
            local dim = math.random ( 1, 50000 ) 
            local finish = math.random ( 1, 3 ) 
            local truckerid = "Trucker" .. tostring ( dim ) 
            local finishid = "Finish" .. tostring ( dim ) 
            setElementData ( thePlayer, "TruckID", tostring ( dim ) ) 
            setElementID ( createVehicle ( 515, 2367.9216308594, 2754.8811035156, 12.500002861023, 0, 0, 180.75, "Truck" ), truckerid ) 
            setElementDimension ( getElementByID ( truckerid ), dim ) 
            setElementDimension ( thePlayer, dim ) 
            warpPedIntoVehicle ( thePlayer, getElementByID ( truckerid ), 0 ) 
                if ( finish == 1 ) then 
                    setElementID ( createMarker ( 2293.8217773438, 91.259262084961, 26.3359375, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( 2293.8217773438, 91.259262084961, 26.3359375, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                elseif ( finish == 2 ) then 
                    setElementID ( createMarker ( 365.3349609375, 2541.84765625, 16.598960876465, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( 365.3349609375, 2541.84765625, 16.598960876465, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                elseif ( finish == 3 ) then 
                    setElementID ( createMarker ( -2264.2666015625, 2304.548828125, 5.5566072463989, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( -2264.2666015625, 2304.548828125, 5.5566072463989, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                end 
                setElementDimension ( getElementByID ( "blip" .. tostring ( dim ) ), dim ) 
            setElementData ( thePlayer, "onTruck", 1 ) 
            outputChatBox ( "Deliver a charge from the destination!", thePlayer ) 
            setVehicleEngineState ( getElementByID ( truckerid ), true ) 
        else 
            outputChatBox ( "You are not truck drivers!", thePlayer ) 
        end 
    end 
addCommandHandler ( "truckerstart", truckerStart ) 
  
function finishTrucker ( hitPlayer, matchingDimension ) 
if ( source == getElementByID ( "Finish" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) then 
    if ( getElementData ( hitPlayer, "onTruck" ) == 1 ) then 
        outputChatBox ( "We have earned $ 500 to deliver the payload successfully", hitPlayer ) 
        removePedFromVehicle ( hitPlayer ) 
        destroyElement ( source ) 
        destroyElement ( getElementByID ( "blip" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) 
        givePlayerMoney ( hitPlayer, 3000 ) 
        setElementData ( hitPlayer, "onTruck", 0 ) 
        setElementDimension ( hitPlayer, 0 ) 
        setElementPosition ( hitPlayer, 2361.109375, 2778.4375, 10.8203125 ) 
        setPedRotation ( hitPlayer, 90 ) 
    end 
end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), finishTrucker ) 
  
function truckerjobhelp ( hitPlayer, matchingDimension ) 
local playeraccount = getPlayerAccount ( hitPlayer ) 
local playerjob = getAccountData ( playeraccount, "job" ) 
    if ( playerjob == 3 ) then 
        outputChatBox ( "Tip /truckerstart to get a job!", hitPlayer ) 
    elseif ( playerjob == 0 ) then 
        outputChatBox ( "Type / job to work as truck drivers!", hitPlayer ) 
    else 
        outputChatBox ( "You already have another job!", hitPlayer ) 
    end 
end 
addEventHandler ( "onColShapeHit", truckercolsphere, truckerjobhelp ) 
  
function truckerfahrer(player,command) 
    local playeraccount = getPlayerAccount( player ) 
    if getAccountData ( playeraccount, "job" ) ~= 0 then 
        outputChatBox("Du hast bereits einen Job!", player, 255,0,0) 
    else 
        if ( isElementWithinColShape ( player, truckercolsphere ) ) then 
            if ( getAccountData ( playeraccount, "lica" ) == 1 ) then 
                setAccountData(playeraccount, "job", 3) 
                outputChatBox("You are now truck drivers", player,0,255,0) 
            else 
                outputChatBox("You need Class A License", player, 255, 0, 0 ) 
            end 
        end 
    end 
end 
addCommandHandler("job", truckerfahrer) 
  
function onTruckCancelExit ( thePlayer ) 
    if ( getElementData ( thePlayer, "onTruck" ) ~= false ) then 
        if ( getElementData ( thePlayer, "onTruck" ) == 1 ) then 
            cancelEvent() 
            outputChatBox ( "You can not leave the truck so easy!", thePlayer ) 
        end 
    end 
addEventHandler ( "onVehicleStartExit", getRootElement(), onTruckCancelExit ) 

Will let's start with the first error !

At line '7' where is the 'player' defined at?

Link to comment
truckercolsphere = createColSphere ( 2360.6616210938, 2774.1604003906, 9.8703269958496, 5 ) 
truckerjobmarker = createMarker ( 2360.6616210938, 2774.1604003906, 9.8703269958496, "cylinder", 2, 0, 0, 255 ) 
createBlip ( 2360.6616210938, 2774.1604003906, 9.8703269958496, 51 ) 
  
function truckerStart ( thePlayer ) 
local playeraccount = getPlayerAccount ( thePlayer ) 
        if ( player ) then 
            local dim = math.random ( 1, 50000 ) 
            local finish = math.random ( 1, 3 ) 
            local truckerid = "Trucker" .. tostring ( dim ) 
            local finishid = "Finish" .. tostring ( dim ) 
            setElementData ( thePlayer, "TruckID", tostring ( dim ) ) 
            setElementID ( createVehicle ( 515, 2367.9216308594, 2754.8811035156, 12.500002861023, 0, 0, 180.75, "Truck" ), truckerid ) 
            setElementDimension ( getElementByID ( truckerid ), dim ) 
            setElementDimension ( thePlayer, dim ) 
            warpPedIntoVehicle ( thePlayer, getElementByID ( truckerid ), 0 ) 
                if ( finish == 1 ) then 
                    setElementID ( createMarker ( 2293.8217773438, 91.259262084961, 26.3359375, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( 2293.8217773438, 91.259262084961, 26.3359375, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                elseif ( finish == 2 ) then 
                    setElementID ( createMarker ( 365.3349609375, 2541.84765625, 16.598960876465, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( 365.3349609375, 2541.84765625, 16.598960876465, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                elseif ( finish == 3 ) then 
                    setElementID ( createMarker ( -2264.2666015625, 2304.548828125, 5.5566072463989, "checkpoint", 10, 255, 0, 0, 255, thePlayer ), finishid ) 
                    setElementDimension ( getElementByID ( finishid ), dim ) 
                    setElementID ( createBlip ( -2264.2666015625, 2304.548828125, 5.5566072463989, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer ), "blip" .. tostring ( dim ) ) 
                end 
                setElementDimension ( getElementByID ( "blip" .. tostring ( dim ) ), dim ) 
            setElementData ( thePlayer, "onTruck", 1 ) 
            outputChatBox ( "Deliver a charge from the destination!", thePlayer ) 
            setVehicleEngineState ( getElementByID ( truckerid ), true ) 
        else 
            outputChatBox ( "You are not truck drivers!", thePlayer ) 
        end 
    end 
end 
addCommandHandler ( "truckerstart", truckerStart ) 
  
function finishTrucker ( hitPlayer, matchingDimension ) 
if ( source == getElementByID ( "Finish" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) then 
    if ( getElementData ( hitPlayer, "onTruck" ) == 1 ) then 
        outputChatBox ( "We have earned $ 500 to deliver the payload successfully", hitPlayer ) 
        removePedFromVehicle ( hitPlayer ) 
        destroyElement ( source ) 
        destroyElement ( getElementByID ( "blip" .. tostring ( getElementDimension ( hitPlayer ) ) ) ) 
        givePlayerMoney ( hitPlayer, 3000 ) 
        setElementData ( hitPlayer, "onTruck", 0 ) 
        setElementDimension ( hitPlayer, 0 ) 
        setElementPosition ( hitPlayer, 2361.109375, 2778.4375, 10.8203125 ) 
        setPedRotation ( hitPlayer, 90 ) 
    end 
end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), finishTrucker ) 
  
function truckerjobhelp ( hitPlayer, matchingDimension ) 
local playeraccount = getPlayerAccount ( hitPlayer ) 
local playerjob = getAccountData ( playeraccount, "job" ) 
    if ( playerjob == 3 ) then 
        outputChatBox ( "Tip /truckerstart to get a job!", hitPlayer ) 
    elseif ( playerjob == 0 ) then 
        outputChatBox ( "Type / job to work as truck drivers!", hitPlayer ) 
    else 
        outputChatBox ( "You already have another job!", hitPlayer ) 
    end 
end 
addEventHandler ( "onColShapeHit", truckercolsphere, truckerjobhelp ) 
  
function truckerfahrer(player,command) 
    local playeraccount = getPlayerAccount( player ) 
    if getAccountData ( playeraccount, "job" ) ~= 0 then 
        outputChatBox("Du hast bereits einen Job!", player, 255,0,0) 
    else 
        if ( isElementWithinColShape ( player, truckercolsphere ) ) then 
            if ( getAccountData ( playeraccount, "lica" ) == 1 ) then 
                setAccountData(playeraccount, "job", 3) 
                outputChatBox("You are now truck drivers", player,0,255,0) 
            else 
                outputChatBox("You need Class A License", player, 255, 0, 0 ) 
            end 
        end 
    end 
end 
addCommandHandler("job", truckerfahrer) 
  
function onTruckCancelExit ( thePlayer ) 
    if ( getElementData ( thePlayer, "onTruck" ) ~= false ) then 
        if ( getElementData ( thePlayer, "onTruck" ) == 1 ) then 
            cancelEvent() 
            outputChatBox ( "You can not leave the truck so easy!", thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onVehicleStartExit", getRootElement(), onTruckCancelExit ) 

like this and naw wher is the others errors plz prestege teel me i m need to finish this pzl bro

Link to comment
Lol! You are telling me you fix the errors?Lol! ? The player is not defined and you telling me you fix the errors just go away !

I'm mean : i'm don't go to defined anything.

ye is for me i was make as a lote of time but is not woork and i think to add her to know wher is the problem and learned frome it and dont make it agine but no help :(

What the problem now?

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