Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. addEventHandler("onPlayerLogin",root,onLogin)
  2. getAccountName is used on an account not a player. function onLogin(_,acc) local aname = getAccountName(acc) ... end
  3. How will a player ever have an account when he joins? onPlayerJoin > "Guest" onPlayerLogin > "Player/Admin" onResourceStart, you can loop through all the players and check if they're logged in.
  4. elseif getEngineState ~= engstate then setElementData(veh1,"fuel",100) dxDrawText("Press SPACE to refuel!", sx*475,sy*450,sx*500,sy*240,tocolor(255,255,0,255),0.95 ,"bankgothic") if (getKeyState('space')) then if (not startTick) then startTick = getTickCount() end if (getTickCount - startTick > 1000) then --increment startTick = getTickCount() --if refilled then -- startTick = nil --end end end
  5. setElementData(veh1,"fuel",100) Why are you setting the 'fuel' data in onClientRender instead of refuelTheVeh function? Also, you're binding the key each over and over again. What you could do is check if the player is pressing space inside onClientRender and refill the fuel. You could also use getTickCount to slow it down.
  6. JR10

    [HELP] Please

    Any errors? targetplayer could be false and the conditional statement stops the rest of the code from running.
  7. setElementData can already sync the data between server-side and client-side.
  8. JR10

    Exports problem

    What exactly is the problem here? showCursor is resource based, if you use showCursor in a certain resource you have to hide it from the same resource.
  9. You need coroutines in order to do that. Some tutorials: http://www.lua.org/pil/9.html http://lua-users.org/wiki/CoroutinesTutorial If you're still a beginner or you couldn't understand what coroutines are then I'd suggest you find a different way to do what you're doing.
  10. I didn't even notice that he was using dbExec. dbExec never returns results, it only executes the given query.
  11. SQLite supports auto-increment. A column declared "INTEGER PRIMARY KEY" will auto-increment. You can use last_insert_rowid() without specifying a table. SELECT LAST_INSERT_ROWID()
  12. You can check how I did it here: https://github.com/Woovie/dxGUI/blob/de ... tfield.lua This has only one problem, it doesn't support more characters than what can fit inside the box.
  13. https://wiki.multitheftauto.com/wiki/PHP_SDK
  14. Opening a link will probably never get implemented. It has numerous problems.
  15. What is it that you don't understand? The wiki shows you the list of arguments that are passed to the even'ts handling function. One of those arguments is the weapon's id. With that you can check when the player is damaged for the weapon's id, if it's the Katana, then immediately kill the player. addEventHandler('onClientPlayerDamage', localPlayer, function(attacker, weapon) if (weapon == 8 ) then setElementHealth(localPlayer, 0) end end)
  16. There's no way to do that that, not that I know of. I've tried to do it before as a part of a dxEditBox class. I ended up treating the caret as the dxEditBox's caret as well. So basically, I positioned the dx text so that the edit box's caret would also be the dxEditBox's caret.
  17. Forget about the sourceElement/attachedElement, the more important parameter is the sendTo one. You need to specify who the event triggers for. The default value is root so it triggers for everyone.
  18. JR10

    [HELP] VIP

    function playMusic (songName) if sound and isElement(sound) then stopSound(sound) end if songName == "nyan" then sound = playSound("Nyan.mp3") elseif songName == "fools" then sound = playSound("Killingfools.mp3") end setSoundVolume(sound, 1) end addEvent("playMusicEvent", true ) addEventHandler("playMusicEvent", getRootElement(), playMusic ) It was soungName instead of songName.
  19. Are you sure it's not disabled? And that it's active?
  20. I'm not sure I get this but, guiSetVisible only works with gui-window elements.
  21. You can check for the position if the player is above 1000 height, then set his gravity. Make sure that you set the gravity client-side so it's not globally set.
×
×
  • Create New...