Jump to content

TorNix~|nR

Members
  • Posts

    503
  • Joined

  • Last visited

Posts posted by TorNix~|nR

  1. Hello guys, I get this error when I use the convertNumber method

    attempt to perform arithmetic on local 'oldZcount' (a string value)

    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
    
    --ADJUSTS PLAYERS ZOMBIE KILL SCORE
    function deanimated( ammo, attacker, weapon, bodypart )
    	if (attacker) then
    		if (getElementType ( attacker ) == "player") and (getElementType ( source ) == "ped") then
    			if (getElementData (source, "zombie") == true) then
    	-- HERE --
    	local oldZcount = convertNumber(getElementData ( attacker, "Zombie kills" ))
    	-- HERE --
    				if oldZcount ~= false then
    					setElementData ( attacker, "Zombie kills", oldZcount+1  )
    					triggerEvent ( "onZombieWasted", source, attacker, weapon, bodypart )
    				else
    					setElementData ( attacker, "Zombie kills", 1  )
    					triggerEvent ( "onZombieWasted", source, attacker, weapon, bodypart )
    				end
    			end
    		end
    	end
    end
    addEventHandler("onPedWasted", resourceRoot, deanimated)

    any help please?

  2. I made a gate using the object number (990) it can be broken for example by a car, I want to fix it

    when I used the editor resource just to test it, I made it frozen and it worked (it can not be damaged)

  3. I still can click only to players with no hex, I think this is the problem

    getPlayerFromName(guiGridListGetItemText(gridOpenSenior, guiGridListGetSelectedItem(gridOpenSenior), 1))

    can gsub be added to this?

  4. Hello guys, I have a problem, I'm trying to hide hex colors from a grid list and it didn't work

        for id,player in ipairs(getElementsByType("player")) do
          local row = guiGridListAddRow(gridlist)
    	  setTimer ( guiGridListSetItemText , 100 , 1 , gridlist, row, column, getPlayerName(player):gsub("#%x%x%x%x%x%x", ""), false, false ) 
        end

    any help please?

  5. Hello guys I'm using my friend @WASSIm.'s script of saving

    It saves everything except ped clothes, and it have debug problems

        if (clothes) then
            for _, cloth in pairs(fromJSON(clothes)) do
                local type, texture, model = unpack(cloth)
                addPedClothes(source, type, texture, model)
            end
        end
    
    
    function getAllPedClothes(thePed)
        local clothes = { }
        for type=0, 17 do
            local texture, model = getPedClothes(thePed, type)
            if (texture) and (model) then
                table.insert(clothes, {type, texture, model})
            end
        end
        return clothes
    end

    fromJSON Expected string at argument 1 got boolean and Expected number, got non-convertible string. This warning may be an error in future versions

    any help please?

  6. I'm using the latest admin panel I only added logs into it there's not a problem at all

    I want to know if it is possible that the bug is made by 1 resource

  7. Hello guys, I have a little problem, and I don't know from where it came

    Sometimes when some players enter the server it starts lagging so much, when I take a look in Admin Panel (the default admin panel)

    I see that every resource is multiplied by 2, means for example 20 resources become 40 resources, is there any solution please?

  8. Yeah it's working @Tekken

    the working code:

    local timerTimer = {};
    
    function sortTimer(plr,timer,time)
    	if plr and timer and time then
    		if isTimer(timerTimer[plr]) then
    		killTimer(timerTimer[plr]);
    	end
    		timerTimer[plr] = setTimer(function(plr)
    				time = time - 60;
    				m,s,cs = msToTimeStr(time);
    				fullTime = m.." M "..s.." S";
    				textItemSetText(timer,""..tostring(fullTime).."");
    				if ( tonumber(m) <= 0 and tonumber(s) <= 0 and tonumber(cs) <= 0 ) then
    				stopJailTimer(plr, timer)		
    				end
    		end , 50 , 0 ,plr );
    	end
    end
    
    function stopJailTimer(plr)
    	textDestroyDisplay(TimerDisplay) ------HERE IS THE PROBLEM
    	if TimerText then
    	textDestroyTextItem(TimerText) ------HERE IS THE PROBLEM
    	end
    	if isTimer(timerTimer[plr]) then
    		killTimer(timerTimer[plr])
    	end
    end

    but a little more problem

    when 2 players are in jail and the timer is counting, when they get out, only the last player get the destroy of the text, but the other it doesn't disappear

    here's the code:

    function startJailTimer(plr,jailTime)
    	if plr then
    		TimerDisplay = textCreateDisplay()
    		m,s,cs = msToTimeStr(jailTime)
    		fullTime = m..":"..s
    		TimerText = textCreateTextItem ( ""..tostring(jailTime).."", 0.39, 0.7 ,"medium",255,255,255,255,2.0,"left","center",255)
    		textDisplayAddText ( TimerDisplay, TimerText )
    		textDisplayAddObserver ( TimerDisplay, plr )
    		sortTimer(plr,TimerText,jailTime)
    	end
    end

    help please?

  9. Sorry, that :~ I think is caused by changing the LUA to HTML I think, it's not like that in my code

    You think I can use this?

    local allJailTimers = {};
    
    function jailPlayer(plr,timer,time)
    if not isTimer(allJailTimers[player]) then  
    	if plr and timer and time then
    		if isTimer(timer:~Timer) then
    		killTimer(timer:~Timer)
    	end
    		timer:~Timer = setTimer(function(plr)
    				time = time - 60
    				m,s,cs = msToTimeStr(time)
    				fullTime = m.." M "..s.." S"
    				textItemSetText(timer,""..tostring(fullTime).."")
    		end , 50 , 0 ,plr )
            end
    	end
    end

     

  10. Hello guys I have a little problem with this code, when a player enter the jail it start counting the timer without a problem

    but when another player enter the jail too (means they become 2 in jail), the text timer stop counting for the first player (it freezes for example in Time Left: 0:40 seconds)

    and start counting for only the second player

    Code

    function startJailTimer(source,jailtimex) -- to start mission timer ..
    	if source then
    		TimerDisplay = textCreateDisplay()
    		m,s,cs = msToTimeStr(jailtimex)
    		fullTime = m..":"..s
    		TimerText = textCreateTextItem ( "Time Left: "..tostring(jailTime).."", 0.39, 0.7 ,"medium",255,255,255,255,2.0,"left","center",255)
    		textDisplayAddText ( TimerDisplay, TimerText )
    		textDisplayAddObserver ( TimerDisplay, source )
    		sortTimer:~(source,TimerText,jailtimex)
    	end
    end
    
    function msToTimeStr(ms)
    	if not ms then
    		return ''
    	end
    	
    	if ms < 0 then
    		return "0","00","00"
    	end
    	
    	local centiseconds = tostring(math.floor(math.fmod(ms, 1000)/10))
    	if #centiseconds == 1 then
    		centiseconds = '0' .. centiseconds
    	end
    	local s = math.floor(ms / 1000)
    	local seconds = tostring(math.fmod(s, 60))
    	if #seconds == 1 then
    		seconds = '0' .. seconds
    	end
    	local minutes = tostring(math.floor(s / 60))
    	
    	return minutes, seconds, centiseconds
    end
    
    function sortTimer:~(source,timer,time) -- to sort timer's :~ ..
    	if timer and time then
    		if isTimer(timer:~Timer) then
    		killTimer(timer:~Timer)
    	end
    		timer:~Timer = setTimer(function(source)
    				time = time - 60
    				m,s,cs = msToTimeStr(time)
    				fullTime = m..":"..s
    				textItemSetText(timer,""..tostring(fullTime).."")
    		end , 50 , 0 ,source )
    	end
    end
    
    function stopJailTimer(source)
    	textDestroyDisplay(TimerDisplay)
    	if TimerText then
    	textDestroyTextItem(TimerText)
    	end
    	if isTimer(timer:~Timer) then
    		killTimer(timer:~Timer)
    	end
    end

    any help please?

×
×
  • Create New...