Snake Posted February 27, 2013 Share Posted February 27, 2013 No work buy maps -- Buy a next map function buyMap(mapName) local account = getPlayerAccount(source) local cash = getAccountData(account, "cash") local level = getAccountData(account, "level") if not (mapName == "") then if not (isGuestAccount(getPlayerAccount(source))) then if tonumber(level) >= 10 then if tonumber(cash) >= 3500 then triggerEvent("onNextmapBuy",source,mapName) else outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map!",source,255,255,255,true) end else outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF10 #FF9900to buy maps!",source,255,255,255,true) end end else outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) end end addEvent("triggerbuyMap",true) addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) function onBuyMapReady() local account = getPlayerAccount(source) addStat(account,"cash",-3500) end addEvent("setCashofBuyMap",true) addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) --end MAP thanks in advance Link to comment
Castillo Posted February 27, 2013 Share Posted February 27, 2013 What doesn't work exactly? do you get any script error? use /debugscript 3. Link to comment
h4x7o0r Posted February 27, 2013 Share Posted February 27, 2013 I'm pretty sure that you use a panel that's not yours, so if i'm right you better change : triggerEvent("onNextmapBuy",source,mapName) with executeCommandHandler("nextmap", thePlayer, mapName) Link to comment
Snake Posted February 28, 2013 Author Share Posted February 28, 2013 Add executeCommandHandler ( "nextmap" , thePlayer, MapName ) Server_lua. -- Buy a next map function buyMap(mapName) local account = getPlayerAccount(source) local cash = getAccountData(account, "cash") local level = getAccountData(account, "level") if not (mapName == "") then if not (isGuestAccount(getPlayerAccount(source))) then if tonumber(level) >= 10 then if tonumber(cash) >= 3500 then executeCommandHandler ( "nextmap" , thePlayer, MapName ) else outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map!",source,255,255,255,true) end else outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF10 #FF9900to buy maps!",source,255,255,255,true) end end else outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) end end addEvent("triggerbuyMap",true) addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) function onBuyMapReady() local account = getPlayerAccount(source) addStat(account,"cash",-3500) end addEvent("setCashofBuyMap",true) addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) --end MAP Racevoting_server.lua 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('#00B2EE* #ECECECNextmap: #ABCDEF' .. getMapName( g_ForcedNextMap ) .. ' #00FF00set #ECECECby #ECECEC' .. getPlayerName( player ), g_Root, 236, 236, 236, 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) buyed = {} addCommandHandler('buynextmap', 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 local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if g_ForcedNextMap then outputRace ( 'Another player buy next map !', 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('#00B2EE* #ECECECNextmap: #ABCDEF' .. getMapName( g_ForcedNextMap ) .. ' #00FF00bought #ECECECby #ECECEC' .. getPlayerName( player ), g_Root, 255, 255, 255, true) triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) buyed[player] = 1 end ) --onMapStarting addCommandHandler ( '~buyednextmap~', function ( player, cmd, amount ) if buyed[player] == 1 then takePlayerMoney ( player, amount ) buyed[player] = 0 end end ) Result:) Link to comment
Snake Posted February 28, 2013 Author Share Posted February 28, 2013 Add executeCommandHandler ( "nextmap" , thePlayer, MapName ) Server_lua. -- Buy a next map function buyMap(mapName) local account = getPlayerAccount(source) local cash = getAccountData(account, "cash") local level = getAccountData(account, "level") if not (mapName == "") then if not (isGuestAccount(getPlayerAccount(source))) then if tonumber(level) >= 10 then if tonumber(cash) >= 3500 then executeCommandHandler ( "nextmap" , thePlayer, MapName ) else outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map!",source,255,255,255,true) end else outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF10 #FF9900to buy maps!",source,255,255,255,true) end end else outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) end end addEvent("triggerbuyMap",true) addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) function onBuyMapReady() local account = getPlayerAccount(source) addStat(account,"cash",-3500) end addEvent("setCashofBuyMap",true) addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) --end MAP Racevoting_server.lua 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('#00B2EE* #ECECECNextmap: #ABCDEF' .. getMapName( g_ForcedNextMap ) .. ' #00FF00set #ECECECby #ECECEC' .. getPlayerName( player ), g_Root, 236, 236, 236, 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) buyed = {} addCommandHandler('buynextmap', 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 local map, errormsg = findMap( query ) if not map then outputRace( errormsg, player ) return end if g_ForcedNextMap then outputRace ( 'Another player buy next map !', 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('#00B2EE* #ECECECNextmap: #ABCDEF' .. getMapName( g_ForcedNextMap ) .. ' #00FF00bought #ECECECby #ECECEC' .. getPlayerName( player ), g_Root, 255, 255, 255, true) triggerClientEvent ( "setNextMap", getRootElement(), getMapName( g_ForcedNextMap ) ) buyed[player] = 1 end ) --onMapStarting addCommandHandler ( '~buyednextmap~', function ( player, cmd, amount ) if buyed[player] == 1 then takePlayerMoney ( player, amount ) buyed[player] = 0 end end ) Result:) Link to comment
Snake Posted February 28, 2013 Author Share Posted February 28, 2013 Sorry for 2 Post. Link to comment
Max+ Posted February 28, 2013 Share Posted February 28, 2013 You Have 2 Erros #1 thePlayer -- not defined #2 (mapName) in the command you put MapName ! -- Buy a next map function buyMap(mapName) local account = getPlayerAccount(source) local cash = getAccountData(account, "cash") local level = getAccountData(account, "level") if not (mapName == "") then if not (isGuestAccount(getPlayerAccount(source))) then if tonumber(level) >= 10 then if tonumber(cash) >= 3500 then executeCommandHandler ( "nextmap" , source, mapName ) else outputChatBox("#FFFFFF[userpanel] #FF9900You don't have enough money to set a map!",source,255,255,255,true) end else outputChatBox("#FFFFFF[userpanel] #FF9900You need to be level #FFFFFF10 #FF9900to buy maps!",source,255,255,255,true) end end else outputChatBox("#FFFFFF[userpanel] #FF9900Please select a map from the list first!",source,255,255,255,true) end end addEvent("triggerbuyMap",true) addEventHandler( "triggerbuyMap", getRootElement(),buyMap ) function onBuyMapReady() local account = getPlayerAccount(source) addStat(account,"cash",-3500) end addEvent("setCashofBuyMap",true) addEventHandler( "setCashofBuyMap", getRootElement(), onBuyMapReady ) --end MAP Link to comment
Snake Posted February 28, 2013 Author Share Posted February 28, 2013 There is progress)) Now buy maps can only administrators. Everyone can not. I added to the Default ACL this: right> No not work( Link to comment
Snake Posted February 28, 2013 Author Share Posted February 28, 2013 Maybe need to give others rights? Link to comment
Snake Posted February 28, 2013 Author Share Posted February 28, 2013 1. setmap function works if you press buymap.(only admin) 2. function buymap no work. Why? Pls help. 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