Jump to content

Help! Map shop not working?


nlmarkoesnl

Recommended Posts

hey all.

i have a userpanel.. where players can find information,stats shops and buy maps.....

Well @ the maps section.. It doesnt show anymaps to buy... And i don't know why.. Hope that 1 of you guy's know what the problem is?

The scrips are here:

main_client:

-- "Maps" TAB 
  
    gridMaps = guiCreateGridList(17,51,315,285,false,tabs[5]) 
    guiGridListSetSortingEnabled(gridMaps,false) 
    guiGridListAddColumn(gridMaps,"Map name",0.9) 
  
    lblMapsInfo = guiCreateLabel(342,210,245,45,"You need to be level 2 or higher to set maps. Each map costs $5000, regardless whether it's DM or DD.",false,tabs[5]) 
    guiLabelSetVerticalAlign(lblMapsInfo,"center") 
    guiLabelSetHorizontalAlign(lblMapsInfo,"center",false) 
    guiSetFont(lblMapsInfo,"default-bold-small") 
  
  
    lblTotalMapsOnServer = guiCreateLabel(342,28,193,19,"Total maps on the server: N/A",false,tabs[5]) 
    guiSetFont(lblTotalMapsOnServer,"default-bold-small") 
  
    lblTotalDmMaps = guiCreateLabel(342,47,193,19,"Total DM maps: N/A",false,tabs[5]) 
    guiSetFont(lblTotalDmMaps,"default-bold-small") 
  
    lblTotalDdMaps = guiCreateLabel(342,62,193,19,"Total DD maps: N/A",false,tabs[5]) 
    guiSetFont(lblTotalDdMaps,"default-bold-small") 
  
    lblSetNextMapTitle = guiCreateLabel(342,189,245,16,"Set a next map",false,tabs[5]) 
    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,tabs[5]) 
    guiLabelSetColor(lblSearchForMaps,255,120,0) 
    guiLabelSetVerticalAlign(lblSearchForMaps,"center") 
    guiSetFont(lblSearchForMaps,"default-bold-small") 
  
    lblSelectedMapNameTitle = guiCreateLabel(342,97,245,16,"Selected map name:",false,tabs[5]) 
    guiLabelSetColor(lblSelectedMapNameTitle,150,255,150) 
    guiSetFont(lblSelectedMapNameTitle,"default-bold-small") 
  
    lblSelectedMapAuthorTitle = guiCreateLabel(342,136,245,16,"Map type:",false,tabs[5]) 
    guiLabelSetColor(lblSelectedMapAuthorTitle,150,255,150) 
    guiSetFont(lblSelectedMapAuthorTitle,"default-bold-small") 
  
  
    lblSelectedMapName = guiCreateLabel(342,113,245,16,"N/A",false,tabs[5]) 
  
    lblSelectedMapAuthor = guiCreateLabel(342,152,245,16,"N/A",false,tabs[5]) 
  
  
    lblMapTabLine1 = guiCreateLabel(342,309,245,27,"---------------------------------------------------------------",false,tabs[5]) 
    guiLabelSetColor(lblMapTabLine1,255,120,0) 
    guiLabelSetVerticalAlign(lblMapTabLine1,"center") 
    guiLabelSetHorizontalAlign(lblMapTabLine1,"center",false) 
    guiSetFont(lblMapTabLine1,"default-bold-small") 
  
    lblMapTabLine2 = guiCreateLabel(342,173,245,16,"---------------------------------------------------------------",false,tabs[5]) 
    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[5]) 
    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[5]) 
  
    btnBuyNextMap = guiCreateButton(380,265,169,44,"Buy as next map - $5000",false,tabs[5]) 

main server:

