Jump to content

Buy map problem


JoZeFSvK

Recommended Posts

Posted

I have problem with setnextmap in gui panel, i buy map deduct me money, but not start it map which i buy. I think problem will in racevoting.lua but i add execute command. I dont know what write to racevoting.lua :/

Server:

  
function changeMap(player, mapName, price) 
  
   local account = getPlayerAccount(player) 
   local cash = getAccountData(account, "mafin.cash") 
  
   executeCommandHandler("abcd1234", player, mapName) 
    
   setAccountData(account, "mafin.cash", cash-price)  
   setElementData(player, "Cash", cash-price)  
   outputChatBox("* Next map changed! [#668CFF-"..price.." cash#F53D00]", player, 245, 61, 0, true) 
   outputChatBox("* "..getPlayerName(player).." #F53D00has changed next map to "..mapName, getRootElement(), 245, 61, 0, true) 
    
   -- blow andromada please  
   if (vehicleID == 592) then 
      setTimer(blowVehicle, 15000, 1, vehicle) 
   end 
    
  
          
end 
  
function updateMapPlz(kto) 
      local compatibleMaps = exports.mapmanager:getMapsCompatibleWithGamemode(exports.mapmanager:getRunningGamemode()) 
      for _, map in pairs( compatibleMaps ) do 
         triggerClientEvent("updateMapList",getRootElement(),kto,getResourceInfo(map, "name") or getResourceName(map)) 
        end 
end 
  
  
  
addEvent( "updateMapPlz", true ) 
addEventHandler ( "updateMapPlz", getRootElement(), updateMapPlz) 
  
  

Client some part from gui:

  
local mapColumn = {} 
local mapRow = {} 
local mapList = {} 
local cash_map = 100 
  
--gui 
needed = cash_map 
    mapList= guiCreateGridList ( 10, 15, 200, 280, false, CW["tabMap"]) 
    columnMap = guiGridListAddColumn( mapList, "Map name", 0.85 )     
   CW["labelPriceTelo"] = guiCreateLabel(250,125,100,20,"price: ".. needed  .." cash",false,CW["tabMap"]) 
   guiLabelSetColor(CW["labelPriceTelo"], 102, 140, 255)       
   CW["buttonM"] = guiCreateButton(250,145,100,20,"Buy next map!",false,CW["tabMap"]) 
  
  
  
  
  
function()  
      local mapName = guiGridListGetItemText ( mapList, guiGridListGetSelectedItem ( mapList ), 1 ) 
      local amount = cash_map 
       
      if (mapName == "") then 
         guiSetVisible(CW["C"], false) 
         guiSetVisible(GUI_error["1"], true) 
      elseif (points < tonumber(amount)) then 
         guiSetVisible(CW["C"], false)       
         guiSetVisible(GUI_error["3"], true) 
      else  
         guiSetVisible(CW["C"], false) 
         triggerServerEvent ( "changeMap", getLocalPlayer(), getLocalPlayer(), mapName, cash_map )   
         guiSetVisible(GUI_error["5"], true) 
      end 
   end, false) 
    
addEvent("updateMapList",true) 
addEventHandler ( "updateMapList", CW["buttonBet"], function(source,mapss)  
   mapRow = guiGridListAddRow ( mapList ) 
   guiGridListSetItemText ( mapList, mapRow, columnMap, mapss, false, false )      
end) 
  
triggerServerEvent ( "updateMapPlz", getLocalPlayer(),getLocalPlayer())  
  

Posted
What do you mean by "Thank you"? I told you to do something.

Nope I did not know what to write in racevoting.lua like command but you write abcd... and i write to racevoting.lua and it did and work, so ?

Posted

For buymap you can use the function "SetNextMap" from admin panel. Only the function need to be edited a bit bk he is checking if the player is admin or not but it's not to hard to edit it.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...