onPlayerConnect crash - why?

  • Any idea why this code let the server crash? I guess the playerid is not defined?


    Code
    function onPlayerConnect(event)
    SendPlayerMessage(playerid,255,255,255,"Welcome on OUR Server. If there problems ask ADMINS: sunflyer01 or neoprana. Have fun!");
    end
    addEvent("PlayerConnect", onPlayerConnect);
  • [lua]
    function onPlayerConnect(event)


    SendPlayerMessage(event.player,255,255,255,"Welcome on OUR Server. If there problems ask ADMINS: sunflyer01 or neoprana. Have fun!");
    end
    addEvent("PlayerConnect", onPlayerConnect);
    [/lua]


    Oder:


    [lua]
    function onPlayerConnect(event)
    event.player:SendPlayerMessage(255,255,255,"Welcome on OUR Server. If there problems ask ADMINS: sunflyer01 or neoprana. Have fun!");endaddEvent("PlayerConnect", onPlayerConnect);[/lua]


    Entschuldigung bin am Handy sag mal wie lautet die Fehlermeldung wird die Function anvisiert?


    Aber ansonsten müsste es so gehen.


    Viel Glück,


    Marvinmauric

  • so macht man das event.player:sendTextMessage("[#FF0000]You are not an admin");


    wobei ich mich frage woher soll ich wissen wie die event struktur aussieht ...

  • Well I'm starting with LUA and I really don't have a clue about this ... not only the language looks on every platform different, there also no documentation from rising wold datascructures so ...


    but if you want to greet player that login:


    Code
    function onPlayerSpawn(event)
    event.player:sendTextMessage("[#FF0000]Hello silly!!!");
    end
    addEvent("PlayerSpawn", onPlayerSpawn);


    yo can see it how it work on our server otherland.servegame.com

  • For the documentation for Rising World datastructures, it should be soon available (I hope soooo much ^^)


    You can also add something like :



    There's a lot of event you can use ;)

  • You can create a database through your LUA script, and onPlayerConnect you get the ID, put it in the DB, same on disconnect : you get the ID, you delet the DB lign that match this ID


    This way you have a db with only connected player in

Participate now!

Don’t have an account yet? Create a new account now and be part of our community!