Jump to content

Tokio

Members
  • Posts

    309
  • Joined

  • Last visited

Everything posted by Tokio

  1. i tried, and no errors and warnings
  2. but the outputchatbox function still not working
  3. this why not working? local playtime_string = string.format("%d:%02d:%02d", hours, minutes, seconds) if playtime_string then setElementData(player, "Játszott idő", tostring( hours )..' óra '..tostring( minutes )..' perc') end
  4. i have this script: exports.scoreboard:addScoreboardColumn('Játszott idő') 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 ][ 'hours' ] = tonumber( t[ source ][ 'hours' ] or 0 ) + 1 end return arg1, arg2 end setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do if (not t[ v ]) then t[ v ] = { ["hours"] = 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 hours = tonumber( t[ v ][ 'hours' ] or 0 ) setElementData( v, "Játszott idő", tostring( hours )..' óra '..tostring( min )..' perc' ) end end, 1000, 0 ) function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local sValue = getElementData( source,'Játszott idő' ) local hours = tonumber( t[ source ][ 'hours' ] or 0 ) local min = tonumber( t[ source ][ 'min' ] or 0 ) local sec = tonumber( t[ source ][ 'sec' ] or 0 ) setAccountData ( playeraccount, "Játszott idő-hours", tostring(hours) ) setAccountData ( playeraccount, "Játszott idő-min", tostring(min) ) setAccountData ( playeraccount, "Játszott idő-sec", tostring(sec) ) setAccountData ( playeraccount, "Játszott idő", tostring(sValue) ) end t[ source ] = nil end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local time = getAccountData ( playeraccount, "Játszott idő" ) local hou = getAccountData ( playeraccount, "Játszott idő-hours") local min = getAccountData ( playeraccount, "Játszott idő-min") local sec = getAccountData ( playeraccount, "Játszott idő-sec") if ( time ) then setElementData ( source, "Játszott idő", time ) t[ source ]["hours"] = tonumber(hou) t[ source ]["min"] = tonumber(min) t[ source ]["sec"] = tonumber(sec) else setElementData ( source, "Játszott idő",0 ) setAccountData ( playeraccount, "Játszott idő",0 ) end end end addEventHandler ( "onPlayerQuit", root, onPlayerQuit ) addEventHandler ( "onPlayerLogin", root, onPlayerLogin ) and i want add a function, what get players played time, and when reach xy played time (for example 30), then do something (for example output a text to chat box) How is it possible?
  5. the playerchangenick working fine, thanks but, the join & quit why not working? addEventHandler('onPlayerJoin', root, function(name1) triggerClientEvent (root, "createNotification", root, "#FFffFFcsatlakozott a szerverre.", "simple", name1) end ) addEventHandler('onPlayerQuit', root, function(name1) Reasons = { ["Unknown"] = "Nem tudni", ["Quit"] = "kilépett.", ["Kicked"] = "kirúgva a szerverről.", ["Banned"] = "kibanolva a szerverről.", ["Timed Out"] = "kifagyott.", ["Bad Connection"] = "rossz internetkapcsolat" } triggerClientEvent (root, "createNotification", root, "#FFffFF"..Reason, "simple", name1) end )
  6. Rly, but doesn't working. addEventHandler('onPlayerChangeNick', root, function(oldNick, newNick, text2, typ, name1, name2) triggerClientEvent ("createNotification", root, text2, typ, name1, name2) end ) what wrong? and yes, i have render
  7. Why not working this notification system? Client side: local notifications = {} function createNotification(text2, typ, name1, name2) if typ == "simple" then text = name1.." "..text2 data = { text = text, startTime = getTickCount(), endTime = getTickCount() + 10000 } elseif typ == "duble" then text = name1.." "..text2.." "..name2 data = { text = text, startTime = getTickCount(), endTime = getTickCount() + 10000 } end table.insert(notifications, data) end addEvent( "createNotification", true ) addEventHandler( "createNotification", localPlayer, createNotification ) Server side: addEventHandler('onClientPlayerChangeNick', root, function(oldNick, newNick, text2, typ, name1, name2) triggerServerEvent ("createNotification", root, text2, typ, name1, name2) end ) How to fix this problem in this script? Thanks the help!
×
×
  • Create New...