Jump to content

[HELP] How to make car never blow


Recommended Posts

Posted
setVehicleDamageProof 

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

Use the event: onVehicleEnter and the functions:

getPlayerAccount 
getAccountName 
isObjectInACLGroup 

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

Lazy member... the functions already were posted.

P.S: Is not "whant", is "want". There's not letter "h".

Software Engineer & Entrepreneur Running Lustrel and VilarikA • Highly engaged on open source community

Posted (edited)

here:

x: A floating point number representing the X coordinate on the map.

y: A floating point number representing the Y coordinate on the map.

z: A floating point number representing the Z coordinate on the map.

Main_Page

Edited by Guest

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

0 = x

0 = y

6 = z

and you Can get Them by Admin Panel

--serverSide

function damage (thePlayer) 
local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Admin" ) ) then 
    local driver = getVehicleOccupant ( thePlayer) 
    if ( driver ) then  
    setVehicleDamageProof(driver, true) 
    outputChatBox('Your vehicle is Damage Proof',thePlayer,255,255,0) 
    else 
    outputChatBox('You Must Be Admin to do this',thePlayer,255,255,0) 
end 
end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), damage ) 

My ingame nickname : Ops!

-DeathMatch GameMode By Ops! : 5%

Posted

X-Shadow, your code won't work. You must change getVehicleOccupant() to getPedOccupiedVehicle(). The first function returns the player and the second returns the vehicle.

Software Engineer & Entrepreneur Running Lustrel and VilarikA • Highly engaged on open source community

Posted
here:
x: A floating point number representing the X coordinate on the map.

y: A floating point number representing the Y coordinate on the map.

z: A floating point number representing the Z coordinate on the map.

Main_Page

this is make car in some location which never blow up?

Posted (edited)
newvehicle = createVehicle(602, 0, 0, 6) 

602 is ID of car

0, -?

0, -?

6, -???????????????

here:
model: The vehicle ID of the vehicle being created.

x: A floating point number representing the X coordinate on the map.

y: A floating point number representing the Y coordinate on the map.

z: A floating point number representing the Z coordinate on the map.

Main_Page

try this,

Server-side:

addEventHandler("onVehicleEnter",root,function(player,seat,jacked) 
    if(player)and(seat==0)then 
        acc = getAccountName(getPlayerAccount(player)) 
        if(isObjectInACLGroup("user."..acc,aclGetGroup("Admin")))then 
            setVehicleDamageProof(source,true) 
        end 
    end 
end) 

Edited by Guest

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

Joker, you must learn LUA! You're trying create a server and you don't know absolutely NOTHING about LUA. Everytime you're asking here for a script ready.

-

Jaysds, bro, don't make codes to Joker. If you read the other topics created by him, you'll see: he's a big lazy member. He don't want learn LUA, he don't want work.

Software Engineer & Entrepreneur Running Lustrel and VilarikA • Highly engaged on open source community

Posted
Lazy member... the functions already were posted.

P.S: Is not "whant", is "want". There's not letter "h".

yeh yeh sorry :) :) i type very fast

how it's possible to press "H" button when buttons with letters "W" and "A" are not even close to it? :lol:

ps. "whant" was hilarious ;)

i must learn not to be an asshole

Posted

Just because StanleySathler corrected him about "whant" I'm gonna correct you all with saying that it isn't "LUA" it's "Lua"

And what I could see you never checked the vehicle model?

But as StanleySathler said, I've seen several topics from this "Joker" guy where he requests us to script, he doesn't even try himself.

lol

Posted (edited)

I don't see how hard it is to make this script work from you guys. It's a simple script guys.

local hydra = createVehicle(model, x, y, z) 
  
addEventHandler("onVehicleEnter", root, 
    function(player, seat, jacked) 
        if isGuestAccount(getPlayerAccount(player)) then return end 
        if seat == 0 then 
            if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(player)), aclGetGroup("Admin")) then 
                setVehicleDamageProof(hydra, true) 
                setVehicleDoorsUndamageable(hydra, true) 
            else 
                setVehicleDamageProof(hydra, false) 
                setVehicleDoorsUndamageable(hydra, false) 
            end 
        end 
    end 
) 

Don't understand anything from this script? I suggest to learn lua first.

Scripting Introduction to MTA:SA

Edited by Guest

If I helped you, please click the like button on the right ;) Thanks!

Posted

myonlake, is not hard. But we are not free scripters, then we don't wanna create a free script. If you read what I said, you'll see that JokeR is lazy and don't wanna work.

Your example does work, but not for only admins. For it, you must increment to Jaysds example, getting the group of ACL.

Software Engineer & Entrepreneur Running Lustrel and VilarikA • Highly engaged on open source community

Posted

Edited my code.

@Jaysds1: I suppose you didn't pay attention to the 'jacked' part there, since in my opinion, it makes no sense if the admin entering the car can only set the vehicle invincible if he doesn't jack it from a player. So you can just take off the part where the 'jacked' is mentioned.

If I helped you, please click the like button on the right ;) Thanks!

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