Help me User Panel

All Lua scripting topics related to Multi Theft Auto.

Moderators: Scripting Moderators, Moderators, MTA Team

Help me User Panel

Postby 6RB|AccenT on Fri May 04, 2012 12:36 pm

hi Guys


i have UserPanel

How to Edit gridlist maps name

My User Panel


Image


Help Me Plz
Race [10%]
LoginPanel [0%]
Hunter Area [100%]
Spectators [100%]
Level System [100%]
Info Map [100%]
Clan-Info [0%]
6RB|AccenT
Civilian
 
Posts: 24
Joined: Fri May 04, 2012 7:37 am
Gang: Go For Fight =G4F

Re: Help me User Panel

Postby 6RB|AccenT on Fri May 04, 2012 12:37 pm

i only Create Grid List How to Show Name Maps plz Help ME
Race [10%]
LoginPanel [0%]
Hunter Area [100%]
Spectators [100%]
Level System [100%]
Info Map [100%]
Clan-Info [0%]
6RB|AccenT
Civilian
 
Posts: 24
Joined: Fri May 04, 2012 7:37 am
Gang: Go For Fight =G4F

Re: Help me User Panel

Postby sckatchof on Fri May 04, 2012 1:50 pm

MiX# wrote:i only Create Grid List How to Show Name Maps plz Help ME


show your code to help you we can't help you without code .
sckatchof
Thug
 
Posts: 398
Joined: Thu Nov 17, 2011 4:32 pm
Location: Tunisia
Gang: SRC

Re: Help me User Panel

Postby Michael# on Fri May 04, 2012 2:03 pm

  1. for _, map in ipairs ( exports['mapmanager']:getMapsCompatibleWithGamemode ( 'race' ) ) do
  2.     local row = guiGridListAddRow ( urGridList )
  3.     guiGridListSetItemText ( urGridList, row, 1, tostring ( getResourceInfo ( map, 'name' ) ), false, false )
  4. end
Michael#
Busta
 
Posts: 168
Joined: Tue Apr 17, 2012 2:45 pm
Location: United Kingdom
Gang: EGT

Re: Help me User Panel

Postby 6RB|AccenT on Fri May 04, 2012 3:50 pm

[wiki]this my code

localPlayer = getLocalPlayer()
 
function addColumns()
    exports.scoreboard:scoreboardAddColumn("Points")
    exports.scoreboard:scoreboardAddColumn("Race Wins") 
    exports.scoreboard:scoreboardAddColumn("Race Loses")   
    setElementData(localPlayer,"Points",0)
    setElementData(localPlayer,"Race Loses",0)
    setElementData(localPlayer,"Race Wins",0)   
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), addColumns)
 
outputChatBox("Resource Userpanel v3.3 Started! press F1 to use it!",0,255,0)
outputChatBox("Author: Castillo",255,255,0)
 
