Jump to content

I don't understand these warnings


Dazee

Recommended Posts

Hello all im new here on the forums and mainly in MTA scripting community im looking to become a professional scripter (i started scripting like 2 days ago) so the problem is i get these warnings

[2014-06-27 23:50:22] WARNING: repairmarker\repmarker.lua:21: Bad argument @ 'getPedOccupiedVehicle' [Expected ped at argument 1, got vehicle] 
[2014-06-27 23:50:22] WARNING: repairmarker\repmarker.lua:22: Bad argument @ 'getPlayerMoney' [Expected player at argument 1, got vehicle] 

The script for markers and everything is :

local repMarker = createMarker(2063.60, -1831.69, 12.5, 'cylinder', 2.0, 255, 0, 0, 150)---Near Grove Street Repair Marker 
local repMarker2 = createMarker(1024.80, -1025.40, 3.29, 'cylinder', 2.0, 255, 0, 0, 150)---Above saints hospital repair marker 
local repMarker3 = createMarker(487.79, -1739.59, 10.10, 'cylinder', 2.0, 255, 0, 0, 150)---Santa Maria Beach Marker 
local repMarker4 = createMarker(2076.30, -2546.80, 12.60, 'cylinder', 2.0, 255, 0, 0, 150)--LS Airport Repair Marker 
local repMarker5 = createMarker(-1262.5, -31.70, 13.19, 'cylinder', 2.0, 255, 0, 0, 150)---SF Airport Repair Marker 
local repMarker6 = createMarker(1523.69, 1720.09, 9.8, 'cylinder', 2.0, 255, 0, 0, 150)---LV Airport Repair Marker 
local repMarker7 = createMarker(2386.5, 1049.80, 9.8, 'cylinder', 2.0, 255, 0, 0, 150)---LV Repair Marker Near Gas Station 
local repMarker8 = createMarker(-1904.59, 283.70, 40, 'cylinder', 2.0, 255, 0, 0, 150)--SF Repair Marker @ Wang Cars 
local repMarker9 = createMarker(-1786.90, 1214.90, 24.10, 'cylinder', 2.0, 255, 0, 0, 150)--SF Repair Marker @ Expensive Car Shop 
local repMarker10 = createMarker(344.60, 2540.5, 15.80, 'cylinder', 2.0, 255, 0, 0, 150)--Abandoned Airport Repair Marker 
local repMarker11 = createMarker(1872.19, -2393.30, 12.60, 'cylinder', 2.0, 255, 0, 0, 150)--LS Airport Repair Marker 2 
  
createBlipAttachedTo(repMarker, 63) 
createBlipAttachedTo(repMarker2, 63) 
createBlipAttachedTo(repMarker3, 63) 
createBlipAttachedTo(repMarker7, 63) 
createBlipAttachedTo(repMarker8, 63) 
createBlipAttachedTo(repMarker9, 63) 
  
 function repairMarker(thePlayer, matchingDimension) 
  local vehicle = getPedOccupiedVehicle ( thePlayer ) 
  local payment = getPlayerMoney ( thePlayer ) 
  if ( not vehicle) then 
        outputChatBox( "You need to be in a vehicle to repair it!" , thePlayer, 255, 0, 0, true ) 
        return 
  end 
  if ( payment >= 100 ) then 
       takePlayerMoney( thePlayer, 100 ) 
       fixVehicle( vehicle ) 
       outputChatBox( "You have repaired your car", thePlayer, 255, 0, 0, true ) 
  else  
       outputChatBox( "You don't have enough money to repair your car", thePlayer, 255, 0, 0, true) 
  end 
  
end 
addEventHandler( "onMarkerHit", repMarker, repairMarker) 
addEventHandler( "onMarkerHit", repMarker2, repairMarker) 
addEventHandler( "onMarkerHit", repMarker3, repairMarker) 
addEventHandler( "onMarkerHit", repMarker4, repairMarker) 
addEventHandler( "onMarkerHit", repMarker5, repairMarker) 
addEventHandler( "onMarkerHit", repMarker6, repairMarker) 
addEventHandler( "onMarkerHit", repMarker7, repairMarker) 
addEventHandler( "onMarkerHit", repMarker8, repairMarker) 
addEventHandler( "onMarkerHit", repMarker9, repairMarker) 
addEventHandler( "onMarkerHit", repMarker10, repairMarker) 
addEventHandler( "onMarkerHit", repMarker11, repairMarker) 

Btw everything seems to work the fixing and taking money but why am i getting these warnings i don't want to get the warnings every time someone enters a repair marker.

Link to comment

try, no tested

