Jump to content

Andreas.

Members
  • Posts

    33
  • Joined

  • Last visited

Andreas.'s Achievements

Rat

Rat (9/54)

0

Reputation

  1. bad arguement at killTimer: 20 and it doesn't remove the dxtext, it's still there
  2. I want the dxmessage to disappear directly if I trigger the event while it's already active.
  3. I want the result to be: Position: xvalue, yvalue, zvalue Money: lol the current result: Money: lol2381.0546875-2175.641601562522.9655265808118 LUA code used: function log(account, message) if not (fileExists("logs/"..account)) then log = fileCreate("logs/"..account) else log = fileOpen("logs/"..account) end fileWrite(log, "\n"..message) fileClose(log) end addEvent("log", true) addEventHandler("log", root, log) function testlog(client) local playerAccount = getPlayerAccount(client) local accName = getAccountName ( playerAccount ) local x, y, z = getElementPosition(client) triggerEvent("log", client, accName, "Position: "..x..y..z) triggerEvent("log", client, accName, "Money: lol") end addCommandHandler("log", testlog)
  4. The command handler is obviously only there to test it.
  5. I'm trying to make my own notification system but I have encountered couple of problems. The deletion is not working AT ALL as I want. I want it so that when a message is already active, it will delete the old one and the timer will start all over again. Currently I can make one message, and I can make yet another one on top of that (does not remove it) so yeah, help is highly appreciated! And yea, I know the code is highly fucked up. local dxMessage = {} dxStatus = false function dxEvent(message, r, g, b) for index, message in pairs(dxMessage) do dxDrawText(message[1],573.0,1040.0,1516.0,1080.0,tocolor(message[2],message[3],messageData[4],255),1.5,"arial","center","center",false,false,true) dxStatus = true end theTimer = setTimer(removeMessages, 4000, 1) dxStatus = false end function removeMessages() removeEventHandler("onClientRender", root, dxEvent) end function dxOutput(message, r, g, b) table.insert(dxMessage, {message, r, g, b}) addEventHandler("onClientRender", root, dxEvent) if (dxStatus) == false then dxStatus = true else dxStatus = false end if (dxStatus == false) then removeEventHandler("onClientRender", root, dxEvent) outputChatBox("active") killTimer(theTimer) end end addEvent("dxOutput", true) addEventHandler("dxOutput", root, dxOutput) addCommandHandler("lol", function() triggerEvent("dxOutput", root, "testing hehe", 0, 250, 0) end)
  6. Hoi, but ~= is the same as "not" right? If it is, why can't I use it? "unexpected symbol near ~"
  7. if I click on a vehicle and there is a driver, it should output the drivers name and destroy it
  8. function onClick(button, state, clickedElement) if button == "left" and state == "up" then if clickedElement then if getElementType(clickedElement) == "player" then choosenPlayer = clickedElement elseif getElementType(clickedElement) == "vehicle" then choosenPlayer = clickedElement destroyElement(clickedElement) local playerVeh = getPedOccupiedVehicle(clickedElement) outputChatBox(playerVeh) end end end end addEventHandler("onPlayerClick", root, onClick) I'm sure I'm doing something wrong, but i dunno what
  9. lol, that was the problem. Really thank you!
  10. Okay, cool but now it outputs it all in a single line, I want a new line for each data. http://i47.tinypic.com/9k6o1u.png
  11. function printAllData ( thePlayer ) local playerAccount = getPlayerAccount( thePlayer ) -- get his account if ( playerAccount ) then -- if we got the account then local data = getAllAccountData( playerAccount ) -- get data count = 0 for _ in pairs(data) do count = count + 1 end -- get the count outputChatBox ( "table holds " .. count .. " entries" ) -- output number of rows if ( data ) then for k,v in pairs ( data ) do accountLog = fileCreate("accounts/"..getAccountName(playerAccount)) outputChatBox(k.." :"..v) fileWrite ( accountLog, "\n\n"..k.." : ".. v ) end fileClose(accountLog) end end end addCommandHandler ( "loopx", printAllData ) that only prints: weaponAmmo8 : 0 when its supposed to print: table holds 42 entries weaponAmmo12 :0 weaponID10 :0 weaponID12 :0 weaponAmmo1 :0 skin :0 armor :0 weaponAmmo3 :0 weaponAmmo10 :0 y :-1412 x :2036 dim :0 z :12 weaponAmmo9 :0 B :107 wantedlevel :0 weaponAmmo7 :0 weaponID4 :0 weaponID6 :0 weaponAmmo5 :0 weaponID9 :0 money :0 weaponID7 :0 weaponID5 :0 weaponID3 :0 weaponID2 :0 weaponAmmo11 :0 weaponAmmo0 :1 R :237 weaponAmmo4 :0 G :106 weaponAmmo6 :0 Staff :Yes int :0 weaponID11 :0 health :100.3921661377 weaponID1 :0 weaponID0 :0 weaponAmmo2 :0 weaponID8 :0 weaponAmmo8 :0
×
×
  • Create New...