userPanelWindow = guiCreateWindow(0,4,600,430,"Welcome To Your UserPanel, ",false)
guiSetVisible(userPanelWindow,false)
tabPanel = guiCreateTabPanel(9,24,600,430,false,userPanelWindow)
tab1 = guiCreateTab("Maps",tabPanel)
mapsNameEdit = guiCreateEdit(377,40,200,29,"",false,tab1)
mapsNickLabel = guiCreateLabel(380,17,320,18,"Search Maps: ",false,tab1)
guiLabelSetColor(mapsNickLabel,0,255,0)
mapspriceLabel = guiCreateLabel(380,80,320,18,"Price : 4000$",false,tab1)
guiLabelSetColor(mapspriceLabel,255,150,0)
refreshmapButton = guiCreateButton(375,100,200,30,"Refresh Map List",false,tab1)
mapsbyLabel = guiCreateLabel(380,140,320,18,"UserPanel By : MiX#",false,tab1)
guiCreateStaticImage (420,180,119,100,"img/logo.png",false,tab1 )
buynextButton = guiCreateButton(375,320,200,30,"Buy As Next Map",false,tab1)
tab2 = guiCreateTab("Send Money",tabPanel)
playerNameEdit = guiCreateEdit(158,26,200,29,"",false,tab2)
guiEditSetReadOnly(playerNameEdit,true)
playerNameLabel = guiCreateLabel(197,6,73,15,"Target Player:",false,tab2)
guiLabelSetColor(playerNameLabel,255,130,0)
guiLabelSetVerticalAlign(playerNameLabel,"top")
guiLabelSetHorizontalAlign(playerNameLabel,"left",false)
amountEdit = guiCreateEdit(158,84,200,29,"",false,tab2)
guiEditSetMaxLength(amountEdit,5)
amountLabel = guiCreateLabel(196,60,73,15,"Amount:",false,tab2)
guiLabelSetColor(amountLabel,255,130,0)
guiLabelSetVerticalAlign(amountLabel,"top")
guiLabelSetHorizontalAlign(amountLabel,"left",false)
sendMoneyButton = guiCreateButton(193,134,84,39,"Send",false,tab2)
guiCreateStaticImage (420,5,160,360,"img/logo1.png",false,tab2 )
guiCreateStaticImage (200,180,140,100,"img/logo.png",false,tab2 )
playerNameLabel = guiCreateLabel(160,280,140,15,"You Can Send to Other",false,tab2)
guiLabelSetColor(playerNameLabel,0,255,0)
playerNameLabel = guiCreateLabel(160,300,140,15,"Players by selecting their",false,tab2)
guiLabelSetColor(playerNameLabel,0,255,0)
playerNameLabel = guiCreateLabel(160,320,220,15,"name and then entering the amount",false,tab2)
guiLabelSetColor(playerNameLabel,0,255,0)
tab3 = guiCreateTab("Shop",tabPanel)
Flip = guiCreateButton(17,11,61,26,"Flip",false,tab3)
Nitro = guiCreateButton(16,46,61,26,"Nitro",false,tab3)
GodMode = guiCreateButton(16,82,61,26,"GodMode",false,tab3)
Haystack = guiCreateButton(15,117,61,26,"Haystack",false,tab3)
Invisible = guiCreateButton(14,152,61,26,"Invisible",false,tab3)
Repair = guiCreateButton(130,11,61,26,"Repair",false,tab3)
Barrel = guiCreateButton(128,49,61,26,"Barrel",false,tab3)
Hunter = guiCreateButton(125,83,61,26,"Hunter",false,tab3)
Hydra = guiCreateButton(124,119,61,26,"Hydra",false,tab3)
GodOfWar = guiCreateButton(230,13,149,26,"God Of War",false,tab3)
TimeOfIce = guiCreateButton(230,52,149,26,"Time Of Ice",false,tab3)
info1 = guiCreateButton(386,56,19,18,"?",false,tab3)
info2 = guiCreateButton(387,18,19,18,"?",false,tab3)
info3 = guiCreateButton(194,124,19,18,"?",false,tab3)
info4 = guiCreateButton(196,87,19,18,"?",false,tab3)
info5 = guiCreateButton(197,53,19,18,"?",false,tab3)
info6 = guiCreateButton(199,15,19,18,"?",false,tab3)
info7 = guiCreateButton(91,15,19,18,"?",false,tab3)
info8 = guiCreateButton(90,52,19,18,"?",false,tab3)
info9 = guiCreateButton(89,86,19,18,"?",false,tab3)
info10 = guiCreateButton(88,120,19,18,"?",false,tab3)
info11 = guiCreateButton(87,156,19,18,"?",false,tab3)
tab4 = guiCreateTab("Share money",tabPanel)
tab5 = guiCreateTab("Lights",tabPanel)
guiCreateLabel(0.1,0.2,0.2,0.1,"RED:",true,tab5)
guiCreateLabel(0.1,0.4,0.2,0.1,"GREEN:",true,tab5)
guiCreateLabel(0.1,0.6,0.2,0.1,"BLUE:",true,tab5)
redBar = guiCreateScrollBar( 0.3, 0.2, 0.65, 0.1, true, true, tab5)
greenBar = guiCreateScrollBar( 0.3, 0.4, 0.65, 0.1, true, true, tab5)
blueBar = guiCreateScrollBar( 0.3, 0.6, 0.65, 0.1, true, true, tab5)
lightStatus = guiCreateButton(135,149,142,31,"(1) Lights",false,tab5)
tab6 = guiCreateTab("CarColor",tabPanel)
carRedBar = guiCreateScrollBar( 0.3, 0.2, 0.65, 0.1, true, true, tab6)
carGreenBar = guiCreateScrollBar( 0.3, 0.4, 0.65, 0.1, true, true, tab6)
carBlueBar = guiCreateScrollBar( 0.3, 0.6, 0.65, 0.1, true, true, tab6)
carBlueBar2 = guiCreateScrollBar( 0.3, 0.6, 0.65, 0.1, true, true, tab6)
firstColorLabel = guiCreateLabel(22,39,112,19,"First Color:",false,tab6)
guiLabelSetColor(firstColorLabel,255,255,255)
guiLabelSetVerticalAlign(firstColorLabel,"top")
guiLabelSetHorizontalAlign(firstColorLabel,"left",false)
guiSetFont(firstColorLabel,"clear-normal")
secondColorLabel = guiCreateLabel(22,77,112,19,"Second Color:",false,tab6)
guiLabelSetColor(secondColorLabel,255,255,255)
guiLabelSetVerticalAlign(secondColorLabel,"top")
guiLabelSetHorizontalAlign(secondColorLabel,"left",false)
guiSetFont(secondColorLabel,"clear-normal")
guiSetVisible(carBlueBar2,false)
guiSetVisible(carBlueBar,false)
tab7 = guiCreateTab("Skin",tabPanel)
skinsGrid = guiCreateGridList(16,11,197,171,false,tab7)
guiGridListAddColumn(skinsGrid,"Group",0.3)
guiGridListAddColumn(skinsGrid,"Name",0.5)
guiGridListSetColumnWidth(skinsGrid,1,0.4,true)
guiGridListSetColumnWidth(skinsGrid,2,0.5,true)
changeSkin = guiCreateButton(241,144,145,34,"Change",false,tab7)
skinSelectLabel = guiCreateLabel(252,25,154,24,"Select and click \"change\"",false,tab7)
guiLabelSetColor(skinSelectLabel,255,255,255)
guiLabelSetVerticalAlign(skinSelectLabel,"top")
guiLabelSetHorizontalAlign(skinSelectLabel,"left",false)
 
