BorderLine Posted July 18, 2012 Share Posted July 18, 2012 Hi everyone. well i have a little problem. Check i have a buymap panel, but i have a little problem. All can buy maps, and all work perfect but the problem is. If some player with mod, smod or admin rights buy map, then the nextmap is the map bought. But if some user without admin panel acces buy the map, but on the nextmap dont go to that map bought. serverside function buyMap(thePlayer,mapName) local playerCash = getPlayerMoney( thePlayer ) if mapIsAlreadySet == false then if not (mapName == "") then if playerCash >= mapCost then executeCommandHandler("nextmap", thePlayer, mapName) takePlayerMoney ( thePlayer, 5000 ) mapIsAlreadySet = true outputChatBox ("#FF6600* Next map set from #ABCDEF"..getPlayerName(thePlayer).." #FFFFFF[ "..mapName.." ]",getRootElement(),0,0,0,true) else outputChatBox("#FF0000* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#FF0000* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#FF0000* #FFFFFFA map is already #ff0000set #ffffffat the moment! Please try again later.",thePlayer,255,255,255,true) end end i give to this panel admin rights in comunity. Can be thaths the problem? Link to comment
TAPL Posted July 18, 2012 Share Posted July 18, 2012 your code look fine but what about if i write /nextmap [MapName] lol ----------- 'nextmap' command i find it at race/racevoting_server.lua you need to edit this, make trigger maybe.. addCommandHandler('nextmap', function( player, command, ... ) 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 g_ForcedNextMap = map outputChatBox('Next map set to ' .. getMapName( g_ForcedNextMap ) .. ' by ' .. getPlayerName( player ), g_Root, 0, 240, 0) end ) Link to comment
TwiX! Posted July 18, 2012 Share Posted July 18, 2012 You can't use nextmap from user panel (coz guy need admin rights for execute "nextmap" command) function buyMap(thePlayer,mapName) local playerCash = getPlayerMoney( thePlayer ) if mapIsAlreadySet == false or not getElementData (getRootElement(),"mapIsAlreadySet") == true then if not (mapName == "") then if playerCash >= mapCost then executeCommandHandler("bm", thePlayer, mapName) takePlayerMoney ( thePlayer, 5000 ) mapIsAlreadySet = true setElementData(getRootElement(),"mapIsAlreadySet",true) else outputChatBox("#FF0000* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#FF0000* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#FF0000* #FFFFFFA map is already #ff0000set #ffffffat the moment! Please try again later.",thePlayer,255,255,255,true) end end function resetMap() setElementData(getRootElement(),"mapIsAlreadySet",false) mapIsAlreadySet = false end addEventHandler("onMapStarting",getRootElement(),resetMap) racevoting_server.lua - add there this code addCommandHandler('bm', function( player, command, ... ) if not getElementData (getRootElement(),"mapIsAlreadySet") == true then --this check need for /bm, if guy bought map (/bm),not from user panel(so you can modify code for bm(take player money too)finish it local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputChatBox( '#abcdefNext map is #ffffff ' .. getMapName( g_ForcedNextMap ), player, 255, 255, 255, true ) else outputChatBox( '#abcdefNext map is not set', player, 255, 255 ,255, true ) end return end local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if (isGuestAccount(getPlayerAccount(player)) == false) then g_ForcedNextMap = map outputChatBox('#FF6600* Next map set from #ABCDEF'..getPlayerName( player )..' #FFFFFF[' .. getMapName( g_ForcedNextMap ).." ]", g_Root, 0, 240, 0,true) else outputChatBox("#00ff00*[bM] #FF0000ERROR: #ffffffPlease Register or Login!",player,255,255,255,true) end else outputChatBox("#FF0000* #FFFFFFA map is already #ff0000set #ffffffat the moment! Please try again later.",player,255,255,255,true) end end ) P.S why you use nextreme code? ;D Link to comment
bandi94 Posted July 18, 2012 Share Posted July 18, 2012 edit the admin panel setNextMap there is a check if the player who caled it is admin delet that and whit your buy map just triggerServerEvent the admin panel setnext map so it will be like tiggerServerEvent("nextMap",getLocalPlayer(),"map name ") Link to comment
HunT Posted July 18, 2012 Share Posted July 18, 2012 triggerEvent ("setNextMap_s", thePlayer, mapName) Another event from admin panel,no test. Link to comment
TwiX! Posted July 18, 2012 Share Posted July 18, 2012 my code is working You can't trigger event from other resource Link to comment
TAPL Posted July 18, 2012 Share Posted July 18, 2012 my code is working in fact, anyone can use the command 'bm' and set next map without losing money. Link to comment
BorderLine Posted July 18, 2012 Author Share Posted July 18, 2012 Thanks very much guys.. All work. Thanks for your time Link to comment
rolling11 Posted July 18, 2012 Share Posted July 18, 2012 Thanks very much guys..All work. Thanks for your time No Problem Link to comment
TwiX! Posted July 18, 2012 Share Posted July 18, 2012 Thanks very much guys..All work. Thanks for your time No problems yaku in fact, anyone can use the command 'bm' and set next map without losing money. --this check need for /bm, if guy bought map (/bm),not from user panel(so you can modify code for bm(take player money too)finish it No Problem you not help him lol why no problem? 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