Jump to content

Help


IIYAMA

Recommended Posts

  • Moderators

Hello I am IIYAMA

I am scripting for the GCC stealth server.

  
--server 
  
local spectators = {} 
local getPlayerSpectatee = {} 
resourceRoot = getResourceRootElement(getThisResource()) 
  
function teamstealthgamestart() 
    killmessageRes = getResourceFromName"killmessages" 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") 
    playingaround = 0 
    redwinsdisplay = textCreateDisplay() 
    local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) 
    textDisplayAddText ( redwinsdisplay, redtext ) 
    bluewinsdisplay = textCreateDisplay() 
    local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( bluewinsdisplay, bluetext ) 
    tiegamedisplay = textCreateDisplay() 
    local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( tiegamedisplay, tietext ) 
    waitDisplay = textCreateDisplay() 
    local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) 
    textDisplayAddText ( waitDisplay, waittext ) 
    team1 = createTeam("RED",255,0,0) 
    team2 = createTeam("BLUE",0,0,255) 
    teamprotect = get("stealth.teamdamage") 
    if teamprotect == 1 then     
        setTeamFriendlyFire( team1, false ) 
        setTeamFriendlyFire( team2, false ) 
    elseif teamprotect == 0 then 
        setTeamFriendlyFire( team1, true ) 
        setTeamFriendlyFire( team2, true ) 
    end 
    setElementData ( team1, "Score", 0 ) 
    setElementData ( team2, "Score", 0 ) 
    teamswap = 0 
    local players = getElementsByType("player") 
    for k,v in ipairs(players) do 
        killPed(v) 
        fadeCamera(v,true) 
        thisplayer = v 
        triggerClientEvent(v,"swaptoggle",getRootElement(), thisplayer, teamswap) 
        setElementData ( v, "kills", 0 ) 
        setElementData ( v, "deaths", 0 ) 
        setPlayerNametagShowing ( v, false ) 
        spectators[v] = true 
        bindKey ( v, "F3", "down", selectTeamKey ) 
    end 
    --Enable laser sight 
    setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) 
end 
  
addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) 
  
--------------------------------------------------------------------------------------------------------- 
  
  
  
  
  

  
--client 
  
addEvent("swaptoggle", true ) 
  
function swaptheteams(thisplayer, teamswap) 
    aretheyswapped = teamswap 
end 
  
addEventHandler("swaptoggle", getRootElement(), swaptheteams) 
  
--or how I like top set it 
  
  
addEvent("swaptoggle", true ) 
  
function swaptheteams(thisplayer, teamswap) 
    aretheyswapped = teamswap 
end 
  
addEventHandler("swaptoggle", getRootElement(), swaptheteams) 
  

ERROR>

ERROR: Server triggered clientside event onServerCallsClientFunction, but is not added clientside

I got like 8 of these errors in my server.. I still don't get it why these handlers don't work.

What the hell is going on from the start, this gamemode has been made?

Link to comment
  
--server 
  
local spectators = {} 
local getPlayerSpectatee = {} 
resourceRoot = getResourceRootElement(getThisResource()) 
  
function teamstealthgamestart() 
    killmessageRes = getResourceFromName"killmessages" 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") 
    playingaround = 0 
    redwinsdisplay = textCreateDisplay() 
    local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) 
    textDisplayAddText ( redwinsdisplay, redtext ) 
    bluewinsdisplay = textCreateDisplay() 
    local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( bluewinsdisplay, bluetext ) 
    tiegamedisplay = textCreateDisplay() 
    local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( tiegamedisplay, tietext ) 
    waitDisplay = textCreateDisplay() 
    local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) 
    textDisplayAddText ( waitDisplay, waittext ) 
    team1 = createTeam("RED",255,0,0) 
    team2 = createTeam("BLUE",0,0,255) 
    teamprotect = get("stealth.teamdamage") 
    if teamprotect == 1 then     
        setTeamFriendlyFire( team1, false ) 
        setTeamFriendlyFire( team2, false ) 
    elseif teamprotect == 0 then 
        setTeamFriendlyFire( team1, true ) 
        setTeamFriendlyFire( team2, true ) 
    end 
    setElementData ( team1, "Score", 0 ) 
    setElementData ( team2, "Score", 0 ) 
    teamswap = 0 
    local players = getElementsByType("player") 
    for k,v in ipairs(players) do 
        killPed(v) 
        fadeCamera(v,true) 
        triggerClientEvent("swaptoggle",v,teamswap) 
        setElementData ( v, "kills", 0 ) 
        setElementData ( v, "deaths", 0 ) 
        setPlayerNametagShowing ( v, false ) 
        spectators[v] = true 
        bindKey ( v, "F3", "down", selectTeamKey ) 
    end 
    --Enable laser sight 
    setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) 
