Moderators IIYAMA Posted February 15, 2012 Moderators Share Posted February 15, 2012 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
drk Posted February 15, 2012 Share Posted February 15, 2012 --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
Moderators IIYAMA Posted February 15, 2012 Author Moderators Share Posted February 15, 2012 not working Link to comment
Scooby Posted February 15, 2012 Share Posted February 15, 2012 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 IIYAMA Posted February 17, 2012 Author Moderators Share Posted February 17, 2012 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
drk Posted February 17, 2012 Share Posted February 17, 2012 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
Moderators IIYAMA Posted March 2, 2012 Author Moderators Share Posted March 2, 2012 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
Evil-Cod3r Posted March 2, 2012 Share Posted March 2, 2012 ---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
drk Posted March 2, 2012 Share Posted March 2, 2012 ---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
Castillo Posted March 2, 2012 Share Posted March 2, 2012 As far as I can see, he just posted that the server side has to be client side which is wrong, and the same with the client side. Link to comment
Evil-Cod3r Posted March 2, 2012 Share Posted March 2, 2012 SoldSnake14 then what is the problem with this error?? Server triggered clientside event ========, but is not added clientside Link to comment
Castillo Posted March 2, 2012 Share Posted March 2, 2012 It mean's the server triggered a client side event which is not added (doesn't exists). Link to comment
Evil-Cod3r Posted March 2, 2012 Share Posted March 2, 2012 but its exists in his script isnt it ? 3.addEvent('swaptoggle',true) 4.addEventHandler("swaptoggle", getRootElement(), Link to comment
Castillo Posted March 2, 2012 Share Posted March 2, 2012 I'm pretty sure it's because when the game mode starts the client side is not yet loaded, so the event doesn't exists yet. Link to comment
Evil-Cod3r Posted March 2, 2012 Share Posted March 2, 2012 so his script have problem or his server got a problem ? Link to comment
Castillo Posted March 2, 2012 Share Posted March 2, 2012 I would suggest to trigger a event from client side to request it to trigger to client side, that way it'll trigger when client side is loaded. Link to comment
Evil-Cod3r Posted March 3, 2012 Share Posted March 3, 2012 trigger a event from client side to request it to trigger to client side, ؟؟ how is that can you show me simple exmaple Link to comment
Castillo Posted March 3, 2012 Share Posted March 3, 2012 -- 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
Evil-Cod3r Posted March 3, 2012 Share Posted March 3, 2012 Oh Now i get it Thanx Castillo For The Example Link to comment
Moderators IIYAMA Posted March 3, 2012 Author Moderators Share Posted March 3, 2012 so how do I fix it? use a timer or something like that(timer arround the triggers)? or splits the script? Link to comment
Evil-Cod3r Posted March 3, 2012 Share Posted March 3, 2012 use what SoldSnake14 Post Up ! Link to comment
Moderators IIYAMA Posted March 3, 2012 Author Moderators Share Posted March 3, 2012 use what SoldSnake14 Post Up ! lol I did not saw that when I posted my reply I will try thx Link to comment
Dev Posted March 3, 2012 Share Posted March 3, 2012 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
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