local repMarker = createMarker(2063.60, -1831.69, 12.5, 'cylinder', 2.0, 255, 0, 0, 150)---Near Grove Street Repair Marker 
local repMarker2 = createMarker(1024.80, -1025.40, 3.29, 'cylinder', 2.0, 255, 0, 0, 150)---Above saints hospital repair marker 
local repMarker3 = createMarker(487.79, -1739.59, 10.10, 'cylinder', 2.0, 255, 0, 0, 150)---Santa Maria Beach Marker 
local repMarker4 = createMarker(2076.30, -2546.80, 12.60, 'cylinder', 2.0, 255, 0, 0, 150)--LS Airport Repair Marker 
local repMarker5 = createMarker(-1262.5, -31.70, 13.19, 'cylinder', 2.0, 255, 0, 0, 150)---SF Airport Repair Marker 
local repMarker6 = createMarker(1523.69, 1720.09, 9.8, 'cylinder', 2.0, 255, 0, 0, 150)---LV Airport Repair Marker 
local repMarker7 = createMarker(2386.5, 1049.80, 9.8, 'cylinder', 2.0, 255, 0, 0, 150)---LV Repair Marker Near Gas Station 
local repMarker8 = createMarker(-1904.59, 283.70, 40, 'cylinder', 2.0, 255, 0, 0, 150)--SF Repair Marker @ Wang Cars 
local repMarker9 = createMarker(-1786.90, 1214.90, 24.10, 'cylinder', 2.0, 255, 0, 0, 150)--SF Repair Marker @ Expensive Car Shop 
local repMarker10 = createMarker(344.60, 2540.5, 15.80, 'cylinder', 2.0, 255, 0, 0, 150)--Abandoned Airport Repair Marker 
local repMarker11 = createMarker(1872.19, -2393.30, 12.60, 'cylinder', 2.0, 255, 0, 0, 150)--LS Airport Repair Marker 2 
  
createBlipAttachedTo(repMarker, 63) 
createBlipAttachedTo(repMarker2, 63) 
createBlipAttachedTo(repMarker3, 63) 
createBlipAttachedTo(repMarker7, 63) 
createBlipAttachedTo(repMarker8, 63) 
createBlipAttachedTo(repMarker9, 63) 
  
 function repairMarker(thePlayer, matchingDimension) 
 if(source==repMarker) or (source==repMarker2)or (source==repMarker3) or (source==repMarker4) or (source==repMarker5) or (source==repMarker6) or (source==repMarker7) or (source==repMarker8) or (source==repMarker9) or (source==repMarker10) or (source==repMarker11)then 
 local t = getElementType(thePlayer) 
 local vehicle 
 if(t=="vehicle") then 
vehicle = thePlayer 
thePlayer = getVehicleOccupant(thePlayer) 
elseif(t=="player")then 
vehicle = getVehicleOccupant(thePlayer) 
end 
if ( not vehicle) then 
        outputChatBox( "You need to be in a vehicle to repair it!" , thePlayer, 255, 0, 0, true ) 
        return 
end 
local payment = getPlayerMoney ( thePlayer ) 
if ( payment >= 100 ) then 
       takePlayerMoney( thePlayer, 100 ) 
       fixVehicle( vehicle ) 
       outputChatBox( "You have repaired your car", thePlayer, 255, 0, 0, true ) 
  else 
       outputChatBox( "You don't have enough money to repair your car", thePlayer, 255, 0, 0, true) 
  end 
end 
end 
addEventHandler( "onMarkerHit", root, repairMarker) 

Link to comment

It repairs the vehicle but it shows that "you need to be in a vehicle to repair" and "the vehicle has been repaired" at the same time :lol::lol::lol::lol:

[2014-06-28 01:11:48] WARNING: repairmarker\repmarker.lua:28: Bad argument @ 'getVehicleOccupant' [Expected vehicle at argument 1, got player] 
  

I don't understand this part:

local t = getElementType(thePlayer) 
 local vehicle 
 if(t=="vehicle") then 
 vehicle = thePlayer 
 thePlayer = getVehicleOccupant(thePlayer) 
 elseif(t=="player")then 
 vehicle = getVehicleOccupant(thePlayer) 
 end 

Link to comment

He's been scripting for 2 days and can already make smaller mistakes than what you can. Don't judge this guy, even if he's better.

LOL? Checking if player type is vehicle?? hehehe
  
     local t = getPedOccupiedVehicle( thePlayer ) 
     if t then 
      vehicle = getVehicleOccupant( thePlayer ) 
     end 
  

As for Dazee, long live KLM.

Regards, KLM-RC|csmit195#M

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