CrystalMV

I need help with simple code

Recommended Posts

I have searched but found nothing that could help me. I also have looked at Hay gamemode code but I still can't solve the problem.

This is very stupid question because code is so small. And I can't make it work. I want to start making gamemode from very simple code. Here it is:

function joined ( ) 
    fadeCamera(source,true) 
    spawnPlayer(source,0.0,0.0,5.0) 
end 
  
AddEventHandler( "onPlayerJoin", getRootElement(), joined ) 

Nothing happens when I connect to the server. Could you help me to make player just spawn when connected?

And sorry for my English. I'm from Lithuania.

Share this post


Link to post
I have searched but found nothing that could help me. I also have looked at Hay gamemode code but I still can't solve the problem.

This is very stupid question because code is so small. And I can't make it work. I want to start making gamemode from very simple code. Here it is:

function joined ( ) 
    fadeCamera(source,true) 
    spawnPlayer(source,0.0,0.0,5.0) 
end 
  
AddEventHandler( "onPlayerJoin", getRootElement(), joined ) 

Nothing happens when I connect to the server. Could you help me to make player just spawn when connected?

And sorry for my English. I'm from Lithuania.

Maybe because lua is case-sensative? Try "addEventHandler" instead of "AddEventHandler". But this is just a wild guess...

Share this post


Link to post

it should be addEventHandler ;) Lua is case sensitive

EDIT: meh you were faster than me :P

Edited by Guest

Share this post


Link to post

Thank you both! Now I can create my own gamemode :) It looks like LUA is too case-sensitive because in Pawn or C I didn't have to think about that. But perhaps it looks like because in Pawn that I used for SA-MP commands that have capital letters start with them too. And C - I didn't script much :)

edit: and thanks to those who wanted to help me but were late :)

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.