Jump to content

error clientside


OrbTanT

Recommended Posts

Help me, How can I correct the following errors

f293205cadc650b4bcb3090ca0e1d375.png

Client:

--Client 
  
--Remember you need to have 2 progressbars, because both teams can go and enter opposites area's. For more teams add more of course. 
local cProgressBar1 = guiCreateProgressBar(1, 1, 250, 50, false) 
local cProgressBar2 = guiCreateProgressBar(1, 50, 250, 50, false) 
  
local isRendering1 = false 
local isRendering2 = false 
  
function startFilling() 
    if (isRendering1 == true) then 
        if (guiProgressBarGetProgress(cProgressBar1) < 100) then --If the progress is less than 100, then... 
            local gTime, g2, g3 = getTimerDetails(warTimer1) 
            local gFormattedProgress = math.abs(math.floor((100/10000*gTime))) --Get the correct progress. A progressbar can be from 0 to 100, so do some math. (Mine sucks so this can be wrong... (A)) 
            guiProgressBarSetProgress(cProgressBar1, gFormattedProgress) --After doing some math, set the progress. 
        end 
    end 
    if (isRendering2 == true) then 
        if (guiProgressBarGetProgress(cProgressBar2) < 100) then --If the progress is less than 100, then... 
            local gTime, g2, g3 = getTimerDetails(warTimer2) 
            local gFormattedProgress = math.abs(math.floor((100/10000*gTime))) --Get the correct progress. A progressbar can be from 0 to 100, so do some math. (Mine sucks so this can be wrong... (A)) 
            guiProgressBarSetProgress(cProgressBar2, gFormattedProgress) --After doing some math, set the progress. 
        end 
    end 
end 
  
addEventHandler("onClientRender", getRootElement(), startFilling) 
  
function startTimer(gType) 
    if (gType == "timer1") then 
        warTimer1 = setTimer(function() startWar("Team1") end, 10000, 1) --Start the timer, start filling the progressbar 
        isRendering1 = true 
    elseif (gType == "timer2") then 
        warTimer2 = setTimer(function() startWar("Team1") end, 10000, 1) --Start the timer, start filling the progressbar 
        isRendering2 = true 
    end 
end 
  
addEvent("onStartWarTimer", true) 
addEventHandler("onStartWarTimer", getRootElement(), startTimer) 
  
function stopTimer(gType) 
    if (gType == "timer1") then 
        if (isTimer(warTimer1)) then 
            killTimer(warTimer1) 
        end 
        isRendering1 = false 
    elseif (gType == "timer2") then 
        if (isTimer(warTimer2)) then 
            killTimer(warTimer2) 
        end 
        isRendering2 = false 
    end 
end 
  
addEvent("onKillWarTimer", true) 
addEventHandler("onKillWarTimer", getRootElement(), stopTimer) 

server:

--Server 
  
local marker1 = createMarker(1, 1, 1) 
local marker2 = createMarker(-1, -1, -1) 
local team1 = createTeam("Team1", 255, 0, 0) 
local team2 = createTeam("Team2", 0, 255, 0) 
  
function startWar(gType) 
    if (gType == "Team1") then 
        outputChatBox("'"..getTeamName(team1).."' is in the area of '"..getTeamName(team2).."' for too long, war time!") 
    elseif (gType == "Team2") then 
        outputChatBox("'"..getTeamName(team2).."' is in the area of '"..getTeamName(team1).."' for too long, war time!") 
    end 
end 
  
function startWarTimer(tElement) 
    if (source == marker1) then --Marker of Team1 was hitted 
        if (getElementType(tElement) == "player") then --Check or the element is a player 
            if (getPlayerTeam(tElement) == team2) then --Check or he is in the opposite team 
                warTimer1 = setTimer(function() startWar("Team2") end, 10000, 1) --Start the timer (For Team2), if he is longer than 10 seconds in the marker, then start the war! 
                triggerClientEvent("onStartWarTimer", getRootElement(), "timer1") --Start the time on the client's too (Will have more time than the timer on the server because of time between triggering) 
            end 
        end 
    elseif (source == marker2) then 
        if (getElementType(tElement) == "player") then --Check or the element is a player 
            if (getPlayerTeam(tElement) == team1) then --Check or he is in the opposite team 
                warTimer2 = setTimer(function() startWar("Team1") end, 10000, 1) --Start the timer (For Team1), if he is longer than 10 seconds in the marker, then start the war! 
                triggerClientEvent("onStartWarTimer", getRootElement(), "timer2") --Start the time on the client's too (Will have more time than the timer on the server because of time between triggering) 
            end 
        end 
    end 
