Jump to content

Andreas.

Members
  • Posts

    33
  • Joined

  • Last visited

Everything posted by Andreas.

  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
  12. I want to put all players data, a new row in the .txt for every output like content of lol.txt player1data player2data player3data and so on, you get me now?
  13. hey, how can I output the looped into a file? I mean like function lol() for i,v in ipairs (getElementsByType ("player")) do local theirdata = getElementData(v, "data") thefile = fileCreate ("lol.txt") fileWrite(thefile, theirdata) fileClose(thefile) end end addCommandHandler("loop", loll)
  14. Yea, tried that no result nothing in debug either scratch ^, I made it work. /close
  15. Hello, i'm new to the whole exporting thing and i tried but i seem to encounter a problem i cant solve.. server function showPlayerGUI(status, player) triggerClientEvent(player, "showGUI", player, status) end client addEvent("showGUI", true) function showGUI(status) if status == "true" then guiSetVisible(guiWindow, true) showCursor(true) elseif status == "false" then guiSetVisible(guiWindow, false) showCursor(false) end end addEventHandler("showGUI", root, showGUI) meta.xml <export function="showPlayerGUI" type="server"/> <export function="showGUI" type="client"/> and where I trigger the export exports.(RES)showGUI:showPlayerGUI(source, "true") debug message; <name> expected near '(' EDIT: Okay, I got it to work client-sided still need help with ^
  16. that's impossible, it have to work but you could try and make it client sided again: function disableCrosshair() showPlayerHudComponent("crosshair", false) end addEventHandler("onClientPlayerJoin", root, disableCrosshair) and meta.xml <meta> <info author="marston" name="chc" version="1.0.0" type="script" /> <script src="client.lua" type="client" /> </meta>
  17. Andreas.

    Scripting

    Just, do your best and read the wiki, if you have a problem with a script post the code in a thread and someone will help you.
  18. solved; it was because timer was set to "0" not "1" but how can I make the "timeAmount" in minutes, not miliseconds EDIT: Solved it by using: local seconds = 60000 * timeAmount outputChatBox(seconds) setTimer(setPlayerMuted, seconds, 1, chosenPlayer, false) outputChatBox("Muted for "..time.." minutes")
  19. hello, i have a problem with removing a mute after given time. server setTimer(setPlayerMuted, timeAmount, 1, chosenPlayer, false) client local timeAmount = guiGetText(gui.edit[1]) why do I get un-muted directly? I trigger the "timeAmount" so that's not the problem, nothing in debug either and outputChatBox(timeAmount) outputs the time given in the edit
  20. no offence but it's not that hard to script lol
×
×
  • Create New...