Jump to content

ziomal432

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by ziomal432

  1. I am writing an MTA query script, and I've read this topic: http://forum.game-monitor.com/showthread.php?t=821 but written there doesn't work (probably it works only in PHP 4). I rewrote this: <?php $ip = '87.238.175.150'; //example server $port = '22003'; $socket = fsockopen('udp://' . $ip, $port, $errno, $errstr); socket_set_timeout($socket, 1, 0); if($socket) { echo 'Connected.'; fwrite($socket, 's'); $data = fread($socket, 16384); fclose($socket); echo $data; } else echo 'Can\\'t connect.'; ?> it connects to server, but $data variable is empty string. Why? How to make it work?
  2. guiSetProperty(this_list, "ColumnHeader", "false") crash guiSetProperty(this_list, "ColumnHeader", "0") crash
  3. I searched every function and nothing founded.
  4. I checked this before, and properties such as "BorderWidth" and "Alpha" didn't worked.
  5. How to hide border and columns in grid lists?
  6. Thanks, I searched in Google, but in wrong keywords.
  7. I've got this code (example): local tablee = { ["a"] = {5443.0}, ["b"] = {5443.0}, ["c"] = {5443.0}, ["d"] = {5443.0} } addEventHandler("onResourceStart", getResourceRootElement(), function() for txt in pairs(tablee) do print(txt) end end ) But the loop changes sequence of these texts Shows: but I want: How to prevent this?
  8. Lol, I didn't seen it. Number of functions in MTA is awesome. Thanks.
  9. Ok, I used example from wiki and explode (founded in Google), works good. Thanks. If somebody would need it, here: f = fileOpen("thefile.txt", false) local FullText = fileRead(f, 100) while not fileIsEOF(f) do FullText = FullText .. fileRead(f, 100) end fileClose(f) Lines = explode("\n", FullText) for i = 1, #Lines do -- line: Lines[i] end Explode function: function explode (seperator, str) --from: [url=http://luanet.net/lua/function/explode]http://luanet.net/lua/function/explode[/url] local pos, arr = 0, {} for st, sp in function() return string.find( str, seperator, pos, true ) end do -- for each divider found table.insert( arr, string.sub( str, pos, st-1 ) ) -- Attach chars left of current divider pos = sp + 1 -- Jump past current divider end table.insert( arr, string.sub( str, pos ) ) -- Attach chars right of last divider return arr end
  10. I'd line to do something like INI parser, but fileRead doesn't read file line-by-line. I seen some examples to do this, but didn't worked in MTA. How to do this?
  11. I noticed this way little bit before your post, but the code didn't worked. Thanks for your example. Problem is solved.
  12. Sorry, I'm just somehow pensive. function OnResourceStart(res) if(res == getThisResource()) then createVehicle(562, 2035.3472, 1347.7974, 10.8203) end end addEventHandler("onResourceStart", getRootElement(), OnResourceStart) and close. EDIT: @DOWN: thanks.
  13. But is there any way to make it without /tele prefix?
  14. How to do a loop for all command names? Something like this [example]: [100% will not work] function OnPlayerCommand(cmdname) for key, singleElement in pairs (Teleports) do if(tostring(cmdname) == Teleports[singleElements][1]) then setElementPos(source, Teleports[singleElements][2], Teleports[singleElements][3], Teleports[singleElements][4]) -- ...... end end end addEventHandler("onPlayerCommand", getRootElement(), OnPlayerCommand)
  15. Maybe I badly written it. Problem is solved: function OnResourceStart(res) createVehicle(562, 2035.3472, 1347.7974, 10.8203) end addEventHandler("onResourceStart", getRootElement(), OnResourceStart) function OnPlayerJoin() local x = 2035.3472 local y = 1346.7974 local z = 10.8203 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Siema!", source) end addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoin)
  16. It's maybe 'cause I am n00bish, but I'm learning. function OnResourceStart() createVehicle(562, 2035.3472, 1347.7974, 10.8203) end addEventHandler("onResourceStart", getRootElement(), OnResourceStart() function OnPlayerJoin() local x = 2035.3472 local y = 1346.7974 local z = 10.8203 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Test!", source) end addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoin() When I connect to server, the screen is black. EDIT: Sorry for bad category Please move to Scripting. EDIT2: function OnResourceStart(res) createVehicle(562, 2035.3472, 1347.7974, 10.8203) end addEventHandler("onResourceStart", getRootElement(), OnResourceStart) function OnPlayerJoin() local x = 2035.3472 local y = 1346.7974 local z = 10.8203 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Siema!", source) end addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoin) Maybe it's too hard for me? Please close or remove this topic.
×
×
  • Create New...