-- Buy a next map 
function buyMap(thePlayer,mapName) 
    local playerLevel = tonumber(loadPlayerData(thePlayer,"level")) 
    local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) 
    if mapIsAlreadySet == false then 
        if not (mapName == "") then 
            if playerLevel >= mapLevel then 
                if playerCash >= mapCost then 
                    triggerEvent("onExternalNextmapRequest",thePlayer,thePlayer,mapName) 
                else 
                    outputChatBox("#0000ff* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) 
                end 
            else 
                outputChatBox("#0000ff* #FFFFFFYou need to be level #ABCDEF"..mapLevel.." #FFFFFFor higher to set maps!",thePlayer,255,255,255,true) 
            end 
        else 
            outputChatBox("#0000ff* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) 
        end 
    else 
        outputChatBox("#0000ff* #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) 
    end 
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("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) 
    outputChatBox("#FFFFFFNextmap: #FF8800"..mapName,getRootElement(),255,255,255,true) 
    mapIsAlreadySet = true 
    scoreboardRefresh(thePlayer) 
    achievement31(thePlayer) 
end) 
  
addEvent("onRaceSetNextMap",true) 
addEventHandler("onRaceSetNextMap",getRootElement(), 
function () 
    mapIsAlreadySet = true 
end) 

Link to comment

i did debugscript and got this:

main_client.lua:1101: bad argument @ 'guiSetVisible' [Expected argument 1, got nil]

here is the script:

  
 
--------------------
-- Set all variables
--------------------
 
screenWidth, screenHeight = guiGetScreenSize()
function setVariables()
    killedByAfk = 0
    betPlayer = "none"
    betAmount = 0
    oldAmount = 0
    achievementActive = 0
end
addEventHandler("onClientResourceStart",getRootElement(),setVariables)
 
function vars2()
    colorPickMode = false
    afkCounter = 1
    tCount = 11
    playerIsChatting = false
    chatRequestMode = false
    chatNotificationMode = false
    chatRequestedBy = "none"
    playerIsBusy = false
    newMessageArrived = false
    setElementData(getLocalPlayer(),"chattingWith","none")
    allowPersonalDetails = true
    allowStats = true
    soundMessage = true
    soundRequest = true
    showOnDeath = false
    useHunterSkin = false
    recentlySavedSettings = false
    customHorn = {}
    hornNum = 0
    setHornSound = 0
    acceptMode = 1
    totalServerMaps = 0
    totalDmMaps = 0
    totalDdMaps = 0
    screenWidth,screenHeight = guiGetScreenSize()
    mainWindowWidth = 619
    mainWindowHeight = 365
    PDWindowWidth = 369
    PDWindowHeight = 370
    CNWindowWidth = 340
    CNWindowHeight = 123
    SWindowWidth = 541
    SWindowHeight = 274
    chatImageSize = 135
    SkinWindowWidth = 604
    SkinWindowHeight = 429
    colorWindowWidth = 405
    colorWindowHeight = 195
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),vars2)
 
 
 
 
------------
-- Userpanel
------------
 
 
-- Create achievements
achievements = {
"New kid in town",
"Easy as",
"Dominating",
"Unstoppable",
"FTW!",
"Deathstalker",
"Leveller - Rank I",
"Leveller - Rank II",
"Leveller - Rank III",
"Leveller - Rank IV",
"Levelling Champion",
"Elite Leveller - Rank I",
"Elite Leveller - Rank II",
"Elite Leveller - Rank III",
"Elite Levelling Champion",
"Hunter magnet",
"Master of disaster",
"King of the sky",
"My very own toptime",
"Toptime expert",
"Gaming spree",
"All-time player",
"Connect frenzy",
"Climbing the ladder",
"Money saver",
"Blue-collar millionaire",
"Colors are fun",
"Pimp my ride",
"Communicative gamer award",
"Charity",
"Glimpse of the future",
"Centurion",
"Milestone",
"Millennium",
"Socializer",
"Speed writer",
"Quick reflexes",
"I care how I look",
"Horn lover",
"Achievement Hunter"}
 
 
details = {
"Join the server for the first time.",
"Win on 10 maps.",
"Win on 50 maps.",
"Win on 100 maps.",
"Win on 200 maps.",
"Die 300 times.",
"Reach level 5.",
"Reach level 10.",
"Reach level 15.",
"Reach level 20.",
"Reach level 25.",
"Reach level 10 ELITE.",
"Reach level 15 ELITE.",
"Reach level 20 ELITE.",
"Reach level 25 ELITE.",
"Get 10 hunters.",
"Get 50 hunters.",
"Get 100 hunters.",
"Set a top hunter time.",
"Set 10 top hunter times.",
"Play for 20 hours.",
"Play for 50 hours.",
"Join the server 40 times.",
"Get a total of $10,000.",
"Get a total of $100,000.",
"Get a total of $1,000,000.",
"Change your headlights color.",
"Change your vehicle color.",
"Start a chat with someone.",
"Send some money to a player.",
"Buy a next map.",
"Play a total of 100 maps.",
"Play a total of 500 maps.",
"Play a total of 1000 maps.",
"Update your personal details.",
"Win 15 reaction tests.",
"Win a reaction test in 5 seconds or less.",
"Buy any skin from the shop.",
"Buy any horn from the shop.",
"Unlock all other achievements."}
 
 
-- Create horns
hornName={
"Default GTA horn",
"Airhorn",
"Clown",
"Train",
"Fog horn",
"Submarine",
"Military trumpet",
"Mr. Whoopie"}
 
hornPrice={
"  N/A",
"  2000",
"  4000",
"  6000",
"  8000",
"  10000",
"  15000",
"  20000"}
 
hornSound={
"sounds/airhorn.wav",
"sounds/clownhorn.mp3",
"sounds/trainhorn.mp3",
"sounds/cargoshiphorn.mp3",
"sounds/submarinehorn.wav",
"sounds/generalleehorn.mp3",
"sounds/whoopiehorn.mp3"}
 
 
 
function onPlayerResourceStart()
 
    -- Create all the tabs
    tabs = {
        guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"WARNING! The userpanel has failed to load! Please contact NeXTreme as soon as possible!!",false),
        guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Players",false),
        guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Achievements",false),
        guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Shop",false),
        guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Maps",false),
        guiCreateWindow(screenWidth/2-mainWindowWidth/2,screenHeight/2-mainWindowHeight/2,mainWindowWidth,mainWindowHeight,"Options",false)
    }
 
 
    guiSetVisible(tabs[1],false)
    guiSetVisible(tabs[2],false)
    guiSetVisible(tabs[3],false)
    guiSetVisible(tabs[4],false)
    guiSetVisible(tabs[5],false)
    guiSetVisible(tabs[6],false)
 
 
 
    -- "Stats" TAB
    lblStats = guiCreateLabel(18,24,150,49,"Stats",false,tabs[1])
    guiLabelSetColor(lblStats,255,130,0)
    guiLabelSetVerticalAlign(lblStats,"top")
    guiLabelSetHorizontalAlign(lblStats,"left",false)
    guiSetFont(lblStats,"sa-header")
 
    lblPlayerLevel = guiCreateLabel(18,83,136,15,"Level: N/A",false,tabs[1])
    guiSetFont(lblPlayerLevel,"default-bold-small")
 
    lblPlayerStats = guiCreateLabel(18,201,84,16,"Player stats:",false,tabs[1])
    guiLabelSetColor(lblPlayerStats,255,130,0)
    guiSetFont(lblPlayerStats,"default-bold-small")
 
    lblPlayerMoney = guiCreateLabel(18,98,151,14,"Money: N/A",false,tabs[1])
    guiLabelSetColor(lblPlayerMoney,255,255,255)
    guiSetFont(lblPlayerMoney,"default-bold-small")
 
    lblAchievementsUnlocked = guiCreateLabel(18,126,180,14,"Achievements unlocked: 0/40",false,tabs[1])
    guiSetFont(lblAchievementsUnlocked,"default-bold-small")
 
    lblTotalPlayingTime = guiCreateLabel(18,156,292,15,"Total playing time: N/A",false,tabs[1])
    guiSetFont(lblTotalPlayingTime,"default-bold-small")
 
    lblNextLevelProgress = guiCreateLabel(335,131,232,45,"Progress to next level:",false,tabs[1])
    guiLabelSetVerticalAlign(lblNextLevelProgress,"top")
    guiLabelSetHorizontalAlign(lblNextLevelProgress,"center",false)
    guiSetFont(lblNextLevelProgress,"default-bold-small")
 
    lblPlayerLevelRank = guiCreateLabel(388,45,124,22,"Loading...",false,tabs[1])
    guiLabelSetColor(lblPlayerLevelRank,255,130,0)
    guiLabelSetVerticalAlign(lblPlayerLevelRank,"bottom")
    guiLabelSetHorizontalAlign(lblPlayerLevelRank,"center",false)
    guiSetFont(lblPlayerLevelRank,"default-bold-small")
 
    lblMapsWon = guiCreateLabel(18,242,205,15,"Maps won: N/A",false,tabs[1])
    guiSetFont(lblMapsWon,"default-bold-small")
 
    lblTotalMapsPlayed = guiCreateLabel(18,227,205,15,"Total maps played: N/A",false,tabs[1])
    guiSetFont(lblTotalMapsPlayed,"default-bold-small")
 
    lblWinRatio = guiCreateLabel(18,260,205,15,"Map win ratio: N/A",false,tabs[1])
    guiSetFont(lblWinRatio,"default-bold-small")
 
    lblTotalHunters =
Link to comment

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...