-
Posts
439 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Turbe$Z
-
local lastMoney = 0 local drawMoney = nil setTimer(function() local playerMoney2 = getPlayerMoney(localPlayer) local convertedMoney2 = comma_value(playerMoney2) if playerMoney2 ~= lastMoney then drawMoney = playerMoney2 - lastMoney if isTimer(resetingTimer) then killTimer(resetingTimer) end resetingTimer = setTimer(function() drawMoney = nil end, 3000, 1) end lastMoney = playerMoney2 end, 50, 0) addEventHandler("onClientRender", getRootElement(), function() if drawMoney then removeEventHandler("onClientRender", root, alappenz) dxDrawText((drawMoney > 0 and ("+" .. drawMoney) or drawMoney), screenW * 0.8674, screenH * 0.0389, screenW * 0.9889, screenH * 0.0644, drawMoney > 0 and tocolor(0, 255, 0) or tocolor(255, 0, 0), 1, "default-bold", "center", "center") else addEventHandler("onClientRender", root, alappenz) end end) function comma_value(n) -- credit http://richard.warburton.it local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$') return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right end still not working
-
local lastMoney = 0 local drawMoney = nil setTimer(function() local playerMoney2 = getPlayerMoney(localPlayer) local convertedMoney2 = convertNumber(playerMoney2) if playerMoney2 ~= lastMoney then drawMoney = playerMoney2 - lastMoney if isTimer(resetingTimer) then killTimer(resetingTimer) end resetingTimer = setTimer(function() drawMoney = nil end, 3000, 1) end lastMoney = playerMoney2 end, 50, 0) addEventHandler("onClientRender", getRootElement(), function() if drawMoney then removeEventHandler("onClientRender", root, alappenz) dxDrawText((drawMoney > 0 and ("+" .. drawMoney) or drawMoney), screenW * 0.8674, screenH * 0.0389, screenW * 0.9889, screenH * 0.0644, drawMoney > 0 and tocolor(0, 255, 0) or tocolor(255, 0, 0), 1, "default-bold", "center", "center") end end) function convertNumber ( number ) local formatted = number while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1 %2') if ( k==0 ) then break end end return formatted end Thanks:D convertNumber why not working?
-
function fvalt( prevSlot, newSlot ) if getElementData (target, "greenzone") then setPedWeaponSlot(source,0) end end addEventHandler ( "onClientPlayerWeaponSwitch", localPlayer, fvalt ) i added this to a greenzones script, but this doesn't working, why?
-
function findPlayer(name) local matches = {} for i,v in ipairs(getElementsByType("player")) do if getPlayerName(v) == name then return v end local playerName = getPlayerName(v):gsub("#%x%x%x%x%x%x", "") playerName = playerName:lower() if playerName:find(name:lower(), 0) then table.insert(matches, v) end end if #matches == 1 then return matches[1] end return false end function string.count (text, search) if ( not text or not search ) then return false end return select ( 2, text:gsub ( search, "" ) ); end addCommandHandler("pay", function(player, cmd, name, amount) local amount = tonumber(amount) if name and amount then local target = findPlayer(name) local money = getPlayerMoney(target) if (string.count(amount,"-")) then amount = str:gsub('%A',amount) end if money >= amount then takePlayerMoney(player, amount) givePlayerMoney(target, amount) outputChatBox("#FFffFF Átutaltál neki: #c8c8c8" .. getPlayerName(target) .. " #0088ff" .. amount .. " Forintot.", player, 0, 255, 0, true) outputChatBox("#c8c8c8 " .. getPlayerName(player) .. " #FFffFFutalt neked #0088ff" .. amount .. " Forintot.", target, 0, 255, 0, true) else outputChatBox("#FFffFF Nincs elég pénzed.", target, 255, 0, 0, true) end end end ) doesn't working error: attempt to index local 'text' (a number value)
-
function findPlayer(name) local matches = {} for i,v in ipairs(getElementsByType("player")) do if getPlayerName(v) == name then return v end local playerName = getPlayerName(v):gsub("#%x%x%x%x%x%x", "") playerName = playerName:lower() if playerName:find(name:lower(), 0) then table.insert(matches, v) end end if #matches == 1 then return matches[1] end return false end addCommandHandler("pay", function(player, cmd, name, amount) local amount = tonumber(amount) if name and amount then local target = findPlayer(name) local money = getPlayerMoney(target) if money >= amount then takePlayerMoney(player, amount) givePlayerMoney(target, amount) outputChatBox("#FFffFF Átutaltál neki: #c8c8c8" .. getPlayerName(target) .. " #0088ff" .. amount .. " Forintot.", player, 0, 255, 0, true) outputChatBox("#c8c8c8 " .. getPlayerName(player) .. " #FFffFFutalt neked #0088ff" .. amount .. " Forintot.", target, 0, 255, 0, true) else outputChatBox("#FFffFF Nincs elég pénzed.", target, 255, 0, 0, true) end end end ) why can i 'pay' minus amount? how to fix this?
-
my client: function coronaa() triggerServerEvent ("szoveg", root, getLocalPlayer()) end addEventHandler ( "onClientMarkerHit", ajtomegilyenek, coronaa ) and the server: addEvent( "szoveg", true ) addEventHandler( "szoveg", root, function(thePlayer) outputChatBox("Text", thePlayer, r,g,b, true) end) how to fix this?
-
function text_render ( ) for i,v in pairs ( messages ) do local x, y, z = unpack ( v ) local sx, sy, _ = getScreenFromWorldPosition ( x, y, z ) if sx then dxDrawText ( i, sx+2, sy+2, sw, sh, tocolor ( 0, 0, 0, 255 ), 2.0, "default-bold" ) dxDrawText ( i, sx, sy, sw, sh, tocolor ( 0, 136, 255, 255 ), 2.0, "default-bold" ) end end end addEventHandler("onClientRender",getRootElement(),text_render) i want set max distance for this, but how?
-
if AdminGate then destroyElement(AdminGate) end local AdminGate = createObject ( 1560, 1346.78, -1759.83630, 12.5, 0, 0, 0 ) local state = 0 function move() if state == 0 then moveObject ( AdminGate, 2500, 1348.68652, -1759.83630, 12.5) state = state + 1 elseif state == 1 then moveObject ( AdminGate, 2500, 1346.78, -1759.83630, 12.5) state = state - 1 end end addCommandHandler("coopajto", move ) fileDelete("c.lua") when i type the command, the door move just for me how to fix this?
-
i want download weapon mods with script, and sounds, but i cannot find :c where can i download?
-
Thaaaaaanks :DDDD