end 
  
function stopWarTimer(tElement) 
    if (source == marker1) then 
        if (isTimer(warTimer1)) then --If the timer exists 
            killTimer(warTimer1) --Kill it and kill it at the client's too 
            triggerClientEvent("onKillWarTimer", getRootElement(), "timer1") 
        end 
    elseif (source == marker2) then 
        if (isTimer(warTimer2)) then --If the timer exists 
            killTimer(warTimer2) --Kill it and kill it at the client's too 
            triggerClientEvent("onKillWarTimer", getRootElement(), "timer2") 
        end 
    end 
end 
  
addEventHandler("onMarkerHit", getRootElement(), startWarTimer) 
addEventHandler("onMarkerLeave", getRootElement(), stopWarTimer) 

Edited by Guest
Link to comment

Why are you posting a new topic? And like I said, there could be error's in the script because I typed it out of my head, but still it is for an example. Also, this has totally nothing to do with the error's because this script I made doesn't even use 'friendly', 'time' and 'countdown' as events.

Link to comment
  • Moderators

Simply by checking if the client is loaded.

When the client is loaded this event will be triggered at his pc. "onClientResourceStart"

After that you can send the data to that player, which will be 99% chance that the client will be able to accept the data.

Edited by Guest
Link to comment
because serverside start first. Which means the server is already sending data before the client has been loaded.

Which can be the problem.

Are you sure clientside is starting?

IIYAMA, don't spread incorrect information. It does not matter which script is added first at the meta file. The problem could be either in the script of the client which causes it to not load at all, so server responds that it doesn't see the event added, or the problem could be that the client file has not been added at all in the meta file.

Link to comment
  • Moderators

@ADCX

Pardon? Incorrect information? Shut your big mouth.

It does not matter which script is added first at the meta file.

I didn't said that you noob, go read better.

@ Shinigami

As I said before, let the server know when the client is loaded.

Link to comment
@ADCX

Pardon? Incorrect information? Shut your big mouth.

It does not matter which script is added first at the meta file.

I didn't said that you noob, go read better.

@ Shinigami

As I said before, let the server know when the client is loaded.

OK, so, 'expert', how do you propose to solve his problem?

Link to comment
There appears no error orange, only the last 2 errors which I quoted the top

Don't worry, Shinigami. I assume that IIYAMA will now start his local server and load up these scripts there, and look for solutions, so he can get back to me. xD

But, seriously. Shinigami, check your resources, did you add the files properly, maybe you have been editing the wrong client file, so the one in the resource's folder doesn't actually contain events. This code should theoretically trigger those events, even if some of the functions contain errors.

Link to comment

I tested it for you, it has no errors that you mentioned, only one that says that the client function 'startWar' is missing, but I assume it is in the other portion of the code. Either way, you have done something wrong when adding the client part of the code.

Link to comment

I found where the problem is, is in my territory, I don't know how to resolve

local pArea     = createRadarArea(2163.524169,2031.388061 , 150, 60, 255, 255, 255, 225 ) 
    local pCuboid   = createColCuboid (2163.524169,2031.388061 , 10, 197.5, 92, 30 ) 
      
