Jump to content

Flashmyname

Members
  • Posts

    32
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Flashmyname

  1. Hi, you should try somehow like this. setTimer(function() if isPedInVehicle(localPlayer) and getPedOccupiedVehicle(localPlayer) then if getVehicleEngineState (getPedOccupiedVehicle(localPlayer)) then if tonumber(getPedOccupiedVehicle(localPlayer):getData("fuel") or 0) > 0 then else getPedOccupiedVehicle(localPlayer):setData("fuel",0) triggerServerEvent("vehicleStart",localPlayer,localPlayer,getPedOccupiedVehicle(localPlayer),false) end end end end,1000,0)
  2. You should try like this. if hunger > 7 then random = math.random(4, 7) setElementData(localPlayer, "Player:Hunger", hunger - random) elseif hunger ~= 0 and hunger <= 7 then setElementData(localPlayer, "Player:Hunger", 0) end
  3. Yes, it is possible. If the script above is not the thing you looking for, than i can show you another one. You only need a client and a serverside script, i will show you a really simple fly script. ---- FLY CLIENTSIDE ---- local flyingState = false local keys = {} keys.up = "up" keys.down = "up" keys.f = "up" keys.b = "up" keys.l = "up" keys.r = "up" keys.a = "up" keys.s = "up" keys.m = "up" addEvent("onClientFlyToggle",true) addEventHandler("onClientFlyToggle",getLocalPlayer(),function() flyingState = not flyingState if flyingState then addEventHandler("onClientRender",getRootElement(),flyingRender) bindKey("lshift","both",keyH) bindKey("rshift","both",keyH) bindKey("lctrl","both",keyH) bindKey("rctrl","both",keyH) bindKey("forwards","both",keyH) bindKey("backwards","both",keyH) bindKey("left","both",keyH) bindKey("right","both",keyH) bindKey("lalt","both",keyH) bindKey("space","both",keyH) bindKey("ralt","both",keyH) bindKey("mouse1","both",keyH) --setElementFrozen(getLocalPlayer(),true) setElementCollisionsEnabled(getLocalPlayer(),false) else removeEventHandler("onClientRender",getRootElement(),flyingRender) unbindKey("mouse1","both",keyH) unbindKey("lshift","both",keyH) unbindKey("rshift","both",keyH) unbindKey("lctrl","both",keyH) unbindKey("rctrl","both",keyH) unbindKey("forwards","both",keyH) unbindKey("backwards","both",keyH) unbindKey("left","both",keyH) unbindKey("right","both",keyH) unbindKey("space","both",keyH) keys.up = "up" keys.down = "up" keys.f = "up" keys.b = "up" keys.l = "up" keys.r = "up" keys.a = "up" keys.s = "up" --setElementFrozen(getLocalPlayer(),false) setElementCollisionsEnabled(getLocalPlayer(),true) end end) function flyingRender() local x,y,z = getElementPosition(getLocalPlayer()) local speed = 10 if keys.a=="down" then speed = 3 elseif keys.s=="down" then speed = 50 elseif keys.m=="down" then speed = 300 end if keys.f=="down" then local a = rotFromCam(0) setElementRotation(getLocalPlayer(),0,0,a) local ox,oy = dirMove(a) x = x + ox * 0.1 * speed y = y + oy * 0.1 * speed elseif keys.b=="down" then local a = rotFromCam(180) setElementRotation(getLocalPlayer(),0,0,a) local ox,oy = dirMove(a) x = x + ox * 0.1 * speed y = y + oy * 0.1 * speed end if keys.l=="down" then local a = rotFromCam(-90) setElementRotation(getLocalPlayer(),0,0,a) local ox,oy = dirMove(a) x = x + ox * 0.1 * speed y = y + oy * 0.1 * speed elseif keys.r=="down" then local a = rotFromCam(90) setElementRotation(getLocalPlayer(),0,0,a) local ox,oy = dirMove(a) x = x + ox * 0.1 * speed y = y + oy * 0.1 * speed end if keys.up=="down" then z = z + 0.1*speed elseif keys.down=="down" then z = z - 0.1*speed end setElementPosition(getLocalPlayer(),x,y,z) end function keyH(key,state) if key=="lshift" or key=="rshift" then keys.s = state end if key=="lctrl" or key=="rctrl" then keys.down = state end if key=="forwards" then keys.f = state end if key=="backwards" then keys.b = state end if key=="left" then keys.l = state end if key=="right" then keys.r = state end if key=="lalt" or key=="ralt" then keys.a = state end if key=="space" then keys.up = state end if key=="mouse1" then keys.m = state end end function rotFromCam(rzOffset) local cx,cy,_,fx,fy = getCameraMatrix(getLocalPlayer()) local deltaY,deltaX = fy-cy,fx-cx local rotZ = math.deg(math.atan((deltaY)/(deltaX))) if deltaY >= 0 and deltaX <= 0 then rotZ = rotZ+180 elseif deltaY <= 0 and deltaX <= 0 then rotZ = rotZ+180 end return -rotZ+90 + rzOffset end function dirMove(a) local x = math.sin(math.rad(a)) local y = math.cos(math.rad(a)) return x,y end function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end and the server side: local enabledSerials = { [""] = true, } ------------------------------------------------------------------|| fly serverside ||--------------------------------------------------- function fly(thePlayer, commandName) if enabledSerials[getPlayerSerial(thePlayer)] then triggerClientEvent(thePlayer, "onClientFlyToggle", thePlayer) end end addCommandHandler("fly", fly, false, false)
  4. Hi, maybe you should try this: dgs:dgsSetProperty('button5.png','image',button) if this doesn't work out as it should, then you should try to check the path, if the .png file is in the right place, like if it is in a folder, then change the path in the script too like this for example in meta: <file src="files/button5.png" /> and it's also changes in the lua: dgs:dgsSetProperty('files/button5.png','image',button)
  5. Hi! - Firstly I will turn back to your first problem, to the multiple account thing. You shouldn't /overthink/ your script, because it's very confusing what I'm seeing now.(for me at least ? ) You should try to attach the multiple account creation to serial(s) like this, but now, in serverside: local serials = { -- You can type here the serial, which you want to grant permission to create multiple account(s) [""]= true, } function onRegisterClick(player, username, password, email) local password = md5(password) local registerQuery = dbPoll(dbQuery(connection, "SELECT * FROM mta.accounts"), -1) for _, row in ipairs(registerQuery) do if row["mtaserial"] == getPlayerSerial(player) and not serials[getPlayerSerial(player)] then triggerClientEvent(client,"set_warning_text",client,"Register","Multiple Accounts is not allowed (Existed: "..tostring(usernameExisted["username"])..")") return end end The last problem, i think you screwed up some dbPoll(maybe you typed a different path or something) in the script, that's why it doesn't find it. - You should try to look in the sql and between the script to find out how you named your accounts table. P.S: Sorry for the bad english, i hope you can understand something at least..
  6. Cső, megpróbálnék segíteni a problémádon, nem igérek semmit csak tapasztalatból próbálkoznék neked segíteni, első kérdésem az lenne hogy aktuális-e még a dolog? - a második kérdés pedig ha igen, akkor hogy amikor rákattintasz mondjuk a karakter létrehozás/login/reg gombokra, akkor reagál-e a rendszer arra hogy ezek közül valamelyiket végrehajtottad? - itt például az output-ra gondolok hogy "Sikeresen létrehoztad a karaktered" etc.. (ha ott akad el hogy ki sem adja, akkor a mentéssel lesz a gond és nem lép tovább a script, próbáld ellenőrizni hogy rendesen van-e összekötve sql-el) illetve hogy debugscripted ír-e ki hibát amennyiben ezt megteszed.
×
×
  • Create New...