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

Wysłany: 2014-05-07, 20:49


Zgredek666

LUA






Wiek: 27
Na forum: 4722 dni
Posty: 251
Nick w MP: Zgredek

Piwa: 442

Respekt: 70,1

Witam! Mam problem ot?? nie zapisuje mi paszportu po wyj?ciu gracza z serwera. Bardzo prosz? o pomoc. Oczywi?cie daj? zimne :piwo: :)
function GivePassportplayercommandNamenick )
    local targetPlayer getPlayerFromName(tostring(nick))
    local team getTeamFromName("Urz?d")
    if getPlayerTeam(player) == team then

    if targetPlayer == false then
        outputChatBox("Gracz nie jest podloczony do serwera"player)
        return
    end

    setElementData(targetPlayer"prawoa"true)
    outputChatBox("Gracz " .. nick .. " otrzyma? Paszport"player)
    else
    outputChatBox("Nie jestes pracownikiem urz?du!"player)
    
    
    local player getPlayerAccount player)
    if player then
        if not isGuestAccount playerthen
        local nick getAccountData player"prawoa" ) or 0
            if nick then
                setElementData(targetPlayer"prawoa"tonumber(nick))
            end
        end
    end
end
 local player getPlayerAccount player)
    if player then
        if not isGuestAccount playerthen
        local nick getElementData (player"prawoa" ) or 0
            if nick then
                setAccountData (player"prawoa"nick )
            end
        end
    end
    end
addEventHandler "onPlayerQuit"getRootElement(), GivePassport )
addEventHandler "onPlayerLogin"getRootElement(), GivePassport)
function CheckPassportplayercommandNamenick )
    local targetPlayer getPlayerFromName(tostring(nick))
    local team getTeamFromName("Stra? Graniczna")
    if getPlayerTeam(player) == team then
    
    if targetPlayer == false then
        outputChatBox("Gracz nie jest podlonczony do serwera"player)
        return
    end

    if getElementData(targetPlayer"prawoa"then
        outputChatBox("Gracz posiada Paszport"player)
    else
        outputChatBox("Gracz nie posiada Paszportu"player)
    end
    else
    outputChatBox("Nie jestes funkcjonariuszem SG!"player)
    end
end

function TakePassportplayercommandNamenick )
    local targetPlayer getPlayerFromName(tostring(nick))
    local team getTeamFromName("Stra? Graniczna")
    if getPlayerTeam(player) == team then

    if targetPlayer == false then
        outputChatBox("Gracz nie jest podloczony do serwera"player)
        return
    end

    setElementData(targetPlayer"prawoa"false)
    outputChatBox("Gracz " .. nick .. " zosta? pozbawiony paszportu"player)
    else
    outputChatBox("Nie jestes funkcjonariuszem SG!"player)
    end
end

addCommandHandler("dajpaszport"GivePassport)
addCommandHandler("zobaczpaszport"CheckPassport)
addCommandHandler("zabierzpaszport"TakePassport)


Podpis
Piszę skrypty lua na serwery Truck/RPG/Race/DayZ. Kontakt pw!

Pomogłem? Wystarczy jak postawisz :piwo:



Zapraszam na mój kanał na yt:
https://www.youtube.com/c...vgsF65M-Xw5hEDQ
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-07, 21:21


Artysta

Lua, Lua, Czekolada






Wiek: 28
Na forum: 4466 dni
Posty: 240
Nick w MP: Artysta/Koojot

Piwa: 1427

Respekt: 205,8
Respekt: 205,8Respekt: 205,8

A nie lepiej zrobi? na setAccountData ?

Podpis
Something is coming..
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-08, 16:21


Zgredek666

LUA






Wiek: 27
Na forum: 4722 dni
Posty: 251
Nick w MP: Zgredek

Piwa: 442

Respekt: 70,1

