FSXTim Posted May 2, 2012 Posted May 2, 2012 Hello, I'm having some problems with this script. Console: ...lua:10: Bad argument @ getPedOccupiedVehicle function destroy10 ( player ) removeEventHandler( "onMarkerHit", Marker10, destroy10 ) destroyElement( Marker10 ) checkVehicle () Marker2 = createMarker ( 1728.5, -6244.6000976563, 149.30000610352, "cylinder", 2.5, 150, 10, 10, 125 ) addEventHandler( "onMarkerHit", Marker2, destroy2 ) end function checkVehicle () local vehicle = getPedOccupiedVehicle ( player ) local id = math.random( 400, 611 ) if id == 430 or id == 435 or id == 450 or id == 591 or id == 606 or id == 607 or id == 610 or id == 584 or id == 608 then setElementModel ( vehicle, 480 ) if id == 611 or id == 592 or id == 577 or id == 511 or id == 512 or id == 553 or id == 593 or id == 519 or id == 460 or id == 513 then setElementModel ( vehicle, 517 ) if id == 548 or id == 417 or id == 563 or id == 477 or id == 478 or id == 472 or id == 473 or id == 493 or id == 595 or id == 484 then setElementModel ( vehicle, 600 ) if id == 453 or id == 552 or id == 446 or id == 454 or id == 539 or id == 538 or id == 537 or id == 590 or id == 569 or id == 570 then setElementModel ( vehicle, 547 ) if id == 449 or id == 441 or id == 464 or id == 594 or id == 501 or id == 564 or id == 465 then setElementModel ( vehicle, 567 ) end end end end end end Can anybody help me?
Castillo Posted May 2, 2012 Posted May 2, 2012 You forgot to define and pass the "player" argument. function destroy10 ( player ) removeEventHandler ( "onMarkerHit", Marker10, destroy10 ) destroyElement ( Marker10 ) checkVehicle ( player ) Marker2 = createMarker ( 1728.5, -6244.6000976563, 149.30000610352, "cylinder", 2.5, 150, 10, 10, 125 ) addEventHandler ( "onMarkerHit", Marker2, destroy2 ) end function checkVehicle ( player ) local vehicle = getPedOccupiedVehicle ( player ) local id = math.random( 400, 611 ) if id == 430 or id == 435 or id == 450 or id == 591 or id == 606 or id == 607 or id == 610 or id == 584 or id == 608 then setElementModel ( vehicle, 480 ) if id == 611 or id == 592 or id == 577 or id == 511 or id == 512 or id == 553 or id == 593 or id == 519 or id == 460 or id == 513 then setElementModel ( vehicle, 517 ) if id == 548 or id == 417 or id == 563 or id == 477 or id == 478 or id == 472 or id == 473 or id == 493 or id == 595 or id == 484 then setElementModel ( vehicle, 600 ) if id == 453 or id == 552 or id == 446 or id == 454 or id == 539 or id == 538 or id == 537 or id == 590 or id == 569 or id == 570 then setElementModel ( vehicle, 547 ) if id == 449 or id == 441 or id == 464 or id == 594 or id == 501 or id == 564 or id == 465 then setElementModel ( vehicle, 567 ) end end end end end end San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Smart. Posted May 2, 2012 Posted May 2, 2012 I would suggest looking into tables as all those or id == is a mindfuck lol
Castillo Posted May 2, 2012 Posted May 2, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
FSXTim Posted May 2, 2012 Author Posted May 2, 2012 Is that correct? It's still not working! function destroy10 ( player ) removeEventHandler( "onMarkerHit", Marker10, destroy10 ) destroyElement( Marker10 ) checkVehicle ( player ) Marker2 = createMarker ( 1728.5, -6244.6000976563, 149.30000610352, "cylinder", 2.5, 150, 10, 10, 125 ) addEventHandler( "onMarkerHit", Marker2, destroy2 ) end function checkVehicle ( player ) local vehicle = getPedOccupiedVehicle ( player ) local id = math.random( 400, 611 ) if id == 430 or id == 435 or id == 450 or id == 591 or id == 606 or id == 607 or id == 610 or id == 584 or id == 608 then setElementModel ( vehicle, 480 ) if id == 611 or id == 592 or id == 577 or id == 511 or id == 512 or id == 553 or id == 593 or id == 519 or id == 460 or id == 513 then setElementModel ( vehicle, 517 ) if id == 548 or id == 417 or id == 563 or id == 477 or id == 478 or id == 472 or id == 473 or id == 493 or id == 595 or id == 484 then setElementModel ( vehicle, 600 ) if id == 453 or id == 552 or id == 446 or id == 454 or id == 539 or id == 538 or id == 537 or id == 590 or id == 569 or id == 570 then setElementModel ( vehicle, 547 ) if id == 449 or id == 441 or id == 464 or id == 594 or id == 501 or id == 564 or id == 465 then setElementModel ( vehicle, 567 ) end end end end end end
TAPL Posted May 2, 2012 Posted May 2, 2012 Is that correct? It's still not working! function destroy10 ( player ) removeEventHandler( "onMarkerHit", Marker10, destroy10 ) destroyElement( Marker10 ) checkVehicle ( player ) Marker2 = createMarker ( 1728.5, -6244.6000976563, 149.30000610352, "cylinder", 2.5, 150, 10, 10, 125 ) addEventHandler( "onMarkerHit", Marker2, destroy2 ) end function checkVehicle ( player ) local vehicle = getPedOccupiedVehicle ( player ) local id = math.random( 400, 611 ) if id == 430 or id == 435 or id == 450 or id == 591 or id == 606 or id == 607 or id == 610 or id == 584 or id == 608 then setElementModel ( vehicle, 480 ) if id == 611 or id == 592 or id == 577 or id == 511 or id == 512 or id == 553 or id == 593 or id == 519 or id == 460 or id == 513 then setElementModel ( vehicle, 517 ) if id == 548 or id == 417 or id == 563 or id == 477 or id == 478 or id == 472 or id == 473 or id == 493 or id == 595 or id == 484 then setElementModel ( vehicle, 600 ) if id == 453 or id == 552 or id == 446 or id == 454 or id == 539 or id == 538 or id == 537 or id == 590 or id == 569 or id == 570 then setElementModel ( vehicle, 547 ) if id == 449 or id == 441 or id == 464 or id == 594 or id == 501 or id == 564 or id == 465 then setElementModel ( vehicle, 567 ) end end end end end end your code seems a mess i means this function destroy10 ( player ) removeEventHandler( "onMarkerHit", Marker10, destroy10 ) destroyElement( Marker10 ) checkVehicle ( player ) Marker2 = createMarker ( 1728.5, -6244.6000976563, 149.30000610352, "cylinder", 2.5, 150, 10, 10, 125 ) addEventHandler( "onMarkerHit", Marker2, destroy2 ) end where is Marker10 and function destroy2 ?! also for function checkVehicle you should use elseif -_-"
FSXTim Posted May 2, 2012 Author Posted May 2, 2012 This is only a part of the script. Marker10 and destroy2 are in the other part. I will do it now with elseif and tell you about it later.
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