Jump to content

[HELP] /attach


rafull6

Recommended Posts

Hello guys! Once upon a time there was [NR]Gaming Freeroam server, and it had one AWESOME (as for me) resource.

It worked in the next way. You need to type while you are in the car this command /attach . For example: /attach 1225 0 10 0 0 0 0 will attach explosive barrel opposite to the car on 10 units. You can also attach any object in the game, but you need to be in the car. Where can i find such resource, or how to make it? Guys, help me with this problem. It is my dream point for many years to get this resource.

(I looked throught a lot of topics on this forum, but there was no answer :( )

help :(

Link to comment

function attachHand ( source, commandName,objID,x,y,z,rx,ry,rz ) 
car = getPedOccupiedVehicle(source) 
if (car) then 
object = createObject(tonumber(objID),0,0,0); 
attachElements ( car, object, tonumber(x),  tonumber(y),  tonumber(z), tonumber(rx),  tonumber(ry),  tonumber(rz) ); 
else 
outputChatBox("You must be in car!",source,255,0,0); 
 end 
end 
addCommandHandler ( "attach", attachHand ) 

Like this!? (scripted by Taalasmaa)

---------------------------------------

ADDED:

BUT IT DOESN'T WORK :(:(:(

Help GUYS!!!!! :|

Link to comment

Creating this script would take about 2 mins (even less).

local playerObjects = {} 
  
function attachObjectToPlayerVehicle ( player, cmd, ID, x, y, z, rx, ry, rz ) 
local vehicle = getPedOccupiedVehicle(player) 
if not vehicle then outputChatBox("You must be in a vehicle to use this command.",player,255,0,0) return end 
if isElement(playerObjects[player]) then destroyElement(playerObjects[player] end 
playerObjects[player] = createObject(tonumber(ID),0,0,0) 
attachElements (vehicle, playerObjects[player], tostring(x),  tostring(y),  tostring(z), tostring(rx),  tostring(ry),  tostring(rz)) 
end 
addCommandHandler ( "attach", attachObjectToPlayerVehicle ) 
  
addEventHandler("onPlayerQuit",root, 
function () 
if isElement(playerObjects[source]) then destroyElement(playerObjects[source] end 
end) 

It should work :D

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