function onresourceStart ()
  bindKey ("F1", "down", showUserPanel)
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart)
 
function showUserPanel ()
getVisible = guiGetVisible (userPanelWindow)
playerName = getPlayerName ( getLocalPlayer() )
if (getVisible == true) then
    guiSetVisible (userPanelWindow, false)
    guiSetVisible (skinWin, false)
    guiSetVisible (nameWin, false)
    guiSetVisible(infoWin,false)
    showCursor (false)
end
if (getVisible == false) then
    guiSetVisible (userPanelWindow, true)
    showCursor (true)
    local playerMoney = getPlayerMoney(source)
    local playerPoints = getElementData(getLocalPlayer(), "Points")
    local playerWins = getElementData(getLocalPlayer(), "Race Wins")  
    local playerLoses = getElementData(getLocalPlayer(), "Race Loses")
    guiSetText ( userPanelWindow, "Welcome To Your UserPanel, " .. playerName .. " " )
    guiSetText ( playerNickLabel, "Name: [ " .. playerName .. " ]" )
    guiSetText ( playerMoneyLabel, "Your Money: [ " .. playerMoney .. " ]" )
    guiSetText ( playerPointsLabel, "My Points: [ " .. playerPoints .. " ]" )
    guiSetText ( playeWinsLabel, "Total wins: [ " .. playerWins .. " ]" )
    guiSetText ( playeLosesLabel, "Total loses: [ " .. playerLoses .. " ]" )
    playerGridList = guiCreateGridList(3,12,137,350,false,tab2)
                mapGridList = guiCreateGridList(3,12,370,340,false,tab1)
    playersColumn = guiGridListAddColumn(playerGridList,"Players",0.85)
    guiGridListSetSelectionMode(playerGridList,2)
    populateGridlist()
    for id, plaItem in ipairs(getElementsByType("player")) do
    row = guiGridListAddRow ( playerGridList )
    guiGridListSetItemText ( playerGridList, row, playersColumn, getPlayerName ( plaItem ), false, false )
    end
    addEventHandler( "onClientGUIClick", playerGridList, setGUI )
    end
