Jump to content

Script spawn per rimorchi


Recommended Posts

Posted

Ciao sto cercando di fare uno script per fare uno spawn di rimorchi per camion. Ma proprio non so da dove partire. C'è qualcuno che è abbastanza bravo che può farlo? O è una cosa impossibile?

Posted

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:

Posted

Allora ecco qui quello che mi hai chiesto:

Camion:

Roadtrain ID 515

Linerunner ID 403

Rimorchio (ho deciso di farne solo uno):

Cargo Trailer ID 435

Posizione:

Marker Cylinder

X : 2776

Y : -2474.5

Z : 12.5

Posted

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:

Posted

Ciao innanzitutto ti ringrazio :D ma come posso editarlo in modo che mostri messaggi in inglese?? Ad esempio quando attacchi il rimorchio ti dice "You attached the trailer". Volevo fare un piccolo server in inglese... ;)

Posted

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 
) 
  

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