Jump to content

PNS


Atton

Recommended Posts

I was working on a bit of code for a pay and spray there seems to be having some issues.

I keep getting bad arguments on these.

  
local vehicle = getPedOccupiedVehicle(thePlayer) 
local money = getPlayerMoney(thePlayer) 
  

  
 --pasMarkersT [Table removed to keep things easy] 
  
  
  
function Markers () 
    for a,b in pairs(pasMarkersT) do 
        PAS = createMarker(b["x"], b["y"], b["z"]-1,"cylinder",5) 
        createBlip(b["x"], b["y"], b["z"]-1,63)  
         addEventHandler("onMarkerHit",PAS,Logic)        
    end 
end 
setTimer(Markers,50,1) 
  
price = 100 
function Logic (hitElement, matchingDimension,thePlayer) 
local vehicle = getPedOccupiedVehicle(thePlayer) 
local money = getPlayerMoney(thePlayer) 
local elementType = getElementType(hitElement) 
  
    if (elementType == "vehicle") then 
        if (money >= price) then 
            if getElementHealth(vehicle) < 1000 then 
                takePlayerMoney(player, price) 
                    fixVehicle(vehicle) 
                        outputChatBox("Thank you for using pay and spray have a nice day.",plr,0,255,0) 
      else  
      outputChatBox("Get Lost!",player,255,0,0)  
            end 
        end 
    end 
end 
  

Link to comment
--pasMarkersT [Table removed to keep things easy] 
  
function Markers() 
    for a,b in pairs(pasMarkersT) do 
        PAS = createMarker(b["x"], b["y"], b["z"]-1,"cylinder",5) 
        createBlip(b["x"], b["y"], b["z"]-1,63)  
        addEventHandler("onMarkerHit",PAS,Logic)       
    end 
end 
setTimer(Markers,50,1) 
  
function Logic(hitElement) 
    if getElementType(hitElement) == "vehicle" then 
        local player = getVehicleController(hitElement) 
        if player and getPlayerMoney(player) >= 100 then 
            if getElementHealth(hitElement) < 1000 then 
                takePlayerMoney(player, 100) 
                fixVehicle(hitElement) 
                outputChatBox("Thank you for using pay and spray have a nice day.", player, 0, 255, 0) 
            else 
                outputChatBox("Get Lost!", player, 255, 0, 0)  
            end 
        end 
    end 
end 

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