end
 
function setGUI ( )
selectedRow, selectedCol = guiGridListGetSelectedItem( playerGridList )
gridPlayerName = guiGridListGetItemText( playerGridList, selectedRow, selectedCol )
guiSetText ( playerNameEdit, gridPlayerName )
end
 
 
function onGuiClick (button, state, absoluteX, absoluteY)
  if (source == Flip) then
    triggerServerEvent ("buyFlip", getLocalPlayer())
  elseif (source == Nitro) then
    triggerServerEvent ("buyNitro", getLocalPlayer())
  elseif (source == GodMode) then
    triggerServerEvent ("buyGodMode", getLocalPlayer())
  elseif (source == Repair) then
    triggerServerEvent ("buyRepair", getLocalPlayer())
  elseif (source == Haystack) then
    triggerServerEvent ("buyHay", getLocalPlayer())
  elseif (source == Invisible) then
    triggerServerEvent ("buyInvisible", getLocalPlayer())
  elseif (source == Barrel) then
    triggerServerEvent ("buyBarrel", getLocalPlayer())
  elseif (source == Hunter) then
    triggerServerEvent ("buyHunter", getLocalPlayer())
  elseif (source == Hydra) then
    triggerServerEvent ("buyHydra", getLocalPlayer())
  elseif (source == GodOfWar) then
    triggerServerEvent ("buyGodOfWar", getLocalPlayer())
  elseif (source == TimeOfIce) then
    triggerServerEvent ("buyTimeOfIce", getLocalPlayer())
  elseif (source == setNameColor) then
    red = guiGetText ( redEdit )
    green = guiGetText ( greenEdit )
    blue = guiGetText ( blueEdit )
    triggerServerEvent ("setPlayerNameTagColor", getLocalPlayer(), red, green, blue)
    guiSetVisible (nameWin, false)
  elseif (source == setSkinButton) then
    skin = guiGetText ( skinEdit )
    triggerServerEvent ("skin", getLocalPlayer(), skin)
    guiSetVisible (skinWin, false)
  elseif (source == sendMoneyButton) then
    playerNick = guiGetText ( playerNameEdit )
    amount = guiGetText ( amountEdit )
    triggerServerEvent ("sendMoney", getLocalPlayer(), playerNick, amount)
  end
end
addEventHandler ("onClientGUIClick", getRootElement(), onGuiClick)
 
function tagColorAndSkin (button, state, absoluteX, absoluteY)
  if (source == tagColorButton) then
  guiSetVisible(nameWin,true)
  elseif (source == skinChangerButton) then
  guiSetVisible(skinWin,true)
  end
end
addEventHandler ("onClientGUIClick", getRootElement(), tagColorAndSkin)
 
nameWin = guiCreateWindow(2,256,254,147,"NAME TAG COLOR",false)
guiSetVisible(nameWin,false)
guiWindowSetSizable(nameWin,false)
redEdit = guiCreateEdit(9,55,65,32,"",false,nameWin)
guiEditSetMaxLength(redEdit,3)
greenEdit = guiCreateEdit(92,55,65,32,"",false,nameWin)
guiEditSetMaxLength(greenEdit,3)
blueEdit = guiCreateEdit(174,55,65,32,"",false,nameWin)
guiEditSetMaxLength(blueEdit,3)
redGreenBlue = guiCreateLabel(16,26,213,21," RED                GREEN            BLUE",false,nameWin)
guiLabelSetColor(redGreenBlue,255,12,15)
guiLabelSetVerticalAlign(redGreenBlue,"top")
guiLabelSetHorizontalAlign(redGreenBlue,"left",false)
setNameColor = guiCreateButton(75,106,102,27,"Change",false,nameWin)
 
