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

Wysłany: 2013-05-01, 19:45


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Bugi:
Gdy naciskam przycisk "Policja", podpalaja sie auta.
nie pobiera getAccountName po stronie servera.
Nie daje broni
nie przenosi do innego teamu

SERVER :

poli = createTeam ( "Policja", 0, 0, 205 )
mech = createTeam ( "Mechanicy", 165, 42, 42 )
lekarze = createTeam ( "Lekarze", 127, 255, 212 )
urzad = createTeam ( "Urz?d Miasta", 236, 171, 83 )
taxi = createTeam ( "Taks?wkarze", 255, 255, 0 )


function policja ( thePlayer )
    local accName = getAccountName ( getPlayerAccount ( source ) )
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then 
    setElementModel ( source, 280 )
    giveWeapon ( source, 21, 100 )
    setPedArmor ( source, 100 )
    setElementHealth ( source, 100 )
    setPlayerTeam ( source, poli )
    else
    outputChatBox ( "Nie nale?ysz do Policjant?w ", source, 0, 0, 205 )
    end
    end
    addEvent("policja", true)
    addEventHandler("policja", getRootElement(), policja)


CLIENT:


GUIEditor = {
    button = {},
    window = {}
}
        GUIEditor.window[1] = guiCreateWindow(542, 242, 463, 448, "Panel Pracy", false)
        guiWindowSetMovable(GUIEditor.window[1], false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetVisible(GUIEditor.window[1], false)
        policja1 = guiCreateButton(54, 171, 165, 53, "Policja", false, GUIEditor.window[1])
        mechanicy = guiCreateButton(245, 171, 165, 53, "Mechanicy", false, GUIEditor.window[1])
        urzad= guiCreateButton(54, 249, 165, 53, "Urz?d Miasta", false, GUIEditor.window[1])
        lekarze = guiCreateButton(245, 249, 165, 53, "Lekarze", false, GUIEditor.window[1])
        taksowkarze = guiCreateButton(144, 332, 165, 53, "Taks?wkarze", false, GUIEditor.window[1])


    function drawtext()
        dxDrawText("Zaloguj si? do swojej frakcji", 611, 293, 884, 364, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Mo?esz zalogowa? si? tylko do tej frakcji,\ndo kt?rej jeste? przypisany", 637, 359, 908, 382, tocolor(255, 255, 255, 255), 0.50, "bankgothic", "center", "top", false, false, true, false, false)
    end

    
function gui() 
if (guiGetVisible (GUIEditor.window[1]) == false) then 
guiSetVisible(GUIEditor.window[1], true) 
showCursor(true) 
addEventHandler("onClientRender", getRootElement(), drawtext)
else 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
removeEventHandler("onClientRender", getRootElement(), drawtext)
end 
end 
bindKey ("F3", "down", gui) 


function policja ()
outputChatBox ( "Trwa infentyfikacja postaci...", thePlayer, 0, 0, 205 )
triggerServerEvent("policja", getRootElement(), player)
end
addEventHandler ( "onClientGUIClick", policja1, policja )


Prosze o poprawe kodu i powiedzenie co bylo zle. Dzieki

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-01, 20:04


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Serwer:
poli = createTeam ( "Policja", 0, 0, 205 )
mech = createTeam ( "Mechanicy", 165, 42, 42 )
lekarze = createTeam ( "Lekarze", 127, 255, 212 )
urzad = createTeam ( "Urz?d Miasta", 236, 171, 83 )
taxi = createTeam ( "Taks?wkarze", 255, 255, 0 )


function policja ( player )
    local accName = getAccountName ( getPlayerAccount ( player ) )
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then 
    setElementModel ( player, 280 )
    giveWeapon ( player, 21, 100 )
    setPedArmor ( player, 100 )
    setElementHealth ( player, 100 )
    setPlayerTeam ( player, poli )
    else
    outputChatBox ( "Nie nale?ysz do Policjant?w ", player, 0, 0, 205 )
    end
end
    addEvent("policja", true)
    addEventHandler("policja", getRootElement(), policja)


Klient:
local player = getLocalPlayer()

GUIEditor = {
    window = {}
}
        GUIEditor.window[1] = guiCreateWindow(542, 242, 463, 448, "Panel Pracy", false)
        guiWindowSetMovable(GUIEditor.window[1], false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetVisible(GUIEditor.window[1], false)
        policja1 = guiCreateButton(54, 171, 165, 53, "Policja", false, GUIEditor.window[1])
        mechanicy = guiCreateButton(245, 171, 165, 53, "Mechanicy", false, GUIEditor.window[1])
        urzad= guiCreateButton(54, 249, 165, 53, "Urz?d Miasta", false, GUIEditor.window[1])
        lekarze = guiCreateButton(245, 249, 165, 53, "Lekarze", false, GUIEditor.window[1])
        taksowkarze = guiCreateButton(144, 332, 165, 53, "Taks?wkarze", false, GUIEditor.window[1])


function drawtext()
        dxDrawText("Zaloguj si? do swojej frakcji", 611, 293, 884, 364, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Mo?esz zalogowa? si? tylko do tej frakcji,\ndo kt?rej jeste? przypisany", 637, 359, 908, 382, tocolor(255, 255, 255, 255), 0.50, "bankgothic", "center", "top", false, false, true, false, false)
end

    
function gui() 
if (guiGetVisible (GUIEditor.window[1]) == false) then 
guiSetVisible(GUIEditor.window[1], true) 
showCursor(true) 
addEventHandler("onClientRender", getRootElement(), drawtext)
else 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
removeEventHandler("onClientRender", getRootElement(), drawtext)
end 
end 
bindKey ("F3", "down", gui) 


function policja ()
if (source == policja1) then
outputChatBox ( "Trwa infentyfikacja postaci...", player, 0, 0, 205 )
triggerServerEvent("policja", getRootElement(), player)
end
end
addEventHandler ( "onClientGUIClick", policja1, policja )



B??d z broni? jest taki ?e jest z?e id wpisane
masz tu tabele z id broni : https://wiki.multitheftauto.com/wiki/Weapons

doda?em local player kt?rym jest getLocalPlayer()
kt?ry zwraca warto?? gracza i przenios?em go na stron? serwer i go tam go u?y?em

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-01, 20:16


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Czy moge zrobic tak uzywajac setTimer, ze pierw pokaze sie napis ze strony clienta Trwa Identyfikacja.. a po 3 sek napis ze strony serwera ze zostalem zalogowany do policji?

SERVER:

poli = createTeam ( "Policja", 0, 0, 205 )
mech = createTeam ( "Mechanicy", 165, 42, 42 )
lekarze = createTeam ( "Lekarze", 127, 255, 212 )
urzad = createTeam ( "Urz?d Miasta", 236, 171, 83 )
taxi = createTeam ( "Taks?wkarze", 255, 255, 0 )


function policja ( player )
    local accName = getAccountName ( getPlayerAccount ( player ) )
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then 
    setElementModel ( player, 280 )
    giveWeapon ( player, 24, 100 )
    setPedArmor ( player, 100 )
    setElementHealth ( player, 100 )
    setPlayerTeam ( player, poli )
    outputChatBox ( "Konto zgodne. Zosta?e? zalogowany jako Policjant", player )
    else
    outputChatBox ( "Nie nale?ysz do Policjant?w ", player, 0, 0, 205 )
    end
end
    addEvent("policja", true)
    addEventHandler("policja", getRootElement(), policja)


CLIENT:

local player = getLocalPlayer()

GUIEditor = {
    window = {}
}
        GUIEditor.window[1] = guiCreateWindow(542, 242, 463, 448, "Panel Pracy", false)
        guiWindowSetMovable(GUIEditor.window[1], false)
        guiWindowSetSizable(GUIEditor.window[1], false)
        guiSetVisible(GUIEditor.window[1], false)
        policja1 = guiCreateButton(54, 171, 165, 53, "Policja", false, GUIEditor.window[1])
        mechanicy = guiCreateButton(245, 171, 165, 53, "Mechanicy", false, GUIEditor.window[1])
        urzad= guiCreateButton(54, 249, 165, 53, "Urz?d Miasta", false, GUIEditor.window[1])
        lekarze = guiCreateButton(245, 249, 165, 53, "Lekarze", false, GUIEditor.window[1])
        taksowkarze = guiCreateButton(144, 332, 165, 53, "Taks?wkarze", false, GUIEditor.window[1])


function drawtext()
        dxDrawText("Zaloguj si? do swojej frakcji", 612, 294, 885, 365, tocolor(0, 0, 0, 255), 0.70, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Zaloguj si? do swojej frakcji", 612, 292, 885, 363, tocolor(0, 0, 0, 255), 0.70, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Zaloguj si? do swojej frakcji", 610, 294, 883, 365, tocolor(0, 0, 0, 255), 0.70, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Zaloguj si? do swojej frakcji", 610, 292, 883, 363, tocolor(0, 0, 0, 255), 0.70, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Zaloguj si? do swojej frakcji", 611, 293, 884, 364, tocolor(255, 255, 255, 255), 0.70, "bankgothic", "left", "top", false, false, true, false, false)
        dxDrawText("Mo?esz zalogowa? si? tylko do tej frakcji,\ndo kt?rej jeste? przypisany", 637, 359, 908, 382, tocolor(255, 255, 255, 255), 0.50, "bankgothic", "center", "top", false, false, true, false, false)
end

    
function gui() 
if (guiGetVisible (GUIEditor.window[1]) == false) then 
guiSetVisible(GUIEditor.window[1], true) 
showCursor(true) 
addEventHandler("onClientRender", getRootElement(), drawtext)
else 
guiSetVisible(GUIEditor.window[1], false) 
showCursor(false) 
removeEventHandler("onClientRender", getRootElement(), drawtext)
end 
end 
bindKey ("F3", "down", gui) 


function policja ()
if (source == policja1) then
outputChatBox ( "Trwa infentyfikacja postaci...", player, 0, 0, 205 )
triggerServerEvent("policja", getRootElement(), player)
end
end
addEventHandler ( "onClientGUIClick", policja1, policja )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-01, 22:05


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Ciastkooo, tak

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-01, 22:07


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Jak to ma wygladac, bo ja probowalem w ten spsobo

setTimer ( funkcja, 3000, 1 )

i nie opoznialo.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-01, 22:09


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

Ciastkooo,Serwer

poli = createTeam ( "Policja", 0, 0, 205 )
mech = createTeam ( "Mechanicy", 165, 42, 42 )
lekarze = createTeam ( "Lekarze", 127, 255, 212 )
urzad = createTeam ( "Urz?d Miasta", 236, 171, 83 )
taxi = createTeam ( "Taks?wkarze", 255, 255, 0 )


function policja ( player )
    local accName = getAccountName ( getPlayerAccount ( player ) )
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then 
    setElementModel ( player, 280 )
    giveWeapon ( player, 24, 100 )
    setPedArmor ( player, 100 )
    setElementHealth ( player, 100 )
    setPlayerTeam ( player, poli )
    outputChatBox ( "Konto zgodne. Zosta?e? zalogowany jako Policjant", player )
    else
    outputChatBox ( "Nie nale?ysz do Policjant?w ", player, 0, 0, 205 )
    end
end
    addEvent("policja", true)
    addEventHandler("policja", getRootElement(), policja)
    setTimer ( policja, 3000, 1 )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-01, 22:14


Ciastkooo







Wiek: 42
Na forum: 4945 dni
Posty: 78
Nick w MP: Ciastko

Piwa: 24

Respekt: 50

Ostrzeżeń: 100%
Wciaz nie opoznia.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-01, 22:17


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

function policja ( player )
    local accName = getAccountName ( getPlayerAccount ( player ) )
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then 
    setTimer ( function()
    setElementModel ( player, 280 )
    giveWeapon ( player, 24, 100 )
    setPedArmor ( player, 100 )
    setElementHealth ( player, 100 )
    setPlayerTeam ( player, poli )
    outputChatBox ( "Konto zgodne. Zosta?e? zalogowany jako Policjant", player )
    else
    outputChatBox ( "Nie nale?ysz do Policjant?w ", player, 0, 0, 205 )
    end, 5000, 1 )
    end
end
    addEvent("policja", true)
    addEventHandler("policja", getRootElement(), policja)
Czekam na piwko :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2013-05-02, 08:43


Pantera







Wiek: 28
Na forum: 5355 dni
Posty: 52
Nick w MP: Michu

Piwa: 8

Respekt: 70

kolego luki123luki123 nie wiem czemu ale pomieszales kolejnosc w kodzie czemu setTime rozpoczynasz za if'em a konczysz za end'em konczocym tego if'a?
Poprawnie kod wyglada tak:
Kod:


function policja ( player )
setTimer ( function()
local accName = getAccountName ( getPlayerAccount ( player ) )
if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policja" ) ) then
setElementModel ( player, 280 )
giveWeapon ( player, 24, 100 )
setPedArmor ( player, 100 )
setElementHealth ( player, 100 )
setPlayerTeam ( player, poli )
outputChatBox ( "Konto zgodne. Zosta?e? zalogowany jako Policjant", player )
else
outputChatBox ( "Nie nale?ysz do Policjant?w ", player, 0, 0, 205 )
end
end, 5000, 1 )
end
addEvent("policja", true)
addEventHandler("policja", getRootElement(), policja)


Podpis
"Bo najważniejsze są oczy, które przejrzą na wskroś cały szajs."
Postaw piwo autorowi tego posta
 

 
Tagi: panel :: pracy
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Panel Pracy 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