Jump to content

Little scripting help, please..(newbie)


Recommended Posts

Hello, i am scripting a very simple roleplay gamemode that would only include few animations, vehicle and a house system, and details like earning money or eating and stuff (not needed now) (i know most of you are probbably tired of this), i am very new to LUA scripting, and scripting overall, i am also not that good at english. I got the basic spawning and walkaround thingy going, but now i want to ask you guys how to spawn in a different location when i die? (for example a hospital). By the way, i hope people wont get mad at me, and maybe if you know some good MTA LUA scripting lessons, could you give it to me?

Thank you for all your help.

Link to comment
Hello, i am scripting a very simple roleplay gamemode that would only include few animations, vehicle and a house system, and details like earning money or eating and stuff (not needed now) (i know most of you are probbably tired of this), i am very new to LUA scripting, and scripting overall, i am also not that good at english. I got the basic spawning and walkaround thingy going, but now i want to ask you guys how to spawn in a different location when i die? (for example a hospital). By the way, i hope people wont get mad at me, and maybe if you know some good MTA LUA scripting lessons, could you give it to me?

Thank you for all your help.

I've been like you, scripting my ass of on stuff I didn't know. But when you find the wiki (https://wiki.multitheftauto.com/wiki/Main_Page), things will get easy. Just put some keywords in and test the function out.

To help you out in the first part right here, I'll give you a quick and nice code:

To spawn the player when he dies, the eventHandler "onPlayerWasted" will be called:

addEventHandler("onPlayerWasted", root, 
    function ( source ) 
        spawnPlayer( source, 1176.2972412109, -1323.7965087891, 14.014363288879 ) 
        fadeCamera ( source, true ) 
        setCameraTarget ( source, source ) 
    end 
) 

This is actually quite,,, stupid if you ask me. You'll die and respawn immediately. Now up to you to create a timer that will respawn the player. :)

tip:

setTimer 

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