Jump to content

[Problem] Vehicle get a Barrel


Jumper_Mych

Recommended Posts

Doesn't work :o

Skin = { [280]=true } 
Marker = createMarker ( 2406.61, 83.16, 5002.47, "cylinder", 10, 255, 135, 0, 83 ) 
Van = createVehicle ( 427, 2418.861328125, 85.333984375, 26.718894958496 ( 0, 0, 90, 12LS34PD ) 
  
function attach () 
    attachElements ( Marker, Van, 0, 0, 0 ) 
end 
addEventHandler ( "onClientResourceStart", attach ) 
  
function equipment ( player, cmd) 
    if isElementWithinMarker ( player, attach) then 
     
    if Skin[getElementModel(player)] then 
    cancelEvent() 
    local x, y, z = getElementPosition(player) 
    local rotx, roty, rotz = getElementRotation(player) 
    objects[player] = createObject ( 1228, x, y, z+1, rotx, roty, rotz ) 
    attachElements ( objects[player], player, 0, 1.2, -0.6, 0, 0, 180 )  
  else 
    outputChatBox ( "You're not a Cop", player, 255, 0, 0) 
    end 
  end 
addCommandHandler("barrel", equipment) 

EDIT: Author is not allowed copy my code!

Link to comment
EDIT: Author is not allowed copy my code!

:lol: You are using a translator?

hmm... so there is a matker attached to a vehicle, and when you ger out of the wehicle, stand in this matker and type /barrel it should give you a barrel?

i dont understand this line...

Skin = { [280]=true } 

try

Skin = 280 

WT...

if Skin[getElementModel(player)] then 
cancelEvent() 

i think it should be:

if Skin == getElementModel(player) then 
  

is it possible to cancel the command? and why to do it?

objects[player] = createObject ( 1228, x, y, z+1, rotx, roty, rotz ) 

where is the objects table? you are missing:

objects = {} 

on the begining of yours script...

and the fatal reason: you can only attach visual part of the marker to a moving element (vehicle), the marker collshape will always stay in the creation position (it will not work if you move the vehicle)

Link to comment
You are using a translator?
hmm... so there is a matker attached to a vehicle, and when you ger out of the wehicle, stand in this matker and type /barrel it should give you a barrel?

i dont understand this line...

Skin = { [280]=true } 

try

Skin = 280 

WT...

if Skin[getElementModel(player)] then 
cancelEvent() 

i think it should be:

if Skin == getElementModel(player) then 
  

is it possible to cancel the command? and why to do it?

objects[player] = createObject ( 1228, x, y, z+1, rotx, roty, rotz ) 

where is the objects table? you are missing:

objects = {} 

on the begining of yours script...

and the fatal reason: you can only attach visual part of the marker to a moving element (vehicle), the marker collshape will always stay in the creation position (it will not work if you move the vehicle)

DOESN'T WORK

I never using the translator :x because my write fast not exactly :roll:

Do not know you type lua? you type are bad from lua. (strange) :|

To must test on Host game and check you code are wrong lua?

If you not know Lua. see close topic :o

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