Jump to content

Script spawn per rimorchi


Recommended Posts

Certo che si puo fare.

In pratica devi creare un marker che attacca il rimorchio al camion (solo ad un determinato id) else outputchat "non hai il veicolo giusto".

quindi :

1. createMarker

2. la funzione

3. vehicle = getPedOccupiedVehicle(me)

if (getElementModel(vehicle)) ~= "l'id del veicolo" (in pratica se non hai questo veicolo la funzione non parte

4. l'evento "onClientMarkerHit"

Bhe cmq è inutile spiegare tutto,dimmi l'id del camion l'id del rimorchio e le coordinate per il marker :mrgreen:

Link to comment

Eccolo : (puoi editare tutto se vuoi,l'ho testato)

client - side

  
function creaUnMarker () 
rimorchio = createMarker( 2776, -2474.5,13.6,"ring",3, 0, 255, 0, 255 )  
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), creaUnMarker) 
setTimer ( creaUnMarker, 2000, 0) 
addEventHandler("onClientMarkerHit", root, 
function(player, matchingDimension) 
if not matchingDimension then return end         
if player == localPlayer and isPedInVehicle(player) then 
local vehicle = getPedOccupiedVehicle(player)            
if source == rimorchio then 
local vehicle = getPedOccupiedVehicle(player) 
if ( getElementModel ( vehicle ) == 515 ) then 
local x, y, z = getElementPosition ( vehicle )  
rimorchio = createVehicle ( 435, x, y, z)  
attachTrailerToVehicle (vehicle, rimorchio) 
outputChatBox ( "il Rimorchio è Collegato", getRootElement(), 0, 255, 0 ) 
elseif source == rimorchio then 
local vehicle = getPedOccupiedVehicle(player) 
if ( getElementModel ( vehicle ) == 403 ) then 
local x, y, z = getElementPosition ( vehicle )  
rimorchio = createVehicle ( 435, x, y, z)  
attachTrailerToVehicle (vehicle, rimorchio) 
outputChatBox ( "il Rimorchio è Collegato", getRootElement(), 0, 255, 0 )              
end  
    end 
        end 
    end 
end 
) 
  

Se hai problemi posta qui :mrgreen:

Link to comment

Try This :

Ho aggiunto anche un blip nella mappa con la lettera T (Trailer)

  
function creaUnMarker () 
rimorchio = createMarker( 2776, -2474.5,13.6,"ring",3, 0, 255, 0, 255 )  
createBlip ( 2776, -2474.5,13.6 , 42, 0.5 ) 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), creaUnMarker) 
setTimer ( creaUnMarker, 3000, 0) 
addEventHandler("onClientMarkerHit", root, 
function(player, matchingDimension) 
if not matchingDimension then return end         
if player == localPlayer and isPedInVehicle(player) then 
local vehicle = getPedOccupiedVehicle(player)            
if source == rimorchio then 
local vehicle = getPedOccupiedVehicle(player) 
if ( getElementModel ( vehicle ) == 515 ) then 
local x, y, z = getElementPosition ( vehicle )  
rimorchio = createVehicle ( 435, x, y, z)  
attachTrailerToVehicle (vehicle, rimorchio) 
outputChatBox ( "You attached the trailer", getRootElement(), 0, 255, 0 ) 
elseif source == rimorchio then 
local vehicle = getPedOccupiedVehicle(player) 
if ( getElementModel ( vehicle ) == 403 ) then 
local x, y, z = getElementPosition ( vehicle )  
rimorchio = createVehicle ( 435, x, y, z)  
attachTrailerToVehicle (vehicle, rimorchio) 
outputChatBox ( "You attached the trailer", getRootElement(), 0, 255, 0 )               
end  
    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...