boro Posted September 8, 2012 Posted September 8, 2012 Hi all i have problem i play stealth but map won't start and in log is this error ERROR: [gamemodes]/[stealth]/stealth/stealthmain_server.lua:69: attempt to compare boolean with number and this is stealthmain_server.lua 67 addEvent("dojoinTeam1",true ) 68 function joinTeam1( source,theskin ) 69 if (countPlayersInTeam(team2) - countPlayersInTeam(team1) > balanceamount) then 70 outputChatBox("Can't join RED too many players", source, 255, 69, 0) 71 triggerClientEvent(source,"doshowTeamWindow",source) 72 else 73 joinTeam(source, team1) 74 myskin[source] = theskin 75 end 76 end 77 addEventHandler ( "dojoinTeam1", getRootElement(), joinTeam1 ) 78 addEvent("toScore", true) 79 function addToScore(pla, cmd,cmds) 80 setElementData ( source, "FPS", cmd) 81 triggerClientEvent("onClientGamemodeMapStart", source, getMapName () ) 82 end 83 addEventHandler("toScore", getRootElement(), addToScore) 84 addEvent("dojoinTeam2",true ) 85 function joinTeam2( source, theskin ) 86 if (countPlayersInTeam(team1) - countPlayersInTeam(team2) > balanceamount) then 87 outputChatBox("Can't join BLUE too many players", source, 255, 69, 0) 88 triggerClientEvent(source,"doshowTeamWindow",source) 89 else 90 joinTeam(source, team2) 91 myskin[source] = theskin 92 end 93 end this is line 69 if (countPlayersInTeam(team1) - countPlayersInTeam(team2) > balanceamount) then what is bad ? please help thx. I'll help When I Can.
verona Posted September 8, 2012 Posted September 8, 2012 i think (countPlayersInTeam(team1), countPlayersInTeam(team2), or balanceamount is not a number, but have False value. So bug is in other line. You can check this variables with this: outputChatBox(countPlayersInTeam(team1), source, 255, 69, 0) outputChatBox(countPlayersInTeam(team2), source, 255, 69, 0) outputChatBox(countPlayersInTeam(balanceamount), source, 255, 69, 0) If you cant script and this is not your script, then type this topic in "Resources" viewforum.php?f=108 Sorry for bad English!
boro Posted September 8, 2012 Author Posted September 8, 2012 (edited) i think (countPlayersInTeam(team1), countPlayersInTeam(team2), or balanceamount is not a number, but have False value. So bug is in other line. You can check this variables with this: outputChatBox(countPlayersInTeam(team1), source, 255, 69, 0) outputChatBox(countPlayersInTeam(team2), source, 255, 69, 0) outputChatBox(countPlayersInTeam(balanceamount), source, 255, 69, 0) If you cant script and this is not your script, then type this topic in "Resources" viewforum.php?f=108 hmm still error ERROR: [gamemodes]/[stealth]/stealth/stealthmain_server.lua:69: attempt to compare boolean with number Edited September 8, 2012 by Guest I'll help When I Can.
Jaysds1 Posted September 8, 2012 Posted September 8, 2012 Did anything output to the chatBox? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
boro Posted September 8, 2012 Author Posted September 8, 2012 Did anything output to the chatBox? Delete chatbox line ? I'll help When I Can.
Jaysds1 Posted September 8, 2012 Posted September 8, 2012 nah, I was seeing if there's any output to the chatbox, like the numbers of the teams and etc... this script: outputChatBox(countPlayersInTeam(team1), source, 255, 69, 0) outputChatBox(countPlayersInTeam(team2), source, 255, 69, 0) outputChatBox(countPlayersInTeam(balanceamount), source, 255, 69, 0) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
boro Posted September 8, 2012 Author Posted September 8, 2012 [lua]local spectators = {} local getPlayerSpectatee = {} resourceRoot = getResourceRootElement(getThisResource()) thecurrentrunningmaplidu = "" myskin = {} function teamstealthgamestart() killmessageRes = getResourceFromName"killmessages" call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Score") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Status") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "FPS") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "kills") call(getResourceFromName("scoreboard"), "addScoreboardColumn", "deaths") playingaround = 0 team1 = createTeam("RED",255,0,0) team2 = createTeam("BLUE",0,0,255) team3 = createTeam("Waiting",0,255,0) 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 for k,v in ipairs(getElementsByType("player")) do killPed(v) fadeCamera(v,true) thisplayer = v setTimer(triggerClientEvent,2000,1,v,"swaptoggle",getRootElement(), thisplayer, teamswap) setElementData ( v, "Status", "IDLE" ) setElementData ( v, "kills", 0 ) setElementData ( v, "deaths", 0 ) setPlayerNametagShowing ( v, false ) spectators[v] = true bindKey ( v, "F3", "down", selectTeamKey ) bindKey ( v, "r", "down", spectateNext ) setElementData(v, "yourarmror", 0) end --Enable laser sight setElementData(getRootElement(),"lasersight",get("stealth.lasersight")) end addEventHandler( "onGamemodeStart", resourceRoot, teamstealthgamestart ) function joinTeam( player, team ) setPlayerTeam(player, team) if team == team1 then setPlayerNametagColor ( player, 255, 0, 0 ) outputChatBox("You select Team 1 RED", source, 255, 69, 0) outputChatBox("Counter Strike mode started", source, 255, 69, 0) outputChatBox("For started new map use command /votemap", source, 255, 69, 0) outputChatBox("!!Loading map started!!", source, 255, 69, 0) outputChatBox("!!Loading please Wait +-40 SECONDS for start MAP!!", source, 255, 69, 0) elseif team == team2 then setPlayerNametagColor ( player, 0, 0, 255 ) outputChatBox("You select Team 2 BLUE", source, 255, 69, 0) outputChatBox("Counter Strike mode started", source, 255, 69, 0) outputChatBox("For started new map use command /votemap", source, 255, 69, 0) outputChatBox("!!Loading map started!!", source, 255, 69, 0) outputChatBox("!!Loading please Wait +-40 SECONDS for start MAP!!", source, 255, 69, 0) waitDisplay = textCreateDisplay() end end addEvent("dojoinTeam1",true ) function joinTeam1( source,theskin ) if (countPlayersInTeam(team1) - countPlayersInTeam(team2) > balanceamount) then outputChatBox("Can't join RED too many players", source, 255, 69, 0) triggerClientEvent(source,"doshowTeamWindow",source) else joinTeam(source, team1) myskin[source] = theskin end end addEventHandler ( "dojoinTeam1", getRootElement(), joinTeam1 ) addEvent("toScore", true) function addToScore(pla, cmd,cmds) setElementData ( source, "FPS", cmd) triggerClientEvent("onClientGamemodeMapStart", source, getMapName () ) end addEventHandler("toScore", getRootElement(), addToScore) addEvent("dojoinTeam2",true ) function joinTeam2( source, theskin ) if (countPlayersInTeam(team2) - countPlayersInTeam(team1) > balanceamount) then outputChatBox("Can't join BLUE too many players", source, 255, 69, 0) triggerClientEvent(source,"doshowTeamWindow",source) else joinTeam(source, team2) myskin[source] = theskin end end addEventHandler ( "dojoinTeam2", getRootElement(), joinTeam2 ) function selectTeam( player ) setPlayerTeam(player, team3) local thisplayer = player triggerClientEvent(player,"doshowTeamWindow",getRootElement()) setCameraFixed(player,"cameramode",getRootElement(), thisplayer) balanceamount = get("stealth.teambalance") tonumber(balanceamount) end function selectTeamKey(source) ishespawning = getElementData ( source, "cantchangespawns" ) if ( isPedDead ( source ) ) and (ishespawning == 0) then selectTeam( source ) getPlayerSpectatee[source] = nil triggerClientEvent(source,"showSpectateText",source,"",false,"none") unbindKey ( source, "r", "down", spectateNext ) setPlayerTeam(source, team3) else outputChatBox("You can only change teams when your dead.", source, 255, 69, 0) end end function onStealthPlayerJoin () playersin = getPlayerCount() if playersin < 3 then if playingaround == 1 then outputChatBox("Not enough active players, restarting round.", source, 255, 69, 0) roundend = setTimer ( stealthroundended, 10000, 1, roundfinish, source ) destroyMissionTimer ( roundfinish ) end end setElementData(source, "yourarmror", 0) selectTeam (source) setElementHealth(source,0) setPlayerNametagShowing ( source, false ) spectators[source] = true bindKey ( source, "F3", "down", selectTeamKey ) bindKey ( source, "r", "down", spectateNext ) thisplayer = source setCameraFixed(source,"cameramode",getRootElement(), source) destroyshield = setTimer ( destroyElement, 3000, 1, dummyshield ) setCameraFixed(source,"cameramode",getRootElement(), source) triggerClientEvent(source,"swaptoggle",getRootElement(), source, teamswap) textDisplayAddObserver ( waitDisplay, source ) fadeCamera(source,true) setElementData ( source, "kills", 0 ) setTimer(setElementData,5000,1,source, "deaths", 0 ) setElementData ( source, "Status", "JOINING" ) end I'll help When I Can.
Jaysds1 Posted September 8, 2012 Posted September 8, 2012 ok, Did you made the map? and how much people is on your server? My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
boro Posted September 8, 2012 Author Posted September 8, 2012 players 0 gamemode don't work now and map is sth maps I'll help When I Can.
Jaysds1 Posted September 8, 2012 Posted September 8, 2012 the server has to have players in order for it to work My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
boro Posted September 8, 2012 Author Posted September 8, 2012 no no i know but i must fix this error becouse map don't start and before map start normal I'll help When I Can.
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