Jump to content

K4stic

Members
  • Posts

    708
  • Joined

  • Last visited

Everything posted by K4stic

  1. K4stic

    Pls help

    how i can make to one serial can make max 2 accounts ?
  2. Try function motel (thePlayer) setElementInterior ( thePlayer, 15, 2215.8032226563, -1150.6900634766, 1025.796875 ) setTimer ( function (thePlayer) setElementInterior(thePlayer,interiorIdHere) end, 10000, 1 ) outputChatBox ( "[#f1f1f1/Motel]#ff0000O player ".. getPlayerName(thePlayer) .." foi para o Motel vá tambem #f1f1f1/Motel", getRootElement(),255,20,0,true) end addCommandHandler ( "motel", motel )
  3. because they using the giveplayerMoney if they used element data money then will work + bad maked at alive and ded players That because you have that Probs Mossy
  4. K4stic

    Help Time

    Now Working Thx you #X_Mr.Pres[T]ege_X#
  5. K4stic

    Help Time

    Nothing just then resource restarting is sent me time to 0
  6. and more easy to no use timer to create blip attacked to theMugPlace createBlipAttachedTo( theMugPlace, 0, 2, 0, 0, 0 )
  7. K4stic

    Help Time

    Not work and i talk for who login account no guest or others
  8. K4stic

    Help Time

    so use this? function onrestart ( playeraccount ) local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") for _,player in ipairs ( getElementsByType ( "player" ) ) do setElementData ( source, "PlayTime", time ) t[ player ]["hour"] = tonumber(hou) or 0 t[ player ]["min"] = tonumber(min) or 0 t[ player ]["sec"] = tonumber(sec) or 0 end end addEventHandler ( "onResourceStart", resourceRoot, onrestart )
  9. K4stic

    Help Time

    local t = { } function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..' Hours') end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "PlayTime-hour", tostring(hour) ) setAccountData ( playeraccount, "PlayTime-min", tostring(min) ) setAccountData ( playeraccount, "PlayTime-sec", tostring(sec) ) setAccountData ( playeraccount, "PlayTime", tostring(sValue) ) end t[ source ] = nil end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") if ( time ) then setElementData ( source, "PlayTime", time ) t[ source ]["hour"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "PlayTime",0 ) end end end addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) addEventHandler ( "onResourceStart", resourceRoot, onPlayerLogin ) function onrestart ( ) local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") setElementData ( source, "PlayTime", time ) t[ source ]["hour"] = tonumber(hou) or 0 t[ source ]["min"] = tonumber(min) or 0 t[ source ]["sec"] = tonumber(sec) or 0 end end addEventHandler ( "onResourceStart", resourceRoot, onrestart ) something like this?
  10. K4stic

    Help Time

    i Find this script on Community and i need Help to remake it The Problem is then i restart the resource and i'm in Game then it set me 0 hours/min/sec local t = { } function checkValues( source,arg1,arg2) if (arg2 >= 60) then t[ source ][ 'min' ] = tonumber( t[ source ][ 'min' ] or 0 ) + 1 t[ source ][ 'sec' ] = 0 end if (arg1 >= 60) then t[ source ][ 'min' ] = 0 t[ source ][ 'hour' ] = tonumber( t[ source ][ 'hour' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hour"] = 0, ["min"] = 0, ["sec"] = 0 } end t[ v ][ 'sec' ] = tonumber( t[ v ][ 'sec' ] or 0 ) + 1 local min,sec = checkValues ( v, t[ v ][ 'min' ] or 0, t[ v ][ 'sec' ] or 0 ) local hour = tonumber( t[ v ][ 'hour' ] or 0 ) setElementData( v, "PlayTime", tostring( hour )..' Hours') end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'PlayTime' ) local hour = tonumber( t[ source ][ 'hour' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "PlayTime-hour", tostring(hour) ) setAccountData ( playeraccount, "PlayTime-min", tostring(min) ) setAccountData ( playeraccount, "PlayTime-sec", tostring(sec) ) setAccountData ( playeraccount, "PlayTime", tostring(sValue) ) end t[ source ] = nil end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "PlayTime" ) local hou = getAccountData ( playeraccount, "PlayTime-hour") local min = getAccountData ( playeraccount, "PlayTime-min") local sec = getAccountData ( playeraccount, "PlayTime-sec") if ( time ) then setElementData ( source, "PlayTime", time ) t[ source ]["hour"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "PlayTime",0 ) setAccountData ( playeraccount, "PlayTime",0 ) end end end addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) addEventHandler ( "onResourceStart", resourceRoot, onPlayerLogin )
  11. with scale setObjectScale it make only scale to you and others see the element bigger or smaller
  12. at line 16 remove the repeat until
  13. K4stic

    race Help

    And trigger working perfect i saying only at line 37 is the bug with gsub Full code local sw,sh = guiGetScreenSize() function addTeamColor(player) local playerTeam = getPlayerTeam ( player ) if ( playerTeam ) then local r,g,b = getTeamColor ( playerTeam ) local n1 = toHex(r) local n2 = toHex(g) local n3 = toHex(b) if r <= 16 then n1 = "0"..n1 end if g <= 16 then n2 = "0"..n2 end if b <= 16 then n3 = "0"..n3 end return "#"..n1..""..n2..""..n3..""..getPlayerNametagText(player) else return getPlayerNametagText(player) end end function toHex ( n ) local hexnums = {"0","1","2","3","4","5","6","7", "8","9","A","B","C","D","E","F"} local str,r = "",n%16 if n-r == 0 then str = hexnums[r+1] else str = toHex((n-r)/16)..hexnums[r+1] end return str end function showWinMessageF (player) PlayerName = addTeamColor(player) addEventHandler ( "onClientRender", getRootElement(), WinTextRendering ) setTimer(function() removeEventHandler("onClientRender",getRootElement(), WinTextRendering) end, 6000,1) end addEvent( "showWinMessage", true ) addEventHandler( "showWinMessage", getRootElement(), showWinMessageF ) function WinTextRendering() dxDrawColorTextLine(''..string.gsub( PlayerName, '#%x%x%x%x%x%x', '' ).." is the final survivor!", 0, -148, sw, sh-148, tocolor(0,0,0,255), 1, "bankgothic", "center", "center") dxDrawColorText(''..PlayerName..' #ffffffis the final #ffffffsurvivor!', 0, -150, sw, sh-150, tocolor(255,255,255,Alpha), 1, "bankgothic", "center", "center") 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 function dxDrawColorTextLine(str, ax, ay, bx, by, color, scale, font, alignX, alignY) Texts = {} Texts = string.explode(str,"/newline/") for i=1,#Texts do dxDrawText(Texts[i], ax, ay+(dxGetFontHeight ( scale, font ))*(i-1), bx, by, color, scale, font, alignX, alignY) end end function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY) Texts = {} Texts = string.explode(str,"/newline/") for i=1,#Texts do dxDrawColorTextNext(Texts[i], ax, ay+(dxGetFontHeight ( scale, font ))*(i-1), bx, by, color, scale, font, alignX, alignY) end end function dxDrawColorTextNext(str, ax, ay, bx, by, color, scale, font, alignX, alignY) if alignX then if alignX == "center" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = ax + (bx-ax)/2 - w/2 elseif alignX == "right" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = bx - w end end if alignY then if alignY == "center" then local h = dxGetFontHeight(scale, font) ay = ay + (by-ay)/2 - h/2 elseif alignY == "bottom" then local h = dxGetFontHeight(scale, font) ay = by - h end end local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), Alpha) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), Alpha) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end function string.explode(self, separator) Check("string.explode", "string", self, "ensemble", "string", separator, "separator") if (#self == 0) then return {} end if (#separator == 0) then return { self } end return loadstring("return {\""..self:gsub(separator, "\",\"").."\"}")() end function Check(funcname, ...) local arg = {...} if (type(funcname) ~= "string") then error("Argument type mismatch at 'Check' ('funcname'). Expected 'string', got '"..type(funcname).."'.", 2) end if (#arg % 3 > 0) then error("Argument number mismatch at 'Check'. Expected #arg % 3 to be 0, but it is "..(#arg % 3)..".", 2) end for i=1, #arg-2, 3 do if (type(arg[i]) ~= "string" and type(arg[i]) ~= "table") then error("Argument type mismatch at 'Check' (arg #"..i.."). Expected 'string' or 'table', got '"..type(arg[i]).."'.", 2) elseif (type(arg[i+2]) ~= "string") then error("Argument type mismatch at 'Check' (arg #"..(i+2).."). Expected 'string', got '"..type(arg[i+2]).."'.", 2) end if (type(arg[i]) == "table") then local aType = type(arg[i+1]) for _, pType in next, arg[i] do if (aType == pType) then aType = nil break end end if (aType) then error("Argument type mismatch at '"..funcname.."' ('"..arg[i+2].."'). Expected '"..table.concat(arg[i], "' or '").."', got '"..aType.."'.", 3) end elseif (type(arg[i+1]) ~= arg[i]) then error("Argument type mismatch at '"..funcname.."' ('"..arg[i+2].."'). Expected '"..arg[i].."', got '"..type(arg[i+1]).."'.", 3) end end end fileDelete("winEffect.lua")
  14. K4stic

    race Help

    sorry how i can fix it i just first time using string.gsub bad know it and the addTeamColor(player) getting other function me prob only with string.gsub
  15. K4stic

    race Help

    Error line 9: bad argument #1 to 'gsub' (string expected, got boolean) function showWinMessageF (player) PlayerName = addTeamColor(player) addEventHandler ( "onClientRender", getRootElement(), WinTextRendering ) setTimer(function() removeEventHandler("onClientRender",getRootElement(), WinTextRendering) end, 6000,1) end addEvent( "showWinMessage", true ) addEventHandler( "showWinMessage", getRootElement(), showWinMessageF ) dxDrawColorTextLine(''..string.gsub(PlayerName,"#%x%x%x%x%x%x",'').." is the final survivor!", 0, -148, sw, sh-148, tocolor(0,0,0,255), 1, "bankgothic", "center", "center") function dxDrawColorTextLine(str, ax, ay, bx, by, color, scale, font, alignX, alignY) Texts = {} Texts = string.explode(str,"/newline/") for i=1,#Texts do dxDrawText(Texts[i], ax, ay+(dxGetFontHeight ( scale, font ))*(i-1), bx, by, color, scale, font, alignX, alignY) end end function string.explode(self, separator) Check("string.explode", "string", self, "ensemble", "string", separator, "separator") if (#self == 0) then return {} end if (#separator == 0) then return { self } end return loadstring("return {\""..self:gsub(separator, "\",\"").."\"}")() end
  16. say what is your Problem
  17. K4stic

    Problem

    Race Gamemodes using own charger color nick
  18. Good Track,Deco i realy like it Nice one Bro
×
×
  • Create New...