denny199 Posted January 2, 2012 Share Posted January 2, 2012 Hi there I've got some problems with my map shop it works perfectly If I'm admin But Not When i'm not Admin how can i resolve it? Example: I clicking on the button with admin account it's working perfectly with a non mod/admin account it don't set the next map But i want that evrybody can set a map Code: Client: -- GUI things and much more u don't need addEventHandler("onClientGUIClick",getRootElement(), function (player) if (source == GUIEditor_Button[1]) then outputChatBox("Button Is here") mapName = guiGetText ( GUIEditor_Edit[1] ) triggerServerEvent ("nm", getLocalPlayer(), mapName) end end) server: --import map functions u not needing function snm(mapName) outputChatBox("Trigger Is working") executeCommandHandler("nextmap", source, mapName) end addEvent("nm", true) addEventHandler("nm", getRootElement(),snm) executeCommandHandler("nextmap", source, mapName) --This works perfectly with admin but not if i'm logged out/logged in with a non amdin/mod/smod account Greetings Danny Link to comment
Gr0x Posted January 2, 2012 Share Posted January 2, 2012 Hi. only admins can use nextmap. Use this: exports.mapmanager:changeGamemodeMap(mapName) Link to comment
denny199 Posted January 2, 2012 Author Share Posted January 2, 2012 Hi. only admins can use nextmap.Use this: exports.mapmanager:changeGamemodeMap(mapName) It doesn't work error: [13:14:08] ERROR: mapmanager\mapmanager_exports.lua:64: mapmanager: Invalid map specified. Link to comment
denny199 Posted January 2, 2012 Author Share Posted January 2, 2012 Hmm maybe show full code? Whole code ok: client GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(701,328,584,394,"Map Shop",false) GUIEditor_Image[1] = guiCreateStaticImage(11,19,564,366,"back.png",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(273,13,289,21,"Local Money:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[1],0,0,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(270,75,284,70,"A Map Costs 4000$\n\nHow To Get Money?\nStand in the top3 of winners or reach the hunter",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Button[1] = guiCreateButton(280,264,265,91,"Buy Map [ -4000 ]",false,GUIEditor_Image[1]) GUIEditor_Label[3] = guiCreateLabel(272,36,252,19,"Local Map Status:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[3],0,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(286,211,252,45,"Local Map",false,GUIEditor_Image[1]) GUIEditor_Label[4] = guiCreateLabel(293,170,233,37,"Selected Map:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[4],0,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[4],"center") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"center",false) guiSetFont(GUIEditor_Label[4],"default-bold-small") mapGridList = guiCreateGridList(3,5,254,357,false,GUIEditor_Image[1]) guiGridListSetSelectionMode(mapGridList,2) mapsColumn = guiGridListAddColumn(mapGridList,"Maps",0.85) guiGridListSetSelectionMode(mapGridList,2) guiSetVisible (GUIEditor_Window[1], false) guiSetVisible (GUIEditor_Image[1], false) function set1( ) selectedRow, selectedCol = guiGridListGetSelectedItem( mapGridList ) gridMapName = guiGridListGetItemText( mapGridList, selectedRow, selectedCol ) guiSetText( GUIEditor_Edit[1], gridMapName ) end addEventHandler( "onClientGUIClick", mapGridList, set1 ) addEvent("sendMaps", true ) function sendmaps(name) row = guiGridListAddRow ( mapGridList ) guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) end addEventHandler( "sendMaps", getLocalPlayer(), sendmaps ) addEventHandler("onClientGUIClick",getRootElement(), function (player) if (source == GUIEditor_Button[1]) then outputChatBox("Button doet het") mapName = guiGetText ( GUIEditor_Edit[1] ) triggerServerEvent ("nm", getLocalPlayer(), mapName) end end) addEvent( "clearGridList", true ) function clearGridList() guiGridListClear( mapGridList ) end addEventHandler( "clearGridList", getLocalPlayer(), clearGridList ) function onresourceStart () bindKey ("F1", "down", showPanel) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function showPanel () getVisible = guiGetVisible (GUIEditor_Window[1]) playerName = getPlayerName ( getLocalPlayer() ) if (getVisible == true) then guiSetVisible (GUIEditor_Window[1], false) guiSetVisible (GUIEditor_Image[1], false) showCursor (false) end if (getVisible == false) then triggerServerEvent ( "dannyevent", getRootElement()) guiSetVisible (GUIEditor_Window[1], true) guiSetVisible (GUIEditor_Image[1], true) showCursor (true) local playerMoney = getPlayerMoney(source) guiSetText ( GUIEditor_Label[1], "Local Money: [ " .. playerMoney .. " ]" ) end end Server local rootElement = getRootElement() function raceWin(rank) if rank ~= 1 then return end local playername = getPlayerName(source) givePlayerMoney(source,1500) outputChatBox("*Race: "..playername.." took $1500 for finishing first!",rootElement,255,153,0) end addEventHandler("onPlayerFinish", rootElement, raceWin ) function snm(mapName) outputChatBox("Trigger Doet het") exports.mapmanager:changeGamemodeMap(mapName) --executeCommandHandler("nextmap", source, mapName) end addEvent("nm", true) addEventHandler("nm", getRootElement(),snm) function mappenerin() local resourceTable = getResources() triggerClientEvent ( "clearGridList", getRootElement() ) for resourceKey, resourceValue in ipairs(resourceTable) do local name = getResourceName(resourceValue) local type1 = getResourceInfo ( resourceValue, "type" ) local gamemode1 = getResourceInfo ( resourceValue, "gamemodes" ) if type1 == "map" and gamemode1 == "race" then triggerClientEvent ( "sendMaps", getRootElement(), name) else cancelEvent() end end end addEvent("dannyevent", true ) addEventHandler( "dannyevent", rootElement, mappenerin ) Link to comment
Kenix Posted January 2, 2012 Share Posted January 2, 2012 Hmm check GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(701,328,584,394,"Map Shop",false) GUIEditor_Image[1] = guiCreateStaticImage(11,19,564,366,"back.png",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(273,13,289,21,"Local Money:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[1],0,0,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(270,75,284,70,"A Map Costs 4000$\n\nHow To Get Money?\nStand in the top3 of winners or reach the hunter",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Button[1] = guiCreateButton(280,264,265,91,"Buy Map [ -4000 ]",false,GUIEditor_Image[1]) GUIEditor_Label[3] = guiCreateLabel(272,36,252,19,"Local Map Status:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[3],0,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(286,211,252,45,"Local Map",false,GUIEditor_Image[1]) GUIEditor_Label[4] = guiCreateLabel(293,170,233,37,"Selected Map:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[4],0,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[4],"center") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"center",false) guiSetFont(GUIEditor_Label[4],"default-bold-small") mapGridList = guiCreateGridList(3,5,254,357,false,GUIEditor_Image[1]) guiGridListSetSelectionMode(mapGridList,2) mapsColumn = guiGridListAddColumn(mapGridList,"Maps",0.85) guiGridListSetSelectionMode(mapGridList,2) guiSetVisible (GUIEditor_Window[1], false) guiSetVisible (GUIEditor_Image[1], false) function set1( ) selectedRow, selectedCol = guiGridListGetSelectedItem( mapGridList ) gridMapName = guiGridListGetItemText( mapGridList, selectedRow, selectedCol ) guiSetText( GUIEditor_Edit[1], gridMapName ) end addEventHandler( "onClientGUIClick", mapGridList, set1 ) addEvent("sendMaps", true ) function sendmaps(name) row = guiGridListAddRow ( mapGridList ) guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) end addEventHandler( "sendMaps", getLocalPlayer(), sendmaps ) function test () local mapName = guiGridListGetItemText ( mapGridList, guiGridListGetSelectedItem( row ), 1 ) outputChatBox( "cmd:lol mapName = "..tostring( mapName ) ) triggerServerEvent("nm", getLocalPlayer(), mapName) end addCommandHandler ( "lol", test ) addEventHandler("onClientGUIClick",getRootElement(), function (player) if (source == GUIEditor_Button[1]) then outputChatBox("Button doet het") mapName = guiGetText ( GUIEditor_Edit[1] ) outputChatBox( "onClientGUIClick mapName = "..tostring( mapName ) ) triggerServerEvent ("nm", getLocalPlayer(), mapName) end end) addEvent( "clearGridList", true ) function clearGridList() guiGridListClear( mapGridList ) end addEventHandler( "clearGridList", getLocalPlayer(), clearGridList ) function onresourceStart () bindKey ("F1", "down", showPanel) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function showPanel () getVisible = guiGetVisible (GUIEditor_Window[1]) playerName = getPlayerName ( getLocalPlayer() ) if (getVisible == true) then guiSetVisible (GUIEditor_Window[1], false) guiSetVisible (GUIEditor_Image[1], false) showCursor (false) end if (getVisible == false) then triggerServerEvent ( "dannyevent", getRootElement()) guiSetVisible (GUIEditor_Window[1], true) guiSetVisible (GUIEditor_Image[1], true) showCursor (true) local playerMoney = getPlayerMoney(source) guiSetText ( GUIEditor_Label[1], "Local Money: [ " .. playerMoney .. " ]" ) end end Link to comment
denny199 Posted January 2, 2012 Author Share Posted January 2, 2012 That's not my problem The problem is that only admins can buy maps and non admins can't buy maps or must i change the acl? Link to comment
denny199 Posted January 2, 2012 Author Share Posted January 2, 2012 Well, if i now pres the button without admin it doesn't set the next map Link to comment
bandi94 Posted January 2, 2012 Share Posted January 2, 2012 make how i did it you wil find the line where you need to edit it copy and paste the setnext map function again under the original delete the admin right check and change the command from "nextmap" to something else ex> :buymapshot or what do you whan-t viewtopic.php?f=91&t=36226&hilit=+buy+map Link to comment
denny199 Posted January 2, 2012 Author Share Posted January 2, 2012 make how i did it you wil find the line where you need to edit it copy and paste the setnext map function again under the original delete the admin right check and change the command from "nextmap" to something else ex> :buymapshot or what do you whan-t viewtopic.php?f=91&t=36226&hilit=+buy+map oke tnx i will try Link to comment
denny199 Posted January 13, 2012 Author Share Posted January 13, 2012 Oke, i was a little time inactive but now i was trying to pass a extra argument like: onServerCallsClientFunction That Is A Extra Trigger Function but now i got a error But this error is here now: [18:11:19] ERROR: mapshop\server.lua:28: attempt to call a nil value Please help me Client: ------------------------------------------ -- Calling function from the client's side ------------------------------------------ function callClientFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onServerCallsClientFunction", true) addEventHandler("onServerCallsClientFunction", resourceRoot, callClientFunction) ----------------------- -- Call server function ----------------------- function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end triggerServerEvent("onClientCallsServerFunction", resourceRoot , funcname, unpack(arg)) end outputChatBox("Race Shop By Danny Loaded",255,255,0) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(701,328,584,394,"Map Shop",false) GUIEditor_Image[1] = guiCreateStaticImage(11,19,564,366,"back.png",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(273,13,289,21,"Local Money:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[1],0,0,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(270,75,284,70,"A Map Costs 4000$\n\nHow To Get Money?\nStand in the top3 of winners or reach the hunter",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Button[1] = guiCreateButton(280,264,265,91,"Buy Map [ -4000 ]",false,GUIEditor_Image[1]) GUIEditor_Label[3] = guiCreateLabel(272,36,252,19,"Local Map Status:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[3],0,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(286,211,252,45,"Local Map",false,GUIEditor_Image[1]) GUIEditor_Label[4] = guiCreateLabel(293,170,233,37,"Selected Map:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[4],0,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[4],"center") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"center",false) guiSetFont(GUIEditor_Label[4],"default-bold-small") mapGridList = guiCreateGridList(3,5,254,357,false,GUIEditor_Image[1]) guiGridListSetSelectionMode(mapGridList,2) mapsColumn = guiGridListAddColumn(mapGridList,"Maps",0.85) guiGridListSetSelectionMode(mapGridList,2) guiSetVisible (GUIEditor_Window[1], false) guiSetVisible (GUIEditor_Image[1], false) function set1( ) selectedRow, selectedCol = guiGridListGetSelectedItem( mapGridList ) gridMapName = guiGridListGetItemText( mapGridList, selectedRow, selectedCol ) guiSetText( GUIEditor_Edit[1], gridMapName ) end addEventHandler( "onClientGUIClick", mapGridList, set1 ) addEvent("sendMaps", true ) function sendmaps(name) row = guiGridListAddRow ( mapGridList ) guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) end addEventHandler( "sendMaps", getLocalPlayer(), sendmaps ) function test () local mapName = guiGridListGetItemText ( mapGridList, guiGridListGetSelectedItem( row ), 1 ) triggerServerEvent("nm", getLocalPlayer(), mapName) end addCommandHandler ( "lol", test ) addEventHandler("onClientGUIClick",getRootElement(), function (player) if (source == GUIEditor_Button[1]) then outputChatBox("Button doet het") mapName = guiGetText ( GUIEditor_Edit[1] ) --local row,column = guiGridListGetSelectedItem(gridMaps) --local mapName = guiGridListGetItemText(gridMaps,row,1) callServerFunction("nm",getLocalPlayer(),mapName) end end) addEvent( "clearGridList", true ) function clearGridList() guiGridListClear( mapGridList ) end addEventHandler( "clearGridList", getLocalPlayer(), clearGridList ) function onresourceStart () bindKey ("F1", "down", showPanel) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function showPanel () getVisible = guiGetVisible (GUIEditor_Window[1]) playerName = getPlayerName ( getLocalPlayer() ) if (getVisible == true) then guiSetVisible (GUIEditor_Window[1], false) guiSetVisible (GUIEditor_Image[1], false) showCursor (false) end if (getVisible == false) then triggerServerEvent ( "dannyevent", getRootElement()) guiSetVisible (GUIEditor_Window[1], true) guiSetVisible (GUIEditor_Image[1], true) showCursor (true) local playerMoney = getPlayerMoney(source) guiSetText ( GUIEditor_Label[1], "Local Money: [ " .. playerMoney .. " ]" ) end end Server: local rootElement = getRootElement() function race(rank) ouputChatBox ( "test" ) local playername = getPlayerName(source) givePlayerMoney(source,1500) outputChatBox("*Race: "..playername.." took $1500 for finishing first!",rootElement,255,153,0) end addEventHandler("onPlayerFinish", rootElement, race ) function snm(mapName) outputChatBox("Trigger Doet het") --exports.mapmanager:changeGamemodeMap(mapName) executeCommandHandler("nextmap", source, mapName) end addEvent("nm", true) addEventHandler("nm", getRootElement(),snm) function callServerFunction(funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do arg[key] = tonumber(value) or value end end loadstring("return "..funcname)()(unpack(arg)) end addEvent("onClientCallsServerFunction", true) addEventHandler("onClientCallsServerFunction", resourceRoot , callServerFunction) function callClientFunction(client, funcname, ...) local arg = { ... } if (arg[1]) then for key, value in next, arg do if (type(value) == "number") then arg[key] = tostring(value) end end end -- If the clientside event handler is not in the same resource, replace 'resourceRoot' with the appropriate element triggerClientEvent(client, "onServerCallsClientFunction", resourceRoot, funcname, unpack(arg or {})) end function mappenerin() local resourceTable = getResources() triggerClientEvent ( "clearGridList", getRootElement() ) for resourceKey, resourceValue in ipairs(resourceTable) do local name = getResourceName(resourceValue) local type1 = getResourceInfo ( resourceValue, "type" ) local gamemode1 = getResourceInfo ( resourceValue, "gamemodes" ) if type1 == "map" and gamemode1 == "race" then triggerClientEvent ( "sendMaps", getRootElement(), name) else cancelEvent() end end end addEvent("dannyevent", true ) addEventHandler( "dannyevent", rootElement, mappenerin ) Link to comment
denny199 Posted February 10, 2012 Author Share Posted February 10, 2012 Please help waiting for long ;-( Link to comment
Castillo Posted February 10, 2012 Share Posted February 10, 2012 That's because in "race/racevoting_server.lua" it check's for Admin rights. Link to comment
Cadu12 Posted February 10, 2012 Share Posted February 10, 2012 You have to edit in "race/racevoting_server.lua". Link to comment
denny199 Posted February 11, 2012 Author Share Posted February 11, 2012 And can somebody tell what i need to edit? addCommandHandler('nextmap', function( player, command, ... ) -- CADU !@ HERE local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputRace( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) else outputRace( 'Next map is not set', player ) end return end if not _TESTING and not isPlayerInACLGroup(player, g_GameOptions.admingroup) then return end local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if g_ForcedNextMap == map then outputRace( 'Next map is already set to ' .. getMapName( g_ForcedNextMap ), player ) return end --NextMapBuyed = true g_ForcedNextMap = map outputChatBox('#FFFFFF*#0fc0fcNext map Selected: #FFFFFF' .. getMapName( g_ForcedNextMap ) .. ' #0fc0fcby #FFFFFF' .. getPlayerName( player ), g_Root, 255, 255, 255, true) triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) end ) function startingNextText() -- CADU!@ --getMapsCompatibleWithGamemode g_ForcedNextMap = getRandomMapCompatibleWithGamemode( getThisResource(), 10, g_GameOptions.ghostmode and 0 or getTotalPlayerCount() ) if g_ForcedNextMap then triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) end end addEventHandler( "onMapStarting", getRootElement(), startingNextText) Or am i wrong that i need to change this? Link to comment
Cadu12 Posted February 11, 2012 Share Posted February 11, 2012 Just create own your function and exports. ForcedNextMap = mapresource Link to comment
Castillo Posted February 11, 2012 Share Posted February 11, 2012 Add this to "race/racevoting_server.lua": function setNextMap( ... ) local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then return false, "Next map is already set." end end local map, errormsg = findMap( query ) if (not map) then outputRace( errormsg, player ) return false, "Map not found." end if (g_ForcedNextMap == map) then return false, 'Next map is already set to ' .. getMapName( g_ForcedNextMap ) end g_ForcedNextMap = map return true end And then add this to the meta.xml: function="setNextMap" type="server" /> Then you can do: local set, errorMsg = exports["race"]:setNextMap(mapName) Link to comment
denny199 Posted February 12, 2012 Author Share Posted February 12, 2012 [10:22:31] ERROR: 1mapshop\server.lua:63: attempt to call a nil value @ line 63: --server loadstring("return "..funcname)()(unpack(arg)) and with triggerServerEvent it doesn't work i added in race/meta.xml the export and in the mapshop. Link to comment
Castillo Posted February 12, 2012 Share Posted February 12, 2012 Read again what I said above and do it again. It has to work, I'm using it on one of my race userpanel. Link to comment
denny199 Posted February 12, 2012 Author Share Posted February 12, 2012 ok i will try it tommorow tying the hunter fight messages now. or I'm, trying it in the evning Link to comment
denny199 Posted February 14, 2012 Author Share Posted February 14, 2012 I got now a another problem when i choose a map and cliock on buy hten it saying 0 matches foudn for blabla map name example: my own map [fun]hardwithstyle is in my folder: server/blablabla/resources and my other maps are in : server/blablalbal/resources/[gamemodes]/[race]/[maps] both are not working how can i solve it? Link to comment
Castillo Posted February 14, 2012 Share Posted February 14, 2012 I have no idea, you must have something wrong, as it works fine in my server. 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