end 
  
addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) 
  
--------------------------------------------------------------------------------------------------------- 
  
  
  
  
  

Link to comment

its possible the server script triggers the client event before the files are downloaded to the client...

but the script should work ok tho once the inital start up is complete.

edit: just noticed ur warning msg: onServerCallsClientFunction

i dont see this in ur post... are u sure this error is related to this script?

Link to comment
  • Moderators
its possible the server script triggers the client event before the files are downloaded to the client...

but the script should work ok tho once the inital start up is complete.

edit: just noticed ur warning msg: onServerCallsClientFunction

i dont see this in ur post... are u sure this error is related to this script?

ehm I have the error on stealth. Only this script has not been called onServerCallsClientFunction.

But still it is the same error.

Try your own stealth on server and you will see:

Server triggered clientside event ========, but is not added clientside

Like 8 of them. I need to know how I can fix spectate on stealth. (stealth script is to big to post it here.)

So that is why I writed a sample.

Link to comment
triggerClientEvent('swaptoggle', thisplayer, teamswap) 

I don't understand '--or how I like top set it' .-.

Client:

addEvent('swaptoggle',true) 
  
addEventHandler('swaptoggle',root, 
 function(thePlayer, teamswap) 
           aretheyswapped = teamswap 
end) 

Server:

local spectators = {} 
local getPlayerSpectatee = {} 
  
function teamstealthgamestart() 
    killmessageRes = getResourceFromName"killmessages" 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") 
    playingaround = 0 
    redwinsdisplay = textCreateDisplay() 
    local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) 
    textDisplayAddText ( redwinsdisplay, redtext ) 
    bluewinsdisplay = textCreateDisplay() 
    local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( bluewinsdisplay, bluetext ) 
    tiegamedisplay = textCreateDisplay() 
    local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( tiegamedisplay, tietext ) 
    waitDisplay = textCreateDisplay() 
    local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) 
    textDisplayAddText ( waitDisplay, waittext ) 
    team1 = createTeam("RED",255,0,0) 
    team2 = createTeam("BLUE",0,0,255) 
    teamprotect = get("stealth.teamdamage") 
    if teamprotect == 1 then     
        setTeamFriendlyFire( team1, false ) 
        setTeamFriendlyFire( team2, false ) 
    elseif teamprotect == 0 then 
        setTeamFriendlyFire( team1, true ) 
        setTeamFriendlyFire( team2, true ) 
    end 
    setElementData ( team1, "Score", 0 ) 
    setElementData ( team2, "Score", 0 ) 
    teamswap = 0 
    local players = getElementsByType 'player' 
    for k,v in ipairs(players) do 
        killPed(v) 
        fadeCamera(v,true) 
        triggerClientEvent('swaptoggle',v, teamswap) 
        setElementData ( v, "kills", 0 ) 
        setElementData ( v, "deaths", 0 ) 
        setPlayerNametagShowing ( v, false ) 
        spectators[v] = true 
        bindKey ( v, "F3", "down", selectTeamKey ) 
    end 
    --Enable laser sight 
    setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) 
end 
  
addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) 

Link to comment
  • 2 weeks later...
  • Moderators

I don't know what the problem is with stealth: ERROR Server triggered client side event swaptoggle, but not added clientside.

MAN are there to many triggers inside stealth server side. wtf is this for shit.

I get always the same errors....

Link to comment
---serverSide 
  
addEvent('swaptoggle',true) 
addEventHandler("swaptoggle", getRootElement(), 
 function(thePlayer, teamswap) 
    aretheyswapped = teamswap 
end) 
  
--clientside 
  
local spectators = {} 
local getPlayerSpectatee = {} 
  
