OrbTanT Posted July 18, 2014 Author Share Posted July 18, 2014 It has not yet been, still the same error that I quoted above, only this time only appears when I mato the player from the other team, and does not consider score Link to comment
Max+ Posted July 18, 2014 Share Posted July 18, 2014 --ClientSide , function justForTest() end function msToTimeStr( ms ) if not ms then return '' 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 ) ) if #minutes == 1 then minutes = '0' .. minutes end return minutes .. ':' .. seconds end myTimer = setTimer( justForTest, 180*1000, 1 ) addEventHandler( "onClientRender", root, function( ) if isTimer( myTimer ) then remaining, _, _ = getTimerDetails(myTimer) remaining = msToTimeStr( remaining ) if remaining then dxDrawText( remaining, 120, 442, 350, 300, tocolor(255, 255, 255, 255), 1.0, "pricedown", "left", "top", false, false, true, false, false) end end end ) local Bscore = 0 local Wscore = 0 addEventHandler("onClientPlayerWasted", function ( killer ) local kteam = getPlayerTeam(killer) if(getTeamName(kteam) == "Team1")then Wscore = Wscore + 1 elseif(getTeamName(kteam) == "Team2") then Bscore = Bscore + 1 end end ) function onRender() local team = getPlayerTeam(localPlayer) if(getTeamName(team) == "Team1" or getTeamName(team) == "Team2") then dxDrawText("Team1:"..tostring(Bscore), 0, 500, 319, 426, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", true, true, true, true, false) dxDrawText("Team2:"..tostring(Wscore), 0, 600, 319, 426, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", true, true, true, true, false) end end addEventHandler("onClientRender", root, onRender) Link to comment
OrbTanT Posted July 18, 2014 Author Share Posted July 18, 2014 Now is giving the following error: Error: pasta/client.lua:54: Bad aegument @ 'addEventHandler' [Expected element at argument 2, got function] addEventHandler("onClientRender", root, function() dxDrawRectangle(60, 320, 250, 175, tocolor(0, 0, 0, 175), true) dxDrawText("Score", 225, 325, 73, 340, tocolor(255, 255, 255, 255), 1.1, "default", "left", "top", false, false, true, false, false) dxDrawText("Mortes:", 70, 365, 73, 340, tocolor(255, 255, 255, 255), 1.1, "default", "left", "top", false, false, true, false, false) dxDrawText("Mortes:", 70, 405, 73, 340, tocolor(255, 255, 255, 255), 1.1, "default", "left", "top", false, false, true, false, false) dxDrawText("TEMPO:", 70, 450, 73, 340, tocolor(255, 255, 255, 255), 1.1, "default", "left", "top", false, false, true, false, false) end ) function justForTest() end function msToTimeStr( ms ) if not ms then return '' 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 ) ) if #minutes == 1 then minutes = '0' .. minutes end return minutes .. ':' .. seconds end myTimer = setTimer( justForTest, 180*1000, 1 ) addEventHandler( "onClientRender", root, function( ) if isTimer( myTimer ) then remaining, _, _ = getTimerDetails(myTimer) remaining = msToTimeStr( remaining ) if remaining then dxDrawText( remaining, 120, 442, 350, 300, tocolor(255, 255, 255, 255), 1.0, "pricedown", "left", "top", false, false, true, false, false) end end end ) local Bscore = 0 local Wscore = 0 addEventHandler("onClientPlayerWasted", function ( killer ) local kteam = getPlayerTeam(killer) if(getTeamName(kteam) == "Team1") then Wscore = Wscore + 1 elseif(getTeamName(kteam) == "Team2") then Bscore = Bscore + 1 end end ) function onRender() local team = getPlayerTeam(localPlayer) if(getTeamName(team) == "Team1" or getTeamName(team) == "Team2") then dxDrawText("Team1:"..tostring(Bscore), 70, 340, 319, 426, tocolor(255, 0, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) dxDrawText("Team2:"..tostring(Wscore), 70, 380, 319, 426, tocolor(0, 255, 0, 255), 1.00, "pricedown", "left", "top", false, false, true, false, false) end end addEventHandler("onClientRender", root, onRender) Link to comment
Et-win Posted July 18, 2014 Share Posted July 18, 2014 addEventHandler("onClientPlayerWasted", getRootElement() Why you don't take time by yourself to look at it? Do you even look at what we give you? Link to comment
OrbTanT Posted July 18, 2014 Author Share Posted July 18, 2014 Concerted one thing and error appears in another, this time on the line, 56.57 and 59, bad among @getplayerteam , MUST be why not using a function create team? Why am I creating the team by the panel from admin to the test Link to comment
OrbTanT Posted July 18, 2014 Author Share Posted July 18, 2014 Concerted, is now working very well the script, only had to coordinate the @getplayerteam, the dxdraw in function addEventHandler("onClientPlayerWasted", function ( killer ) local kteam = getPlayerTeam(killer) if(getTeamName(kteam) == "Team1") then Wscore = Wscore + 1 elseif(getTeamName(kteam) == "Team2") then Bscore = Bscore + 1 end end ) to: addEventHandler("onClientPlayerWasted", getRootElement(), function ( localplayer ) local team = getPlayerTeam(localPlayer) if(getTeamName(team) == "Team1") then Wscore = Wscore + 1 elseif(getTeamName(team) == "Team2") then Bscore = Bscore + 1 end end ) Thank all of you for your help Link to comment
OrbTanT Posted July 18, 2014 Author Share Posted July 18, 2014 The script is working normal, but only has a problem, the score only account on the client, when I mato and hill to the other team, account score for the time2, more my friend helping me test was counting for the team1 only on his side. Link to comment
Max+ Posted July 18, 2014 Share Posted July 18, 2014 The script is working normal, but only has a problem, the score only account on the client, when I mato and hill to the other team, account score for the time2, more my friend helping me test was counting for the team1 only on his side. please be more clear i didn't get what you mean . Link to comment
OrbTanT Posted July 19, 2014 Author Share Posted July 19, 2014 Good, i step part of team1, I mato player of team2. have to add score +1for the team1, More add to the team2. And the same thing happens with the team2, Only adds score for the team1 Link to comment
Max+ Posted July 19, 2014 Share Posted July 19, 2014 Good, i step part of team1, I mato player of team2. have to add score +1for the team1, More add to the team2. And the same thing happens with the team2, Only adds score for the team1 you mean it's add +1 for team 1 only and team 2 dont ? Link to comment
Max+ Posted July 19, 2014 Share Posted July 19, 2014 (edited) --ClientSide , function justForTest() end function msToTimeStr( ms ) if not ms then return '' 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 ) ) if #minutes == 1 then minutes = '0' .. minutes end return minutes .. ':' .. seconds end myTimer = setTimer( justForTest, 180*1000, 1 ) addEventHandler( "onClientRender", root, function( ) if isTimer( myTimer ) then remaining, _, _ = getTimerDetails(myTimer) remaining = msToTimeStr( remaining ) if remaining then dxDrawText( remaining, 120, 442, 350, 300, tocolor(255, 255, 255, 255), 1.0, "pricedown", "left", "top", false, false, true, false, false) end end end ) local Bscore = 0 local Wscore = 0 addEventHandler("onClientPlayerWasted",root, function ( killer ) if ( killer and killer ~= source ) then if (getTeamName(getPlayerTeam(killer)) == "Team1") then Wscore = Wscore + 1 elseif (getTeamName(getPlayerTeam(killer)) == "Team2") then Bscore = Bscore + 1 end end end ) function onRender() local team = getPlayerTeam(localPlayer) if(getTeamName(team) == "Team1" or getTeamName(team) == "Team2") then dxDrawText("Team1:"..tostring(Bscore), 0, 500, 319, 426, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", true, true, true, true, false) dxDrawText("Team2:"..tostring(Wscore), 0, 600, 319, 426, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", true, true, true, true, false) end end addEventHandler("onClientRender", root, onRender) # Edited /debugscript 3 Edited July 19, 2014 by Guest Link to comment
OrbTanT Posted July 19, 2014 Author Share Posted July 19, 2014 continues giving bad argument in line 46 and 48, @getTeamName Link to comment
Max+ Posted July 19, 2014 Share Posted July 19, 2014 continues giving bad argument in line 46 and 48, @getTeamName Copy it again , and does the dxdraw working ? Link to comment
OrbTanT Posted July 19, 2014 Author Share Posted July 19, 2014 Presented error em @GetTeamName, More this has no error, and adds the score, more only for the player, for the other player shows only for him, I think that is due to "localplayer" or should give a way to add on the server. If you could get into my server would understand better just what I'm talking about, explaining is complicated Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now