Jump to content

xxmitsu

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by xxmitsu

  1. Thank you very much! I have been caught in a pleasant way, didn't tought that anyone would have so much patience to explain to me in such detailed way. I find lua pretty difficult due to the fact that until now I had to do only with languages based on C syntax Thanks again both of you! That really helped me PS: didn't knew about [lua] tag Mike.
  2. Hi, I recently began to script in LUA, and I have some experience with PAWN. Now, I'm trying to convert some parts of my pawn scripts to lua. Then problem is that somehow I got stucked. I'm trying to make an array structure. something like this in pawn: #define MAX_PLAYERS 100 enum pInfo { pSQLID, pAdmin, pLevel, } new PlayerInfo[MAX_PLAYERS][pInfo]; I've translated into this: -- structura pInfo = { pSQLID, pAdmin, pLevel,} gPlayerInfo = {} for i=1,100 do gPlayerInfo[i] = pInfo end Then, I'm trying to assign a value when a player joins. function joinHandler() gPlayerInfo[source][pLevel] =1; end -- eventuri addEventHandler("onPlayerJoin", getRootElement(), joinHandler) After this, I've tried to make an command to see if anything changed.. function DebugFunction() outputChatBox ( "Variabila are " .. gPlayerInfo[source][pLevel] .. " valoarea ",thePlayer ) end -- comenzi addCommandHandler("debugf", DebugFunction) When I type /debugf in the game, nothing happens, but when I look into the server's console I get this: [02:00:46] ERROR: ...server/mods/deathmatch/resources/eGaming/egaming.lua:36: at tempt to index field '?' (a nil value) [02:00:49] ERROR: ...server/mods/deathmatch/resources/eGaming/egaming.lua:68: at tempt to index field '?' (a nil value) Line 36 is: gPlayerInfo[source][pLevel] = 1; Line 68 is: outputChatBox ( "Variabila are " .. gPlayerInfo[source][pLevel] .. " valoarea ",thePlayer ) How can I index those arrays ? What am I doing wrong ? Any help is apreciated. Thank you in advance. Mike.
×
×
  • Create New...