function teamstealthgamestart() 
    killmessageRes = getResourceFromName"killmessages" 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") 
    playingaround = 0 
    redwinsdisplay = textCreateDisplay() 
    local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) 
    textDisplayAddText ( redwinsdisplay, redtext ) 
    bluewinsdisplay = textCreateDisplay() 
    local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( bluewinsdisplay, bluetext ) 
    tiegamedisplay = textCreateDisplay() 
    local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( tiegamedisplay, tietext ) 
    waitDisplay = textCreateDisplay() 
    local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) 
    textDisplayAddText ( waitDisplay, waittext ) 
    team1 = createTeam("RED",255,0,0) 
    team2 = createTeam("BLUE",0,0,255) 
    teamprotect = get("stealth.teamdamage") 
    if teamprotect == 1 then     
        setTeamFriendlyFire( team1, false ) 
        setTeamFriendlyFire( team2, false ) 
    elseif teamprotect == 0 then 
        setTeamFriendlyFire( team1, true ) 
        setTeamFriendlyFire( team2, true ) 
    end 
    setElementData ( team1, "Score", 0 ) 
    setElementData ( team2, "Score", 0 ) 
    teamswap = 0 
    local players = getElementsByType ( "player" ) 
    for k,v in ipairs(players) do 
        killPed(v) 
        fadeCamera(v,true) 
        triggerClientEvent('swaptoggle' v, teamswap) 
        setElementData ( v, "kills", 0 ) 
        setElementData ( v, "deaths", 0 ) 
        setPlayerNametagShowing ( v, false ) 
        spectators[v] = true 
        bindKey ( v, "F3", "down", selectTeamKey ) 
    end 
    --Enable laser sight 
    setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) 
end 
  
addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) 

Link to comment
---serverSide 
  
addEvent('swaptoggle',true) 
addEventHandler("swaptoggle", getRootElement(), 
 function(thePlayer, teamswap) 
    aretheyswapped = teamswap 
end) 
  
--clientside 
  
local spectators = {} 
local getPlayerSpectatee = {} 
  
function teamstealthgamestart() 
    killmessageRes = getResourceFromName"killmessages" 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") 
    playingaround = 0 
    redwinsdisplay = textCreateDisplay() 
    local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) 
    textDisplayAddText ( redwinsdisplay, redtext ) 
    bluewinsdisplay = textCreateDisplay() 
    local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( bluewinsdisplay, bluetext ) 
    tiegamedisplay = textCreateDisplay() 
    local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( tiegamedisplay, tietext ) 
    waitDisplay = textCreateDisplay() 
    local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) 
    textDisplayAddText ( waitDisplay, waittext ) 
    team1 = createTeam("RED",255,0,0) 
    team2 = createTeam("BLUE",0,0,255) 
    teamprotect = get("stealth.teamdamage") 
    if teamprotect == 1 then     
        setTeamFriendlyFire( team1, false ) 
        setTeamFriendlyFire( team2, false ) 
    elseif teamprotect == 0 then 
        setTeamFriendlyFire( team1, true ) 
        setTeamFriendlyFire( team2, true ) 
    end 
    setElementData ( team1, "Score", 0 ) 
    setElementData ( team2, "Score", 0 ) 
    teamswap = 0 
    local players = getElementsByType ( "player" ) 
    for k,v in ipairs(players) do 
        killPed(v) 
        fadeCamera(v,true) 
        triggerClientEvent('swaptoggle' v, teamswap) 
        setElementData ( v, "kills", 0 ) 
        setElementData ( v, "deaths", 0 ) 
        setPlayerNametagShowing ( v, false ) 
        spectators[v] = true 
        bindKey ( v, "F3", "down", selectTeamKey ) 
    end 
    --Enable laser sight 
    setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) 
end 
  
addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) 

LOL? What you have changed?

Link to comment

-- client side:

addEventHandler("onClientResourceStart",resourceRoot, 
    function () 
        triggerServerEvent("requestSwapToggle",localPlayer) 
    end 
) 
  
addEvent('swaptoggle',true) 
addEventHandler('swaptoggle',root, 
    function(teamswap) 
        aretheyswapped = teamswap 
    end 
) 

-- server side:

local spectators = {} 
local getPlayerSpectatee = {} 
  
function teamstealthgamestart() 
    killmessageRes = getResourceFromName"killmessages" 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") 
    playingaround = 0 
    redwinsdisplay = textCreateDisplay() 
    local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) 
    textDisplayAddText ( redwinsdisplay, redtext ) 
    bluewinsdisplay = textCreateDisplay() 
    local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( bluewinsdisplay, bluetext ) 
    tiegamedisplay = textCreateDisplay() 
    local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) 
    textDisplayAddText ( tiegamedisplay, tietext ) 
    waitDisplay = textCreateDisplay() 
    local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) 
    textDisplayAddText ( waitDisplay, waittext ) 
    team1 = createTeam("RED",255,0,0) 
    team2 = createTeam("BLUE",0,0,255) 
    teamprotect = get("stealth.teamdamage") 
    if teamprotect == 1 then     
        setTeamFriendlyFire( team1, false ) 
        setTeamFriendlyFire( team2, false ) 
    elseif teamprotect == 0 then 
        setTeamFriendlyFire( team1, true ) 
        setTeamFriendlyFire( team2, true ) 
    end 
    setElementData ( team1, "Score", 0 ) 
    setElementData ( team2, "Score", 0 ) 
    teamswap = 0 
    local players = getElementsByType 'player' 
    for k,v in ipairs(players) do 
        killPed(v) 
        fadeCamera(v,true) 
        setElementData ( v, "kills", 0 ) 
        setElementData ( v, "deaths", 0 ) 
        setPlayerNametagShowing ( v, false ) 
        spectators[v] = true 
        bindKey ( v, "F3", "down", selectTeamKey ) 
    end 
    --Enable laser sight 
    setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) 
