Jump to content

nikitafloy

Members
  • Posts

    419
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by nikitafloy

  1. I do not know what the code do you have, but you can check length of the text and move a line.

    local text = "hello, im text"
    
    if string.length(text) > 5 then
      local leftPartOfText = string.sub(text, 0, 5)
      local rightPartOfText = string.sub(text, 5)
      
      text = leftPartOfText .. "\n" .. rightPartOfText
    end

     

  2. local times = {['10m'] = 10 * 60000, ['1h'] = 60 * 60000}
    -- print(times['10m'])
    local timeUnits = {['m'] = 60000}
    -- 10m
    local number = string.match('10m', '%d+')
    local unit = string.match('10m', '%a+')
    -- print(tonumber(number) * timeUnits[unit])

     

  3. 1 hour ago, xLive said:

    Can you please explain this?
    why are you saving the account name? you can always use getAccountName

    "i need ... player account name instaead nikname ... example script that can save player nickname and after login set player nickname to saved nikname"
    @sinakh want that

    If he want to save nickname (player), not nickname (which was account name and was saved in accountData):

    addEventHandler('onPlayerLogin', root, function(_,account)
        local name = getAccountData(account, 'savedName')
    	if not name then
    		name = getPlayerName(source)
    		setAccountData(account, 'savedName', name)
    	end
    
    	setPlayerName(source, name)
    end)

     

    • Haha 1
  4. Set account name instead nickname:

    addEventHandler('onPlayerLogin', root, function(_,account)
        setPlayerName(source, getAccountName(account))
    end)

    Save account name on first server login and loading:

    addEventHandler('onPlayerLogin', root, function(_,account)
        local accName = getAccountData(account, 'savedName')
    	if not accName then
    		accName = getAccountName(account)
    		setAccountData(account, 'savedName', accName)
    	end
    
    	setPlayerName(source, accName)
    end)
    • Thanks 1
  5. i'll be use:
     

    local vehicle = createVehicle(...)
    
    local rotation = 0
    addEventHandler('onClientRender', root, function()
    	rotation = rotation + 0.5
    	-- I think, i shouldn't check and set rotation 0, if value will be > 360
    	setElementRotation(vehicle, 0, 0, rotation)
    end)

     

×
×
  • Create New...