Jump to content

[Help] block the car by account


DanielDsX

Recommended Posts

Posted

Hello friends, I was wondering if there is a resource to lock the car by account.

example: when the customer leaves the server the car remains locked until it comes back and unlock.

if there please help me. grateful! :)

560x95.png
Posted

There isn't as far as I know.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

well, it's easy, just set the car data using setElementData,

after that, if the a player leaves/quit, check if he has a car by using getElementData, if he does then lock the car and set the players account data(setAccountData)(only if they was logged in).

after each player login, and check if they have a car using getAccountData, if they do, then .... well that's up to you.

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

Posted

I believe that the function is in this section.

function cl_PlayerQuit ( ) 
    -- check for owned car 
    local ownedVehicle = getElementData ( source, "cl_ownedvehicle" ) 
    if (ownedVehicle ~= false) then 
        cl_RemoveVehicleOwner ( ownedVehicle ) 
    end 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), cl_PlayerQuit ) 

look here, to remove it when the customer leaves the server.

cl_RemoveVehicleOwner ( ownedVehicle ) 

560x95.png

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