skinWin = guiCreateWindow(262,258,166,144,"SKIN CHANGER",false)
guiSetVisible(skinWin,false)
guiWindowSetSizable(skinWin,false)
skinEdit = guiCreateEdit(39,57,87,32,"",false,skinWin)
guiEditSetMaxLength(skinEdit,3)
skinLabel = guiCreateLabel(43,31,79,30,"SKIN ID HERE",false,skinWin)
guiLabelSetColor(skinLabel,255,255,255)
guiLabelSetVerticalAlign(skinLabel,"top")
guiLabelSetHorizontalAlign(skinLabel,"left",false)
setSkinButton = guiCreateButton(39,102,87,29,"Change",false,skinWin)
 
infoWin = guiCreateWindow(2,258,429,95,"Item Info window",false)
guiSetVisible(infoWin,false)
guiWindowSetSizable(infoWin,false)
infoLabel = guiCreateLabel(14,31,400,23,"",false,infoWin)
guiLabelSetColor(infoLabel,255,255,255)
guiLabelSetVerticalAlign(infoLabel,"top")
guiLabelSetHorizontalAlign(infoLabel,"left",false)
infoCloseButton = guiCreateButton(138,66,117,20,"close",false,infoWin)
 
function closeInfo ( )
        if ( guiGetVisible ( infoWin ) == true ) then          
                guiSetVisible ( infoWin, false )
        end
end
addEventHandler ("onClientGUIClick", infoCloseButton, closeInfo)
 
function infoStuff (button, state, absoluteX, absoluteY)
  if (source == info1) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"TimeOfIce will freeze all player cars for 1 minute. cost $ 2 mil.")
  elseif (source == info2) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"GodOfWar will blow all player cars. cost $ 3 mil.")  
  elseif (source == info3) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"You get a hydra with the cost of $ 1.5 mil.")    
  elseif (source == info4) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"You get a hunter with the cost of $ 1 mil.")    
  elseif (source == info5) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"A barrel will be created in your position to blow players car. cost $ 12000.")    
  elseif (source == info6) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"Your car will get repaired. cost $ 5000.")      
  elseif (source == info7) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"Your car will be fliped. cost $ 10000.")        
  elseif (source == info8) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"Your car will be upgraded with nitro. cost $ 7000.")          
  elseif (source == info9) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"Your car will get bullet proof. cost $ 70000.")            
  elseif (source == info10) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"A hay stack will be created in your position. cost $ 10000.")              
  elseif (source == info11) then
  guiSetVisible(infoWin,true)
  guiSetText(infoLabel,"You and your car will be invisible for a time. cost $ 20000.")                
  end
end
addEventHandler ("onClientGUIClick", getRootElement(), infoStuff)
 
function ligh(state)
        local clientPlayer = getLocalPlayer()
        if isPedInVehicle(clientPlayer) == true then
            local playerVehicle = getPedOccupiedVehicle ( clientPlayer)
            if ( getVehicleOverrideLights ( playerVehicle ) ~= 2 ) then
                setVehicleOverrideLights ( playerVehicle, 2 )
                guiSetText(lightStatus,"(l) Lights OFF")
            else
                setVehicleOverrideLights ( playerVehicle, 1 )
                guiSetText(lightStatus,"(l) Lights ON")            
            end
        else
            outputChatBox("You are not in a vehicle",255,0,0,true)
        end    
    end
addEventHandler("onClientGUIClick",lightStatus,ligh,false)
 
function lightColor()
    if source == redBar or source == greenBar or source == blueBar then
        local car = getPedOccupiedVehicle(getLocalPlayer())
        triggerServerEvent("changeLightsColor",getLocalPlayer(),car,(guiScrollBarGetScrollPosition(redBar)*2.55),(guiScrollBarGetScrollPosition(greenBar)*2.55),(guiScrollBarGetScrollPosition(blueBar)*2.55))
    end
end
addEventHandler("onClientGUIScroll",getRootElement(),lightColor)
 