function GivePassportplayercommandNamenickgracz )

    local targetPlayer getPlayerFromName(tostring(nick))
    local team getTeamFromName("Urz?d")
    if getPlayerTeam(player) == team then

    if targetPlayer == false then
        outputChatBox("Gracz nie jest podloczony do serwera"player)
        return
    end

    setElementData(targetPlayer"prawoa"true)
    outputChatBox("Gracz " .. nick .. " otrzyma? Paszport"player)
    else
    outputChatBox("Nie jestes pracownikiem urz?du!"player)
    
    end
    
    

    local gracz getPlayerAccount (targetPlayer)
  if ( gracz ) and not isGuestAccount gracz then -- if the player is logged in
            setAccountData gracz"prawoa"gracz ) -- save it in his account
      end
      end

 function onPlayerLogin(targetPlayergraczprawoa)
  local gracz getPlayerAccount(targetPlayer)
if ( gracz then
            local prawoa getAccountData gracz"prawoa" )
            if (prawoathen
             getAccountData(gracz"prawoa"prawoa)
            end
    end
    end

addEventHandler "onPlayerQuit"getRootElement ( ), GivePassport )
addEventHandler "onPlayerLogin"getRootElement ( ), onPlayerLogin)
Stworzy?em co? takiego ale nie dzia?a. Nie ma te? b??d?w w debugu

Podpis
Piszę skrypty lua na serwery Truck/RPG/Race/DayZ. Kontakt pw!

Pomogłem? Wystarczy jak postawisz :piwo:



Zapraszam na mój kanał na yt:
https://www.youtube.com/c...vgsF65M-Xw5hEDQ
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-08, 20:59


maciek3286

LUA Developer






Wiek: 26
Na forum: 5201 dni
Posty: 230
Nick w MP: maciek00

Piwa: 3207

Respekt: 101,5
Respekt: 101,5

niedziwie sie ze sie nie zapisuje bo niby gdzie to by sie mialo zapisac. Proponuje zrobi? to w SQL Lite lub setAccountData.

Podpis
"Ludzie będą zawsze dla ciebie źli, jeżeli konieczność nie zmusi ich do tego, by byli dobrzy" ~~ Niccolò Machiavelli
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-05-16, 13:38


Rebeka

Szefostwo






Wiek: 31
Na forum: 4451 dni
Posty: 37
Nick w MP: Projekt

Piwa: 15

Respekt: 50

tutaj daje gotowy skrypt urzad daje a policja sprawdza ;)
Kod:

function GivePassportb ( player, commandName, nick )
if ( not nick ) then return end
local targetPlayer = getPlayerFromName( nick )
local team = getTeamFromName ( "Urzad" )
if ( getPlayerTeam ( player ) == team ) then
if ( not targetPlayer ) then
outputChatBox("Gracz nie jest pod??czony do serwera", player)
return
end

setElementData ( targetPlayer, "paszport", true )
outputChatBox ( "Gracz " .. nick .. " otrzyma? paszport.", player )
else
outputChatBox("Nie jestes pracownikiem urzedu!", player)
end
end
addCommandHandler ( "wydajpaszport", GivePassportb )

function CheckPassportb ( player, commandName, nick )
if ( not nick ) then return end
local targetPlayer = getPlayerFromName ( nick )
local team = getTeamFromName ( "Policja" )
if getPlayerTeam(player) == team then
if ( not targetPlayer ) then
outputChatBox("Gracz nie jest pod??czony do serwera", player)
return
end

local paszport = getElementData ( targetPlayer, "paszport" ) and "Gracz Posiada paszport ." or "Gracz nie posiada paszportu."
outputChatBox ( paszport, player )
else
outputChatBox("Nie jestes pracownikiem Policji!", player)
end
end
addCommandHandler ( "zobaczpaszport", CheckPassportb )

addEventHandler ( "onPlayerLogin", root,
function ( _, account )
local paszport = getAccountData ( account, "paszport" ) or false
setElementData ( source, "paszport", paszport )
end
)

addEventHandler ( "onPlayerLogout", root,
function ( account )
local paszport = getElementData ( source, "paszport" ) or false
setAccountData ( account, "paszport", paszport )
end
)

addEventHandler ( "onPlayerQuit", root,
function ( )
local account = getPlayerAccount ( source )
if ( not isGuestAccount ( account ) ) then
local paszport = getElementData ( source, "paszport" ) or false
setAccountData ( account, "paszport", paszport )
end
end
)


Postaw piwo autorowi tego posta
 

 
Tagi: paszport
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