Mahlukat

Members
  • Content Count

    34
  • Joined

  • Last visited

Community Reputation

11 Decent

3 Followers

About Mahlukat

  • Rank
    Rat

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. speed run from Slothman's superpowers script; local obj = {} function WaterWalk() if obj[localPlayer] then local x,y,_ = getElementPosition(localPlayer) setElementPosition(obj[localPlayer],x,y,-.6) end end function WaterOn() local px,py,_ = getElementPosition(localPlayer) obj[localPlayer] = createObject(3095,px,py,-2) setElementAlpha(obj[localPlayer],0) setElementDimension(obj[localPlayer], getElementDimension(localPlayer)) setTimer ( destroyElement, 50, 1, obj[localPlayer]) end function getPointFromDistanceRotation(x, y, dist, angle) local a = math.rad(90 - angle); local dx = math.cos(a) * dist; local dy = math.sin(a) * dist; return x+dx, y+dy; end speeding = 0 resting = 0 function speedforce( key, keyState, obj ) if keyState == "down" then if speeding == 0 then if isTimer(buildup) then resetTimer(buildup) else buildup = setTimer ( startSpeeding, 1000, 1) end end else if isTimer(buildup) then killTimer(buildup) buildup = nil end if speeding == 1 then outofspeed() end end end bindKey ( "sprint", "both", speedforce ) function startSpeeding() if resting == 0 then speeding = 1 buildup = nil -- endRun = setTimer( outofspeed, 9999999999, 0 ) addEventHandler("onClientRender",getRootElement(), speedupplayer ) addEventHandler("onClientRender",getRootElement(), WaterOn ) addEventHandler ("onClientRender",getRootElement(),WaterWalk) -- triggerServerEvent ("onSpeedChange", getLocalPlayer(), "fast") -- triggerEvent( "switchRadialBlur", root, true ) end end function outofspeed() speeding = 0 if isTimer(endRun) then killTimer(endRun) endRun = nil end resting = 1 doneresting = setTimer( resetspeedpower, 50, 1 ) removeEventHandler("onClientRender",getRootElement(), speedupplayer ) removeEventHandler("onClientRender",getRootElement(), WaterOn ) removeEventHandler ("onClientRender",getRootElement(),WaterWalk) -- triggerServerEvent ("onSpeedChange", getLocalPlayer(), "normal") -- triggerEvent( "switchRadialBlur", root, false ) end function resetspeedpower() resting = 0 if getControlState("sprint") == true then speedforce( "sprint", "down" ) end end function speedupplayer() if getControlState("sprint") == true then if getControlState("forwards") == true or getControlState("backwards") == true or getControlState("left") == true or getControlState("right") == true then -- setPedWeaponSlot(getLocalPlayer(), 0) local x, y, z = getElementPosition(getLocalPlayer()) local prot = getPedRotation(getLocalPlayer()) local nx, ny = getPointFromDistanceRotation(x, y, 1, (prot)*-1) local clear = isLineOfSightClear( x, y, z, nx, ny, z, true, true, true, true, true, true, true) if clear == true then local lx, ly = getPointFromDistanceRotation(x, y, 1, (prot-8)*-1) local rx, ry = getPointFromDistanceRotation(x, y, 1, (prot+8)*-1) local clearl = isLineOfSightClear( x, y, z, lx, ly, z, true, true, true, true, true, true, true) local clearr = isLineOfSightClear( x, y, z, rx, ry, z, true, true, true, true, true, true, true) if clearl == true and clearr == true then local task = getPedSimplestTask(getLocalPlayer()) if task == "TASK_SIMPLE_PLAYER_ON_FOOT" then local nz = getGroundPosition ( nx, ny, z+1 ) if getDistanceBetweenPoints3D( x, y, z, nx, ny, nz) < 2 then setElementPosition(getLocalPlayer(), nx, ny, nz+1, false) end elseif task == "TASK_SIMPLE_SWIM" then local level = getWaterLevel ( nx, ny, z ) if level then if getDistanceBetweenPoints3D( x, y, z, nx, ny, level) < 2 then local nx2, ny2 = getPointFromDistanceRotation(x, y, 1, (prot)*-1) local clear = isLineOfSightClear( x, y, z, nx2, ny2, z, true, true, true, true, true, true, true) setElementPosition(getLocalPlayer(), nx, ny, level, false) end end end end end end end end
  2. --client-side yasaklilar = { --"command", "useitem", "say", ... } addEventHandler("onClientKey", root,function(button, press) local komut = getBinds(button) if komut and press then if not guiGetInputEnabled() and not isChatBoxInputActive() then cancelEvent() outputChatBox("This button has an inappropriate command. To remove: #FFFFFF/unbind #CC0000"..button.." #FFFFFF"..komut, 255,0,0, true) end end end) function getBinds(buton) for i,v in pairs(yasaklilar) do local butons = getBoundKeys ( v ) if type(butons) ~= "boolean" and butons[buton] then return v end end return false end
  3. Mahlukat

    coroutine

    i dont understand im so confused would you create some example too please
  4. Mahlukat

    coroutine

    Thanks you for your answer When i call querydb function, its return before dbQuery's callback function and i thought maybe querydb function can wait for dbQuery's callback function because i have a another function like this; function getQueryResult(id) if not queries[id] then return false end return queries[id] end I am using exactly like this; local id = querydb("SOME DB FUNCS") local result = getQueryResult(id)
  5. Mahlukat

    coroutine

    Hey i have a export function for dbQuery but when i call func, data from database stay late I searched the forum and found a few solutions with coroutine but I could not :(( anyone can explain how's work coroutine and what should i do please function querydb(str) if str:find("DROP TABLE") then return end local id = getFreeID() local co = nil function verileriAktar(sorgu) coroutine.resume(co, sorgu) end co = coroutine.create(function() dbQuery(verileriAktar,connection,str) local results = coroutine.yield() local cevap = dbPoll(results,0) queries[id] = cevap print(id) end) coroutine.resume(co) -- should stop here i guess but its not print("cevap: "..id) return id end local id = querydb("SOME DB CODES") -- cevap: 1 -- 1
  6. can you try this? addEventHandler("onClientChatMessage", getRootElement(),function(text) if text == "login: You successfully logged in" then cancelEvent() end end)
  7. can you try this? teams = {"Liberation Army", "Imperial Forces"} function getPos() local x, y ,z = getElementPosition(localPlayer) local pos = tostring(x..", "..y..", "..z) outputChatBox(pos, 255, 100, 100, false) setClipboard(pos) end addCommandHandler("pos", getPos) ---- GUI Creation addEventHandler("onClientResourceStart", resourceRoot, function() window = guiCreateWindow(0.57, 0.25, 0.19, 0.37, "Spawn Menu", true) guiWindowSetMovable(window, false) guiWindowSetSizable(window, false) guiSetAlpha(window, 1.00) team_gridlist = guiCreateGridList(10, 32, 284, 98, false, window) column = guiGridListAddColumn(team_gridlist, "Team", 0.9) for i,teamtext in pairs(teams) do local row = guiGridListAddRow(team_gridlist,teamtext) end -- rowA = guiGridListAddRow(team_gridlist) -- rowB = guiGridListAddRow(team_gridlist) -- guiGridListSetItemText(team_gridlist, 0, 1, "Liberation Front", false, false) -- guiGridListSetItemText(team_gridlist, 1, 1, "Imperial Forces", false, false) skin_label = guiCreateLabel(58, 248, 71, 15, "Select a skin", false, window) skin_btn_next = guiCreateButton(96, 273, 33, 16, ">", false, window) skin_btn_previous = guiCreateButton(58, 273, 33, 16, "<", false, window) location_gridlist = guiCreateGridList(10, 140, 284, 98, false, window) location_col = guiGridListAddColumn(location_gridlist, "Location", 0.9) weapon_label = guiCreateLabel(155, 248, 96, 15, "Select a weapon", false, window) weapon_btn_next = guiCreateButton(165, 273, 33, 16, ">", false, window) weapon_btn_previous = guiCreateButton(204, 273, 33, 16, "<", false, window) spawn_btn = guiCreateButton(114, 299, 67, 24, "Spawn", false, window) guiSetVisible(window, false) end ) ---- GUI functions function isGUIVisible(gui) return (guiGetVisible(gui) == true) end -- Make the GUI appear on login. addEvent("onClientPlayerLoginn", true) addEventHandler("onClientPlayerLoginn", root, function() if isGUIVisible(window) then return end guiSetVisible(window, true) -- Set the camera to the desired location. setCameraMatrix(-2610.9792480469, 1445.4840087891, 7.1875, -2610.9792480469, 1445.4840087891, 7.1875) -- Make a ped with default skin (0). local ped = createPed(0, -2614.0212402344, 1451.1651611328, 7.1875, 180) end) -- Team addEventHandler("onClientGUIClick", resourceRoot, function() if (source == spawn_btn) then local team = getSelectedTeam() if team then triggerServerEvent("setTeam", localPlayer, team) end end end) function getSelectedTeam() local row, col = guiGridListGetSelectedItem(team_gridlist) if row and col and row ~= -1 and col ~= -1 then return guiGridListGetItemText(team_gridlist, row, col) else return false end end local LALocations = {"LA Test 1", "LA Test 2", "LA Test 3"} local IFLocations = {"IF Test 1", "IF Test 2", "IF Test 3"} -- Location (according to the team) addEventHandler("onClientGUIClick", resourceRoot, function(button, state) if source == team_gridlist then local team = getSelectedTeam() if team then guiGridListClear(location_gridlist) if team == "Liberation Army" then outputChatBox("Test successful", 100, 255, 100) for _, locations_LA in ipairs(LALocations) do local location_row_LA = guiGridListAddRow(location_gridlist,locations_LA) --guiGridListSetItemText(location_gridlist, location_row_LA, location_col, locations_LA, false, false) end elseif team == "Imperial Forces" then for _, locations_IF in ipairs(IFLocations) do local location_row_IF = guiGridListAddRow(location_gridlist,locations_IF) --guiGridListSetItemText(location_gridlist, location_row_IF, location_col, locations_IF, false, false) end end end end end) -- Skin -- Weapon
  8. function getPlayerFromPhoneNumber(phoneNumber) local phoneNumber = tonumber(phoneNumber) for i,v in pairs(getElementsByType("player")) do local playerNumber = tonumber(getElementData(v,"YOUR_PHONE_NUMBER_DATA_HERE")) if playerNumber and playerNumber == phoneNumber then return v end end return false end try this
  9. Mahlukat

    Text

    carshopWindow = guiCreateWindow(0.01, 0.22, 0.39, 0.58, "CarShop", true) guiSetVisible(carshopWindow, false) guiSetAlpha(carshopWindow, 1) guiWindowSetSizable(carshopWindow, false) carGridList = guiCreateGridList(0.02, 0.06, 0.47, 0.80, true, carshopWindow) guiGridListSetSelectionMode(carGridList, 0) carColumn = guiGridListAddColumn(carGridList, "Car", 0.4) costColumn = guiGridListAddColumn(carGridList, "$", 0.4) local cars = { ["Level1"] = { ------------------TEXT TEX {481, 50000},-- BMX {509, 50000},-- bike {529, 55000},-- Willard {492, 60000},-- Gleenwood }, ["Level2"] = { ------------------TEXT TEX {421, 60000},-- Whasington {466, 65000},-- Glendale {422, 65000},-- Bobcat {600, 70000},-- Picador {578, 70000},-- DFT-30 {582, 70000},-- Newsvan {410, 71000},-- Manana {489, 75000},-- Rancher {474, 75000},-- Hermes {491, 75000}, -- Virgo }, } function setTexts() for i,v in pairs(cars) do local row = guiGridListAddRow(carGridList) guiGridListSetItemText(carGridList,row,1,i,true,false) for i,k in pairs(v) do local model,price = unpack(k) local row2 = guiGridListAddRow(carGridList) guiGridListSetItemText(carGridList,row2,1,getVehicleNameFromModel(model),false,false) guiGridListSetItemText(carGridList,row2,2,price,false,false) end end end setTexts()
  10. Mahlukat

    Death

    try this addEventHandler("onPlayerWasted", root, function() local x,y,z = getElementPosition(source) spawnPlayer(source,x,y,z) end
  11. Yea, i tried but wiki said; This event is triggered when a remote player quits the game or leaves the server. It will not get triggered on the source player's client. (Use onClientResourceStop to save client side data when the local player quits.) thanks for help but it's still not triggered :((
  12. Hey i want to save table in client-side when localPlayer disconnected --client addEventHandler( "onClientResourceStop", resourceRoot,function() triggerServerEvent("Freeroam:SureKaydet", localPlayer, sureVerileri, true) if sureVerileri[localPlayer] and isTimer(sureVerileri[localPlayer].timer) then killTimer(sureVerileri[localPlayer].timer) end end) --server addEvent("Freeroam:SureKaydet", true) addEventHandler("Freeroam:SureKaydet", root, function(sureVerileri,bosmu) outputServerLog("triggered server") -- i can't see this message in console local hesap = getPlayerAccount(source) if not isGuestAccount(hesap) then outputServerLog("not guest") local sure = 60*10 if sureVerileri[source] and sureVerileri[source].sure then sure = sureVerileri[source].sure end exports.Hesaplar:SAD(hesap, "KiralikSure", sure) outputServerLog("saved.") outputServerLog(sure) if bosmu then exports.Hesaplar:SAD(hesap, "KiralikSureBos", true) end end end) but event isn't triggered :(( how can ido it? -
  13. Canceling this event has no effect. Cancel the client-side event onClientPlayerDamage instead.
  14. for disable skin changing; --server-side local yourCol = createColSphere(...) addEventHandler("onElementModelChange", root, function(oldModel,newModel) if getElementType(source) == "player" then if isElementWithinColShape(source,yourCol) then setTimer(setElementModel,50,1,source,oldModel) outputChatBox("You can't change skin in this place!",source,255,0,0) end end end)