kalitonchik

slow motion when player killed

Recommended Posts

how to make a script, who performs this function

when the player dies his death is shown in slow motion

I assume that this is related to - onPlayerWasted/got killed event

and I do not know the syntax of this function

function player_Wasted (whot i need write here)

if ( player_Wasted ) then

### show slow motion 2x with a period of two seconds

addEventHandler ( "onPlayerWasted", XXXXXX, player_Wasted )

how to do it

and in general, how to create a good script in note pad which does not show errors in syntax (what a pity...)

and lua language in school does not teach ( we teach ''borland delphi'' )

alone I will not be able to learn lua ( because I have little time -

Training (I am the master of sports gymnastics)

Share this post


Link to post

yes....

and how it should look like, and whot i lost?

function player_Wasted () 
if ( player_Wasted ) then 
      setGameSpeed ( tonumber ( 1 ) ) 
end 
addCommandHandler ( "onPlayerWasted", getRootElement(), setgamespeed ) 

Share this post


Link to post

Sigh... back to the basics. In these four lines of code, you've already managed to make 4 major mistakes. Read the scripting intro again.

I suppose what you want to do is something like this:

addEventHandler("onClientPlayerWasted", getLocalPlayer(),

function ()

setGameSpeed(???)

end

)

I'm not sure what's the default value for setGameSpeed, you'll have to figure that out.

Share this post


Link to post

Let me help you a out a little bit. But please don't take this for granted and learn to understand.

  
-- client script 
  
function onPlayerWasted() 
  if (source == getLocalPlayer()) then 
    setGameSpeed(0.15) 
    setTimer(setGameSpeed, 5000, 1, 1) 
  end 
end 
  
addEventHandler("onClientPlayerWasted", getRootElement(), onPlayerWasted, true) 
  

Share this post


Link to post

Changing the game speed on one client risks screwing up sync - be careful

Share this post


Link to post

*Scarface slaps LordAzamth

Yes it's free

But in my opinion Notepad++ is better.

Share this post


Link to post
normal notepad does not check for errors in syntax

There is no editor that will check for syntax errors. Notepad++ highlights you code, which helps to some degree. Running your code with MTA will check for syntax errors.

Share this post


Link to post

Actually LuaEdit has a syntax checker built in. But i never liked LuaEdit it's not very nice to use.

Personally i have a syntax check hook using Notepad++'s run option which launches the interpreter.

Share this post


Link to post
Changing the game speed on one client risks screwing up sync - be careful

unless he makes the respawn time say 10 seconds and only does the slowmo for 5.

Share this post


Link to post

The game speed will affect anything you're syncing. So, it'll cause any stationary vehicles you're syncing (or vehicles you've just exited) to apparently 'stutter' for other people. It could potentially cause other sync issues...

Share this post


Link to post

Desyncing gamespeed isnt a big deal. You can get away with it as long as you dont do it during gameplay. A slow-mo after death shouldnt have any major sync issues.

If you look at maps such as as-sharks it uses desynced gamespeed to make some players faster than others and it doesnt have any overly adverse effects.

Share this post


Link to post

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.