function carColor()
    if source == carRedBar or source == carGreenBar or source == carBlueBar or source == carBlueBar2 then triggerServerEvent("changeCarColor",getLocalPlayer(),(guiScrollBarGetScrollPosition(carRedBar)*2.55),(guiScrollBarGetScrollPosition(carGreenBar)*2.55),(guiScrollBarGetScrollPosition(carBlueBar)*2.55),(guiScrollBarGetScrollPosition(carBlueBar2)*2.55))
    end
end
addEventHandler("onClientGUIScroll",getRootElement(),carColor)
 
function populateGridlist()
    local rootnode = xmlLoadFile("skins.xml")
    if rootnode then       
        for _,group in ipairs(xmlNodeGetChildren(rootnode)) do
            local row = guiGridListAddRow(skinsGrid)
            local name = xmlNodeGetAttribute(group,"type")
            guiGridListSetItemText(skinsGrid,row,1,name,true,false)        
            for _,skin in ipairs(xmlNodeGetChildren(group)) do
            row = guiGridListAddRow(skinsGrid)
            name = xmlNodeGetAttribute(skin,"name")
            local id = xmlNodeGetAttribute(skin,"model")
            guiGridListSetItemText(skinsGrid,row,1,name,false,false)
            guiGridListSetItemData(skinsGrid,row,1,tostring(id))
            end
        end 
        xmlUnloadFile(rootnode)
    end
end
 
function createSkinHandler(button,state)
    if button == "left" and state == "up" then
        local row,col = guiGridListGetSelectedItem(skinsGrid)
        if row and col and row ~= -1 and col ~= -1 then
            local selected = guiGridListGetItemData(skinsGrid,row,col)
            skinid = tonumber(selected)
                triggerServerEvent("setSkinFromGUI",getLocalPlayer(),skinid)
                outputChatBox ( "Skin cambiado a: ".. tostring ( skinid ) .. ".", 0,255,0 )
            else
                outputChatBox("Argumentos invalidos.",255,12,15)
        end
    end
end
 
addEventHandler("onClientResourceStart", getResourceRootElement( getThisResource() ),
function()
        addEventHandler("onClientPlayerJoin", getRootElement(), updateplayersList)
        addEventHandler("onClientPlayerQuit", getRootElement(), updateplayersList)
        addEventHandler("onClientPlayerChangeNick", getRootElement(), updateplayersList)
        addEventHandler("onClientGUIClick", Refresh, REFRESHLIST)
        addEventHandler("onClientGUIClick",ChangeChatColor,chatColor,false)
        addEventHandler("onClientGUIClick",changeSkin,createSkinHandler,false)     
        populateGridlist()
    end
)[/wiki]
Race [10%]
LoginPanel [0%]
Hunter Area [100%]
Spectators [100%]
Level System [100%]
Info Map [100%]
Clan-Info [0%]
6RB|AccenT
Civilian
 
Posts: 24
Joined: Fri May 04, 2012 7:37 am
Gang: Go For Fight =G4F

Re: Help me User Panel

Postby 6RB|AccenT on Fri May 04, 2012 3:51 pm

help me
Race [10%]
LoginPanel [0%]
Hunter Area [100%]
Spectators [100%]
Level System [100%]
Info Map [100%]
Clan-Info [0%]
6RB|AccenT
Civilian
 
Posts: 24
Joined: Fri May 04, 2012 7:37 am
Gang: Go For Fight =G4F

Re: Help me User Panel

Postby TwiX! on Fri May 04, 2012 8:12 pm

MiX# wrote:help me

you can't edit my very old stolen panel (panel_client.lua)
because its complited,
you edit it by part from puma user panel, so ask him
Image

- Working on [PHP/HTML/Mysql/Lua/Java Scripts/Web Design/3D Modeling]
User avatar
TwiX!
Hoodsta
 
Posts: 911
Joined: Sun Sep 11, 2011 12:53 pm
Location: Russia
Gang: Chuck Norris


Return to Scripting

Who is online

Users browsing this forum: No registered users and 12 guests