Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2012-09-29, 07:18


karlik131







Wiek: 43
Na forum: 5015 dni
Posty: 11

Piwa: 87

Respekt: 50

Witam mam problem z dodaniem wymagania score na kupno.
Czyli np.
Za na n?? trzeba 10score
ammo_c
GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Grid = {}

GUIEditor_Window[1] = guiCreateWindow(405,58,456,685,"Panel Ammo",false)
local GridList1 guiCreateGridList(16,22,228,653,false,GUIEditor_Window[1])
guiGridListSetSelectionMode(GridList1,2)
local GridList2 guiCreateGridList(248,25,199,510,false,GUIEditor_Window[1])
guiGridListSetSelectionMode(GridList2,2)
Button2 guiCreateButton(250,625,197,51,"Wyjdz",false,GUIEditor_Window[1])
Button1 guiCreateButton(251,545,196,49,"Daj bron",false,GUIEditor_Window[1])
guiSetVisible(GUIEditor_Window[1], false)
showCursor(false)


local team getTeamFromName("Ammonation")
weapons ={
"Kastet"
}


function show()

    if getPlayerTeam(getLocalPlayer()) == team then
    local column guiGridListAddColumnGridList1"Player"0.99 )
    local column1 guiGridListAddColumnGridList2"Bron"0.99 )
    local column2 guiGridListAddColumnGridList3"Kasa"0.50)
            if ( column then 
                          for idplayeritem in ipairs(getElementsByType("player")) do 
                               local row guiGridListAddRow GridList1 )
                            guiGridListSetItemText GridList1rowcolumngetPlayerName playeritem ), falsefalse )
                    end
            for key,weaponName in pairs(weapons) do
                           local row1 guiGridListAddRow GridList2 ) 
                        guiGridListSetItemText GridList2row11weaponNamefalsefalse )
                  end
        end
        guiSetVisible(GUIEditor_Window[1], true)
        showCursor(true)
        
end
end
addCommandHandler("o"show)

function close()
    guiSetVisible(GUIEditor_Window[1], false)
    showCursor(false)
    setTimer guiGridListClear501GridList2 ) 
    


end
addEventHandler"onClientGUIClick"Button2close )

function daj()
    local player guiGridListGetItemText (GridList1guiGridListGetSelectedItem (GridList1), 1) 
    local co guiGridListGetItemText (GridList2guiGridListGetSelectedItem (GridList2), 1)      
    triggerServerEvent("daj"getRootElement(), playercogetLocalPlayer())
end
addEventHandler"onClientGUIClick"Button1daj )
addCommandHandler("ammop"show)

ammo_s
addEvent("daj"trueaddEventHandler("daj"getRootElement(), function(playercopotemlocal komu getPlayerFromName player )
    if co == "Kastet" then 
        giveWeapon komu1200 )
        setPlayerMoney(komugetPlayerMoney(komu) - 500)
        setPlayerMoney(potemgetPlayerMoney(potem) + 500)
    end

end

skrypt na score
addEventHandler('onResourceStart',getResourceRootElement(),
function()
    call(getResourceFromName("scoreboard"), "addScoreboardColumn""Pkt")
    --call(getResourceFromName("scoreboard"), "addScoreboardColumn""Kasa")
    for theKey,thePlayer in ipairs(getElementsByType "player" )) do
        setElementData(thePlayer,"Pkt",0)
    --setElementData(thePlayer,"Kasa",0)
    end
end)

addEventHandler('onPlayerJoin',getRootElement(),
function()

    setElementData(source,"Pkt",0)
    --setElementData(source,"Kasa",0)
end)

function addScore(points)
    setElementData(source"points"getElementData(source"points") + points)
    --setElementData(source"money"getElementData(source"money") + kasa)
end

addEvent("addScore"true)
addEventHandler("addScore"getRootElement(), addScore)
---------dawanie score

addCommandHandler "admin.score",
function ( playercmdnickkwota )
    if nick and kwota then
        local aplayer getPlayerFromName nick )
        if aplayer then
            kwota tonumber(kwota)
           
                setElementData(aplayer,"Pkt",kwota)
                --givePlayerMoney aplayerkwota )

         
end 
end
end )



Prosze o pomoc albo zrobi? to za mnie(10piw) albo jak napisa?(3piwa).

Ostatnio zmieniony przez karlik131 2012-10-06, 08:51, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-09-29, 16:14


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Do funkcji podpi?tej pod event "daj" dodaj
local score getElementData(source"score")

potem dodajesz do if'a np.
if co == "Kwiaty" and score 10 then 


Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-09-29, 20:36


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-09-30, 09:19


karlik131







Wiek: 43
Na forum: 5015 dni
Posty: 11

Piwa: 87

Respekt: 50


    if co == "Kastet" and score 10 then 
        giveWeapon komu1200 )
        setPlayerMoney(komugetPlayerMoney(komu) - 500)
        setPlayerMoney(potemgetPlayerMoney(potem) + 500)
    end


function daj()
    local player guiGridListGetItemText (GridList1guiGridListGetSelectedItem (GridList1), 1) 
    local co guiGridListGetItemText (GridList2guiGridListGetSelectedItem (GridList2), 1)      
    triggerServerEvent("daj"getRootElement(), playercogetLocalPlayer())
    local score getElementData(source"score")
end

Nie dzia?a teraz nawet broni nie daje.

Ostatnio zmieniony przez karlik131 2012-10-06, 09:20, w całości zmieniany 2 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-09-30, 10:16


Riot

3X






Wiek: 29
Na forum: 5729 dni
Posty: 1123
Nick w MP: Riot/3X

Piwa: 286

Respekt: 123
Respekt: 123

Po pierwsze, jest ?atwiejszy spos?b na dodawanie i zabieranie graczowi kasy ni? Tw?j spos?b:

takePlayerMoney
givePlayerMoney



Wpisz /debugscript 3 i zresetuj skrypt i zobacz czy co? wyskakuje. Co do oddzielnych skrypt?w to nic, i tak b?dzie dzia?a? bo kiedy? testowa?em, tylko obydwa skrypty musz? by? w??czone.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-09-30, 12:12


karlik131







Wiek: 43
Na forum: 5015 dni
Posty: 11

Piwa: 87

Respekt: 50

Przy dawaniu broni w debugscript 3 jest :
Error:[RPG]/panelammo/...../ammo_s.lua: 4 : attempt to compare number with nil

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: ammo
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku