Jump to content

|Help| Respawning vehicles only +...


Fantanic

Recommended Posts

Posted (edited)

Hello ,

I got a trucker job working fully now but i got one problem.

If there is a respawn it respawns my trailer.

So i would like to make the trailer not being respawn able.

Edited by Guest
  • MTA Team
Posted

Try This:

  
function respawn() 
local accountname = getAccountName (getPlayerAccount(source)) 
if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
outputChatBox("***Respawning ALL Empty Vehicles In 10 Secs, get to your car to keep it***") 
setTimer(function () 
local vehicles = getElementsByType ( "vehicle" )  
for k, vehicle in ipairs ( vehicles ) do 
local model = getElementModel(vehicle) 
if model ~=  435 or 450 or  591 then 
if checkEmpty( vehicle ) then 
local seats = getVehicleMaxPassengers(vehicle) 
resetVehicleIdleTime ( vehicle )  
respawnVehicle ( vehicle ) 
end 
end 
end 
end, 10000, 1) 
end  
end 
addEvent( "respawn", true ) 
addEventHandler( "respawn", getRootElement(), respawn ) 

Posted

still need help

Also im want to try to make a gui to add and lock cars in-game

For example i use /carlock then i get a gui wich contains ; Vehicle Username (up to 5 usernames) , team , class , color , upgrades .

But i dont know wich functions i need to use.

Thank you

Posted
use it will respawn it. Click on it to go to wiki page.
  
respawnVehicle 
  

I dont rlly get you , the respawnVehicle works fine , i just need it so it ignores the trailers

Posted (edited)
if model ~=  435 or 450 or  591 then 

Should be:

if model ~= 435 and model ~= 450 and model ~= 591 then 

You can also do:

if getVehicleType(model) ~= "Trailer" then 

Edited by Guest
Posted
if model ~=  435 or 450 or  591 then 

Should be:

if model ~= 435 and model ~= 450 and model ~= 591 then 

You can also do:

if getVehicleType(model) ~= "Trailer" then 

Worked Thanks

Posted

U could also help me with giving me the functions of ;

Making a gui to lock cars to classes / teams / usernames

And that u can change upgrades + colors

+ a delete button so u can delete one.

Greetings

Posted
  
--Making a gui 
guiCreateWindow 
guiCreateButton 
  

  
[url=https://wiki.multitheftauto.com/wiki/Server_Scripting_Functions#Vehicle_functions]https://wiki.multitheftauto.com/wiki/Se ... _functions[/url] 
  

Posted
createVehicle 
addVehicleUpgrade 
getElementData / getTeamName / getPlayerAccount 
xmlLoadFile 
xmlSaveFile 
  

?

I dont get it from how to lock it + how to get it so it takes the vehicle u are in + from xmlloadfile + savefile , maybe its better to use SQL but i dont have any knowledge in scripts with sql (i dont know how to make it working with sql*)

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