Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Ch3ck3r

  • Rank
  1. The function wasEventCancelled seems to always return false. I found this in the bug tragger but it was resolved in dp2 already. Nevertheless, the following example code reproduces the error on my machine always. function testEvt() outputChatBox(tostring(wasEventCancelled())) if wasEventCancelled() then outputChatBox("evt was cancelled for reason :"..tostring(getCancelReason())) return nil end outputChatBox("cancelling evt") x = cancelEvent(true, "test cancelling") outputChatBox("evt cancelled: "..(x and "yes" or "no")) end function testEvt2() outputChatBox(tostring(wasEventCancelled()))
  2. No, that's the problem, it does not disable them from chatting using console and command "say" or "teamsay". I have tested it. The simplest way i found out now is to "overwrite" the command with commandHandlers function chatFromConsole(player, command, ...) local message = table.concat({...}, " ") cancelEvent(true, "Event handled by other functions") if (command == "teamsay") then triggerEvent("onPlayerChat", player, message, 2) else triggerEvent("onPlayerChat", player, message, 1) end end addCommandHandler("say", chatFromConsole) addCommandHandler("teamsay", chatFromConsole) This can
  3. Hi guys, I've scripted a resource that controls my chat. It offers normal chat that reaches just the people nearby, shout chat (reaches people a bit more far away) and out-of-character chat to chat to everybody. I want the players only to be able to chat when they are logged in. I used an event handler on the event "onPlayerChat" and cancelEvent(true) to stop them from chatting when they are not logged in. The problem is, if you press f8 and type in say Hell everybody you can chat even you are not logged in. A simple way is to set "command.say" and "command.teamsay" to false in the
  4. Hi, i want to have some weather changing effect in my server. So i scripted the following resource, but it does not work. On resource start, the weather is set correctly as far as i can assess. After the first change, the weather should change every quarter (at minute 00, 15, 30 and 45). But it doesn't do anything. I added the command /weather to change the weather manually and check if it works, but it always says me, that there is already a change happening. I am not able to find the error, any help appreciated (The script is serverside) function startWeatherSim() local id = getRan
  5. Yeah that'd be quite useful sometimes. At the moment i use something like this, because i am to lazy to write this exports... stuff mysql = exports.database -- and then in function i use mysql:mysql_query("...")
  6. Yep. I came accross i don't need client side mysql anyway. But is there a way to make a function global? So every resource can call it without exports.resource:function ?
  7. Like robhol suggested, i summed up everything in a central resource called 'database' Actually the whole file just overwrites the mysql functions providing the resource parameter automatically. It was quite a boring task to rewrite all mysql function, so if anybody is in need of it, i will post it up on here. Currently it does only work from server-side. Maybe i will do some event based system for handling action with client scripts later.
  8. Hey yeah! That's a good idea. I think i will do it centralized by exported functions. Thanks
  9. Thanks for this information, though i'd have to know this. Now you are mentioning it it came to my mind, that i've stumbled about this damn error in other languages and modules already. Nevertheless i've one question left. It's not really a problem but maybe you got some advice for me. I need to use the same mysql connection in serveral resources. How do i do that in the best way? I tried to pass the mysq_handle with an exported function which didn't worked. By passing the handle between resources it always became a string and was useless. Atm. i solved it by saving the mysql data in se
  10. Hi guys, i'm relatively new to lua and mta but not so new at scripting in general. I want to create a new gamemode, starting from scratch and ran into my first problem already. I want to use a mysql database and therefor i am checking the database connection on resource start up. This is the relevant piece of code function onGamemodeStart(resource) g_gameMode = resource g_mysqlHandler = mysql_connect("localhost", "mtasa", "------", "mtasa") if(not g_mysqlHandler) then outputDebugString("Could not establish connection to database server", 1) outputConsole("Could not establish connectio
  • Create New...