end 
addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) 
  
addEvent("requestSwapToggle",true) 
addEventHandler("requestSwapToggle",root, 
    function () 
        triggerClientEvent(source, 'swaptoggle',source, teamswap) 
    end 
) 

Link to comment

Try this, it might help as it waits until the player's client side resource starts, if it doesn't work, it means that either you havn't added your client side file to meta.xml or it is not in the specified resource folder.

-- SERVER SIDE 
local isClientReady = { } 
  
local spectators = {} 
local getPlayerSpectatee = {} 
  
function teamStealthGameStart( ) 
    killmessageRes = getResourceFromName("killmessages") 
     
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") 
    call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") 
     
    playingaround = 0 
    redwinsdisplay = textCreateDisplay( ) 
    local redtext = textCreateTextItem ( "RED Team Wins the Match!", 0.5, 0.5, "low", 255, 0, 0, 255, 3, "center", "center" ) 
     
    textDisplayAddText ( redwinsdisplay, redtext ) 
    bluewinsdisplay = textCreateDisplay() 
    local bluetext = textCreateTextItem ( "BLUE Team Wins the Match!", 0.5, 0.5, "low", 0, 0, 255, 255, 3, "center", "center" ) 
     
    textDisplayAddText ( bluewinsdisplay, bluetext ) 
    tiegamedisplay = textCreateDisplay() 
    local tietext = textCreateTextItem ( "The Match was a Tie!", 0.5, 0.5, "low", 255, 255, 255, 255, 3, "center", "center" ) 
     
    textDisplayAddText ( tiegamedisplay, tietext ) 
    waitDisplay = textCreateDisplay() 
    local waittext = textCreateTextItem ( "Wait for next round to spawn.", 0.5, 0.9, "low", 255, 255, 255, 255, 1.6, "center", "center" ) 
     
    textDisplayAddText ( waitDisplay, waittext ) 
    team1 = createTeam("RED",255,0,0) 
    team2 = createTeam("BLUE",0,0,255) 
     
    teamprotect = get("stealth.teamdamage") 
    if teamprotect == 1 then    
        setTeamFriendlyFire( team1, false ) 
        setTeamFriendlyFire( team2, false ) 
    elseif teamprotect == 0 then 
        setTeamFriendlyFire( team1, true ) 
        setTeamFriendlyFire( team2, true ) 
    end 
     
    setElementData ( team1, "Score", 0 ) 
    setElementData ( team2, "Score", 0 ) 
    teamswap = 0 
     
    local players = getElementsByType("player") 
    for k,v in ipairs(players) do 
        killPed(v) 
        fadeCamera(v,true) 
        thisplayer = v 
        swapToggle( thisplayer, teamswap ) 
        setElementData ( v, "kills", 0 ) 
        setElementData ( v, "deaths", 0 ) 
        setPlayerNametagShowing ( v, false ) 
        spectators[v] = true 
        bindKey ( v, "F3", "down", selectTeamKey ) 
    end 
    --Enable laser sight 
    setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) 
end 
addEventHandler("onGamemodeStart", resourceRoot, teamStealthGameStart ) 
  
function swapToggle( thePlayer, teamSwap ) 
    if ( isClientReady[thePlayer] ~= nil ) then 
        triggerClientEvent(thePlayer, "swaptoggle",getRootElement(), thePlayer, teamSwap) 
    else 
        setTimer(swapToggle, 1000, 1, thePlayer, teamSwap ) 
    end  
end 
  
addEvent("clientReady", true) 
addEventHandler("clientReady", root, 
    function( ) 
         
        isClientReady[source] = true 
    end 
) 
     
-- CLIENT SIDE 
function swapTheTeams(thisPlayer, teamSwap) 
    aretheyswapped = teamSwap 
end 
addEvent("swaptoggle", true )  
addEventHandler("swaptoggle", getRootElement(), swapTheTeams) 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function( ) 
         
        triggerServerEvent("clientReady", localPlayer) 
    end 
end  
  
  
  
  

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...