addEventHandler("onResourceStart", resourceRoot, 
function() 
    outputDebugString("Gz Banco", 3, 0, 255, 0) 
end 
) 
  
            addEventHandler( 
                'onColShapeHit', pCuboid, 
                function( player ) 
                    if (getPlayerTeam( player )) then 
                        local pTeam = getPlayerTeam( player ) 
                        local iR, iG, iB = getTeamColor( pTeam ) 
                        local rR, gG, bB = getRadarAreaColor( pArea ) 
                        if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then 
                            triggerClientEvent(player, 'friendly', player) 
                        else 
                        setRadarAreaFlashing( pArea, true ) 
                        outputChatBox( "#F08080[GANGZONES] #F8F8FFA gang ".. getTeamName(getPlayerTeam(player)).." esta atacando a gang / na  #ff0000 GangZone  Banco!",getRootElement(),255,255,255,true); 
                        triggerClientEvent(player, 'time', player) 
                        triggerClientEvent(player, 'countdown', player) 
                        pArea1Timer = setTimer( function() 
                        setRadarAreaColor (pArea, iR, iG, iB, 999); 
                        givePlayerMoney( player, 4000 ); 
                        outputChatBox( "#F08080[GANGZONES] #F8F8FFA gang ".. getTeamName(getPlayerTeam(player)).." dominou o #ff0000 A GangZona Banco #F8F8FFA da gang / ! ",getRootElement(),255,255,255,true); 
                        setRadarAreaFlashing( pArea, false ) 
                        end, 5000, 1 ) 
                        end 
                    else 
                        triggerClientEvent(player, 'group', player) 
                    end 
                end 
        ) 
  

Link to comment

When I saw your 'friendly' event and other ones in the first post, I assumed that you renamed them to the ones that were in the script and that the picture is something you took before that. But now, this is the part you should have posted in the first place. It is now pretty obvious that you don't have those three events in the client. The person who made the code might have forgotten to add them to the client. Or if you have 'friendly' event in the client code, post it here so we can analyze.

Link to comment

ET win, you that create the script, could concert for me, I found the error, was the system of the territory that I use

territory

local pArea     = createRadarArea(2163.524169,2031.388061 , 150, 60, 255, 255, 255, 225 ) 
    local pCuboid   = createColCuboid (2163.524169,2031.388061 , 10, 197.5, 92, 30 ) 
      
addEventHandler("onResourceStart", resourceRoot, 
function() 
    outputDebugString("Gz Banco", 3, 0, 255, 0) 
end 
) 
  
            addEventHandler( 
                'onColShapeHit', pCuboid, 
                function( player ) 
                    if (getPlayerTeam( player )) then 
                        local pTeam = getPlayerTeam( player ) 
                        local iR, iG, iB = getTeamColor( pTeam ) 
                        local rR, gG, bB = getRadarAreaColor( pArea ) 
                        if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then 
                            triggerClientEvent(player, 'friendly', player) 
                        else 
                        setRadarAreaFlashing( pArea, true ) 
                        outputChatBox( "#F08080[GANGZONES] #F8F8FFA gang ".. getTeamName(getPlayerTeam(player)).." esta atacando a gang / na  #ff0000 GangZone  Banco!",getRootElement(),255,255,255,true); 
                        triggerClientEvent(player, 'time', player) 
                        triggerClientEvent(player, 'countdown', player) 
                        pArea1Timer = setTimer( function() 
                        setRadarAreaColor (pArea, iR, iG, iB, 999); 
                        givePlayerMoney( player, 4000 ); 
                        outputChatBox( "#F08080[GANGZONES] #F8F8FFA gang ".. getTeamName(getPlayerTeam(player)).." dominou o #ff0000 A GangZona Banco #F8F8FFA da gang / ! ",getRootElement(),255,255,255,true); 
                        setRadarAreaFlashing( pArea, false ) 
                        end, 5000, 1 ) 
                        end 
                    else 
                        triggerClientEvent(player, 'group', player) 
                    end 
                end 
        ) 
  

If you want of course, you have already helped me a lot =)

Link to comment
I found the error, was the system of the territory that I use

Already told you that since the start of this topic that it wasn't my script, because I didn't use that events.

If you want of course, you have already helped me a lot =)

Then I have to look into your script alot again to see what it's doing... You wanted an example, there is your example (My script). Merge it together/Build it in. Learn what I did, do the same.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...