Jump to content

TheGuyNL

Members
  • Posts

    50
  • Joined

  • Last visited

Everything posted by TheGuyNL

  1. TheGuyNL

    VPS

    Hey, I got a VPS and a mta server running on it but when I close my ssh connection the server stops aswell. How do I prevent it from doing this?
  2. TheGuyNL

    Question

    Hello, what is the permission for admin B? Thanks
  3. Yes, I know that but I want that the player can select a map from a list and then buy it as next map. Not redo the current map (which is already in my stat system as a command named: !buy redo)
  4. getRunningGamemodeMap gives me the current map but not the selected map, or does it?
  5. So with getRunningGamemodeMap I can get the mapname to use set nextmap with?
  6. Of course, it's always running with race.
  7. Hello, So I am making this mapshop for my server. A friend send me his old mapshop but it comes up with an error: ERROR: call: failed to call 'mapmanager:getGamemodeMap' [string "?"] It actually spams the console with this error when you try to open the GUI. Here is my server-side script: mapCost = 5000 -- Maps function getServerMaps (loadList) local tableOut if loadList then tableOut = {} -- local deletedMaps = {} local gamemodes = {} gamemodes = call(getResourceFromName("mapmanager"), "getGamemodes") for id,gamemode in ipairs (gamemodes) do tableOut[id] = {} tableOut[id].name = getResourceInfo(gamemode, "name") or getResourceName(gamemode) tableOut[id].resname = getResourceName(gamemode) tableOut[id].maps = {} local maps = call(getResourceFromName("mapmanager"), "getMapsCompatibleWithGamemode" , gamemode) for _,map in ipairs (maps) do table.insert(tableOut[id]["maps"] ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) end table.sort(tableOut[id]["maps"], sortCompareFunction) end table.sort((tableOut), sortCompareFunction) table.insert(tableOut, {name = "no gamemode", resname = "no gamemode", maps = {}}) local countGmodes = #tableOut local maps = call(getResourceFromName("mapmanager"), "getMapsCompatibleWithGamemode") for id,map in ipairs (maps) do -- if fileOpen(":"..getResourceName(map).."/deleted") then -- table.insert(deletedMaps ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) -- else table.insert(tableOut[countGmodes]["maps"] ,{name = getResourceInfo(map, "name") or getResourceName(map), resname = getResourceName(map)}) -- end end -- table.sort(deletedMaps, sortCompareFunction) table.sort(tableOut[countGmodes]["maps"], sortCompareFunction) -- table.insert(tableOut, {name = "deleted maps", resname = "deleted maps", maps = {}}) -- local countGmodes = countGmodes + 1 -- tableOut[countGmodes]["maps"] = deletedMaps end local map = call(getResourceFromName("mapmanager"), "getRunningGamemodeMap") local gamemode = call(getResourceFromName("mapmanager"), "getRunningGamemode") gamemode = gamemode and getResourceName(gamemode) or "N/A" map = map and getResourceName(map) or "N/A" callClientFunction(loadList,"loadMaps", tableOut, gamemode, map) end function sortCompareFunction(s1, s2) if type(s1) == "table" and type(s2) == "table" then s1, s2 = s1.name, s2.name end s1, s2 = s1:lower(), s2:lower() if s1 == s2 then return false end local byte1, byte2 = string.byte(s1:sub(1,1)), string.byte(s2:sub(1,1)) if not byte1 then return true elseif not byte2 then return false elseif byte1 < byte2 then return true elseif byte1 == byte2 then return sortCompareFunction(s1:sub(2), s2:sub(2)) else return false end end function callGetMaps() for i,player in ipairs(getElementsByType("player")) do callClientFunction(player,"getMaps") end end addCommandHandler("rebuildMaps",callGetMaps) -- Buy as next map function buyMap(thePlayer,mapName) local account = getPlayerAccount(player) local playerCash = getAccountData(acount,"cash") if mapIsAlreadySet == false then if not (mapName == "") then if playerCash >= mapCost then triggerEvent("onExternalNextmapRequest",thePlayer,thePlayer,mapName) else outputChatBox("#FF6600* You don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* Please select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* A map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* A map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end function resetMapSetStatus() mapIsAlreadySet = false end addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) addEvent("onScriptSetNextMap",true) addEventHandler("onScriptSetNextMap",getRootElement(), function (mapName) thePlayer = source local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) savePlayerData(thePlayer,"cash",playerCash-mapCost) outputChatBox("#FF6600Nextmap: #FFFFFF"..getPlayerName(thePlayer).."#FF6600 has bought a next map!",getRootElement(),255,255,255,true) outputChatBox("#FF6600Nextmap: "..mapName,getRootElement(),255,255,255,true) mapIsAlreadySet = true scoreboardRefresh(thePlayer) achievement31(thePlayer) end) addEvent("onRaceSetNextMap",true) addEventHandler("onRaceSetNextMap",getRootElement(), function () mapIsAlreadySet = true end) Here is the client-side scipt: -- "Maps" TAB gridMaps = guiCreateGridList(17,51,315,285,false,mapGui[1]) guiGridListSetSortingEnabled(gridMaps,false) guiGridListAddColumn(gridMaps,"Map name",0.9) lblMapsInfo = guiCreateLabel(342,210,245,45,"Each map costs $5000, regardless whether it's DM or DD.",false,mapGui[1]) guiLabelSetVerticalAlign(lblMapsInfo,"center") guiLabelSetHorizontalAlign(lblMapsInfo,"center",true) guiSetFont(lblMapsInfo,"default-bold-small") lblTotalMapsOnServer = guiCreateLabel(342,28,193,19,"Total maps on the server: N/A",false,mapGui[1]) guiSetFont(lblTotalMapsOnServer,"default-bold-small") lblTotalDmMaps = guiCreateLabel(342,47,193,19,"Total DM maps: N/A",false,mapGui[1]) guiSetFont(lblTotalDmMaps,"default-bold-small") lblTotalDdMaps = guiCreateLabel(342,62,193,19,"Total DD maps: N/A",false,mapGui[1]) guiSetFont(lblTotalDdMaps,"default-bold-small") lblSetNextMapTitle = guiCreateLabel(342,189,245,16,"Set as next map",false,mapGui[1]) guiLabelSetColor(lblSetNextMapTitle,255,120,0) guiLabelSetVerticalAlign(lblSetNextMapTitle,"center") guiLabelSetHorizontalAlign(lblSetNextMapTitle,"center",false) guiSetFont(lblSetNextMapTitle,"default-bold-small") lblSearchForMaps = guiCreateLabel(25,25,101,14,"Search for maps:",false,mapGui[1]) guiLabelSetColor(lblSearchForMaps,255,120,0) guiLabelSetVerticalAlign(lblSearchForMaps,"center") guiSetFont(lblSearchForMaps,"default-bold-small") lblSelectedMapNameTitle = guiCreateLabel(342,97,245,16,"Selected map name:",false,mapGui[1]) guiLabelSetColor(lblSelectedMapNameTitle,150,255,150) guiSetFont(lblSelectedMapNameTitle,"default-bold-small") lblSelectedMapAuthorTitle = guiCreateLabel(342,136,245,16,"Map type:",false,mapGui[1]) guiLabelSetColor(lblSelectedMapAuthorTitle,150,255,150) guiSetFont(lblSelectedMapAuthorTitle,"default-bold-small") lblSelectedMapName = guiCreateLabel(342,113,245,16,"N/A",false,mapGui[1]) lblSelectedMapAuthor = guiCreateLabel(342,152,245,16,"N/A",false,mapGui[1]) lblMapTabLine1 = guiCreateLabel(342,309,245,27,"---------------------------------------------------------------",false,mapGui[1]) guiLabelSetColor(lblMapTabLine1,255,120,0) guiLabelSetVerticalAlign(lblMapTabLine1,"center") guiLabelSetHorizontalAlign(lblMapTabLine1,"center",false) guiSetFont(lblMapTabLine1,"default-bold-small") lblMapTabLine2 = guiCreateLabel(342,173,245,16,"---------------------------------------------------------------",false,mapGui[1]) guiLabelSetColor(lblMapTabLine2,255,120,0) guiLabelSetVerticalAlign(lblMapTabLine2,"center") guiLabelSetHorizontalAlign(lblMapTabLine2,"center",false) guiSetFont(lblMapTabLine2,"default-bold-small") lblMapTabLine3 = guiCreateLabel(342,81,245,16,"---------------------------------------------------------------",false,tabs[1]) guiLabelSetColor(lblMapTabLine3,255,120,0) guiLabelSetVerticalAlign(lblMapTabLine3,"center") guiLabelSetHorizontalAlign(lblMapTabLine3,"center",false) guiSetFont(lblMapTabLine3,"default-bold-small") editMapSearch = guiCreateEdit(129,23,198,21,"",false,tabs[1]) btnBuyNextMap = guiCreateButton(380,265,169,44,"Buy as next map - $5000",false,tabs[1]) function onresourceStart () bindKey ("F1", "down", displayTab) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function displayTab(openTab) local visible = guiGetVisible(mapGui[1]) if visible == false then guiSetVisible(mapGui[1],true) else guiSetVisible(mapGui[1],false) end end function getMaps() totalServerMaps = 0 totalDmMaps = 0 totalDdMaps = 0 setTimer(callServerFunction,500,1,"getServerMaps",getLocalPlayer()) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getMaps) function loadMaps(gamemodeMapTable, gamemode, map) guiGridListClear(gridMaps) if gamemodeMapTable then aGamemodeMapTable = gamemodeMapTable for id,gamemode in pairs (gamemodeMapTable) do if (gamemode.name == "Race") then for id,map in ipairs (gamemode.maps) do local row = guiGridListAddRow ( gridMaps ) guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false ) guiGridListSetItemData ( gridMaps, row, 1, map.resname) updateMapLabels(1) end end end end end -- Map search function mapSearch() guiGridListClear(gridMaps) local searchString = string.lower(guiGetText(editMapSearch)) if ( searchString == "" ) then for id,gamemode in pairs (aGamemodeMapTable) do if (gamemode.name == "Race") then for id,map in ipairs (gamemode.maps) do local row = guiGridListAddRow ( gridMaps ) guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false ) guiGridListSetItemData ( gridMaps, row, 1, map.resname) end end end else for id,gamemode in pairs (aGamemodeMapTable) do if (gamemode.name == "Race") then local noMapsFound = true for id,map in ipairs (gamemode.maps) do if string.find(string.lower(map.name.." "..map.resname), searchString, 1, true) then local row = guiGridListAddRow ( gridMaps ) guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false ) guiGridListSetItemData ( gridMaps, row, 1, map.resname) noMapsFound = false end end if noMapsFound == true then local row = guiGridListAddRow(gridMaps) guiGridListSetItemText (gridMaps, row, 1, "No maps matching your search query!", false, false) guiGridListSetItemColor (gridMaps, row, 1, 255,50,50) end end end end updateMapLabels(2) end function buyNextMap() local row,column = guiGridListGetSelectedItem(gridMaps) local mapName = guiGridListGetItemText(gridMaps,row,1) callServerFunction("buyMap",getLocalPlayer(),mapName) end -- Update labels function updateMapLabels(updateMode) if updateMode == 1 then guiSetText(lblTotalMapsOnServer,"Total maps on the server: "..totalServerMaps) guiSetText(lblTotalDmMaps,"Total DM Maps: "..totalDmMaps) guiSetText(lblTotalDdMaps,"Total DD Maps: "..totalDdMaps) else local row,column = guiGridListGetSelectedItem(gridMaps) local mapName = guiGridListGetItemText(gridMaps,row,1) if mapName == "" then guiSetText(lblSelectedMapName,"N/A") guiSetText(lblSelectedMapAuthor,"N/A") else guiSetText(lblSelectedMapName,mapName) if string.find(mapName,"[DM]",1,true) then guiSetText(lblSelectedMapAuthor,"Deathmatch") elseif string.find(mapName,"[DD]",1,true) then guiSetText(lblSelectedMapAuthor,"Destruction Derby") elseif string.find(mapName,"[FUN]",1,true) then guiSetText(lblSelectedMapAuthor,"Fun map") else guiSetText(lblSelectedMapAuthor,"UNKNOWN") end end end end Thanks in advance for helping me!
  8. TheGuyNL

    Question

    Again, thanks alot.
  9. TheGuyNL

    Question

    Something else, what is the function to restart a map? to make a command like /redo
  10. TheGuyNL

    Question

    Thanks! This works great.
  11. TheGuyNL

    Question

    Is there an event for when a new map loads? I need my cash in the scoreboard to update after a new map loads, how do I do this? Here is my script: exports["scoreboard"]:scoreboardAddColumn("Cash") exports["scoreboard"]:scoreboardAddColumn("Points") function setStats(player) local account = getPlayerAccount(player) if (account) then local cash = getAccountData(account, "cash") local points = getAccountData(account, "points") setElementData ( player, "Cash", "$" ..cash.. "" ) setElementData ( player, "Points", points ) else setElementData ( player, "Cash", "guest" ) setElementData ( player, "Points", "guest" ) end end function timer() setTimer( setStats, 1000, 1, source ) end addEventHandler("onPlayerLogin", getRootElement(), timer) addEventHandler("onPlayerJoin", getRootElement(), timer)
  12. Hey, How can I make the killmessages support name colours? Thanks.
  13. TheGuyNL

    Nametags

    Tried, didn't work
  14. TheGuyNL

    Nametags

    In what lua should I look in the race resource?
  15. TheGuyNL

    Nametags

    Hey, How can I enable the nametags in Race gamemode support color codes?
  16. Agreed, simple jump, wallride, loop abuse. And boring aswell. And it some points you will not know where to go.
  17. I hope you realize scripters don't do stuff like this for free.
  18. If you have no experience with linux, don't do it. It's hard if you do not understand how to communicate with the server. If you want a server you should go with a host.
  19. There are too long straights in this map. It's enjoyable but not a challange, but it's fun to play an easy map time by time.
  20. TheGuyNL

    Shiny infernus

    http://wiki.multitheftauto.com/images/8 ... Screen.jpg exactly what you send I will add that
  21. TheGuyNL

    Shiny infernus

    Hello, I have seen that in some MTA vids the infernus is all shiny and reflecting, how to do this? Thanks, TheGuyNL
  22. Awesome map! You've done a great job on the deco, it looks very nice and the track has some new stunts aswell. Overall just another cool map! Any way I could get it for my server?
  23. As you said it's a high speed map, and that's all. It's not too bad but not the best I have seen. On some points it's unclear what to do as you will not know how the map goes the first few times, but overall it's a decent map.
×
×
  • Create New...