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

Wysłany: 2015-09-12, 09:49


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
Witam. Mam problem z dawaniem skina po zalogowaniu. Ot??, jak wybior? spawn to daje mi skina CJ. Mo?e to kto? poprawi??

S-Side z logowania:

function PlayerLogin(username,password,checksave)
    if not (username == "") then
        if not (password == "") then
            local account = getAccount ( username,password )
                if ( account ~= false ) then
                    logIn(source, account, password)
                        setCameraTarget(source, source)
                    outputChatBox ("Gratulacje! Zalogowa?e? si? poprawnie!", source)
                triggerClientEvent (source,"Zacznij",getRootElement())
                toggleControl (source, "fire", false)
                toggleControl (source, "aim_weapon", false)
            end
        end
    end
end                        
addEvent("onRequestLogin",true)
addEventHandler("onRequestLogin",getRootElement(),PlayerLogin)

function registerPlayer(username,password,passwordConfirm)
    if not (username == "") then
        if not (password == "") then
                    local account = getAccount (username,password)
                    if (account == false) then
                        local accountAdded = addAccount(tostring(username),tostring(password))
                        if (accountAdded) then
                            triggerClientEvent (source, "Zaloguj", root, source)
                        else
                            triggerClientEvent( source, "Konto_jest", root, source)                        
                        end
                    else
                        triggerClientEvent ( source, "Nick_Konto", root, source)
                    end
        else
            triggerClientEvent ( source, "Brak_Haslo", root, source)
        end
    else
        triggerClientEvent (source, "nick", root, source)
        end
        end
                                               
        
addEvent("onRequestRegister",true)
addEventHandler("onRequestRegister",getRootElement(),registerPlayer)


function playerLogin( thePlayer )
end
addEventHandler("onPlayerLogin", getRootElement(), playerLogin)

function playerJoin( thePlayer )
spawnPlayer(thePlayer,0,0,0,0)
end
addEventHandler("onPlayerJoin", getRootElement(), playerLogin)

addEvent ("For_Spawn", true)
addEventHandler ("For_Spawn", root,
function ( plr )
triggerEvent ("ustawKaseitp", getRootElement (), playerlogin)
plr:spawn ( 13.96034, 1189.98108, 19.31405)
end)

addEvent ("LV_Spawn", true)
addEventHandler ("LV_Spawn", root,
function ( plr )
triggerEvent ("ustawKaseitp", getRootElement (), playerlogin)
plr:spawn ( 2419.75,2388.24,10.82 )
end
)

addEvent ("LS_Spawn", true)
addEventHandler ("LS_Spawn", root,
function ( plr )
triggerEvent ("ustawKaseitp", getRootElement (), playerlogin)
plr:spawn ( 1481.23022, -1749.44385, 15.44531 )
end
)

addEvent ("SF_Spawn", true)
addEventHandler ("SF_Spawn", root,
function ( plr )
triggerEvent ("ustawKaseitp", getRootElement (), playerlogin)
plr:spawn (  -1960.96,883.83,42.11 )
end
)


S-side z zapisu mojego:

function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin)
  if  not (isGuestAccount (getPlayerAccount (source))) then
    local accountData = getAccountData (theCurrentAccount, "funmodev2-money")
    if (accountData) then
      local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money")
      local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin")
      local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health")
      local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor")
      local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel")
      local playerWeaponID0 = getAccountData (theCurrentAccount, "funmodev2-weaponID0")
      local playerWeaponID1 = getAccountData (theCurrentAccount, "funmodev2-weaponID1")
      local playerWeaponID2 = getAccountData (theCurrentAccount, "funmodev2-weaponID2")
      local playerWeaponID3 = getAccountData (theCurrentAccount, "funmodev2-weaponID3")
      local playerWeaponID4 = getAccountData (theCurrentAccount, "funmodev2-weaponID4")
      local playerWeaponID5 = getAccountData (theCurrentAccount, "funmodev2-weaponID5")
      local playerWeaponID6 = getAccountData (theCurrentAccount, "funmodev2-weaponID6")
      local playerWeaponID7 = getAccountData (theCurrentAccount, "funmodev2-weaponID7")
      local playerWeaponID8 = getAccountData (theCurrentAccount, "funmodev2-weaponID8")
      local playerWeaponID9 = getAccountData (theCurrentAccount, "funmodev2-weaponID9")
      local playerWeaponID10 = getAccountData (theCurrentAccount, "funmodev2-weaponID10")
      local playerWeaponID11 = getAccountData (theCurrentAccount, "funmodev2-weaponID11")
      local playerWeaponID12 = getAccountData (theCurrentAccount, "funmodev2-weaponID12")
      local playerWeaponAmmo0 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo0")
      local playerWeaponAmmo1 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo1")
      local playerWeaponAmmo2 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo2")
      local playerWeaponAmmo3 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo3")
      local playerWeaponAmmo4 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo4")
      local playerWeaponAmmo5 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo5")
      local playerWeaponAmmo6 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo6")
      local playerWeaponAmmo7 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo7")
      local playerWeaponAmmo8 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo8")
      local playerWeaponAmmo9 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo9")
      local playerWeaponAmmo10 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo10")
      local playerWeaponAmmo11 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo11")
      local playerWeaponAmmo12 = getAccountData (theCurrentAccount, "funmodev2-weaponAmmo12")
      setPlayerMoney (source, playerMoney)
      setTimer (setElementHealth, 500, 1, source, playerHealth)
      setTimer (setPedArmor, 500, 1, source, playerArmor)
      setTimer (setPlayerWantedLevel, 500, 1, source, playerWanted)
      giveWeapon(source, playerWeaponID0, playerWeaponAmmo0, true)
      giveWeapon(source, playerWeaponID1, playerWeaponAmmo1, false)
      giveWeapon(source, playerWeaponID2, playerWeaponAmmo2, false)
      giveWeapon(source, playerWeaponID3, playerWeaponAmmo3, false)
      giveWeapon(source, playerWeaponID4, playerWeaponAmmo4, false)
      giveWeapon(source, playerWeaponID5, playerWeaponAmmo5, false)
      giveWeapon(source, playerWeaponID6, playerWeaponAmmo6, false)
      giveWeapon(source, playerWeaponID7, playerWeaponAmmo7, false)
      giveWeapon(source, playerWeaponID8, playerWeaponAmmo8, false)
      giveWeapon(source, playerWeaponID9, playerWeaponAmmo9, false)
      giveWeapon(source, playerWeaponID10, playerWeaponAmmo10, false)
      giveWeapon(source, playerWeaponID11, playerWeaponAmmo11, false)
      giveWeapon(source, playerWeaponID12, playerWeaponAmmo12, false)
    else
      setPlayerMoney (source, 0)
      setPlayerNametagColor (source, 255, 255, 255) 
    end   
  end
end
addEventHandler ("ustawianieKasyitp", getRootElement(), playerLogin)
addEvent ("ustawKaseitp", true)


function onQuit (quitType, reason, responsibleElement)
  if not (isGuestAccount (getPlayerAccount (source))) then
    account = getPlayerAccount (source)
    if (account) then
      setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source)))
      setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source)))
      setAccountData (account, "funmodev2-health", tostring (getElementHealth (source)))
      setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source)))
      setAccountData (account, "funmodev2-wantedlevel", getPlayerWantedLevel (source))
      setAccountData (account, "funmodev2-weaponID0", getPedWeapon (source, 0))
      setAccountData (account, "funmodev2-weaponID1", getPedWeapon (source, 1))
      setAccountData (account, "funmodev2-weaponID2", getPedWeapon (source, 2))
      setAccountData (account, "funmodev2-weaponID3", getPedWeapon (source, 3))
      setAccountData (account, "funmodev2-weaponID4", getPedWeapon (source, 4))
      setAccountData (account, "funmodev2-weaponID5", getPedWeapon (source, 5))
      setAccountData (account, "funmodev2-weaponID6", getPedWeapon (source, 6))
      setAccountData (account, "funmodev2-weaponID7", getPedWeapon (source, 7))
      setAccountData (account, "funmodev2-weaponID8", getPedWeapon (source, 8))
      setAccountData (account, "funmodev2-weaponID9", getPedWeapon (source, 9))
      setAccountData (account, "funmodev2-weaponID10", getPedWeapon (source, 10))
      setAccountData (account, "funmodev2-weaponID11", getPedWeapon (source, 11))
      setAccountData (account, "funmodev2-weaponID12", getPedWeapon (source, 12))
      setAccountData (account, "funmodev2-weaponAmmo0", getPedTotalAmmo (source, 0))
      setAccountData (account, "funmodev2-weaponAmmo1", getPedTotalAmmo (source, 1))
      setAccountData (account, "funmodev2-weaponAmmo2", getPedTotalAmmo (source, 2))
      setAccountData (account, "funmodev2-weaponAmmo3", getPedTotalAmmo (source, 3))
      setAccountData (account, "funmodev2-weaponAmmo4", getPedTotalAmmo (source, 4))
      setAccountData (account, "funmodev2-weaponAmmo5", getPedTotalAmmo (source, 5))
      setAccountData (account, "funmodev2-weaponAmmo6", getPedTotalAmmo (source, 6))
      setAccountData (account, "funmodev2-weaponAmmo7", getPedTotalAmmo (source, 7))
      setAccountData (account, "funmodev2-weaponAmmo8", getPedTotalAmmo (source, 8))
      setAccountData (account, "funmodev2-weaponAmmo9", getPedTotalAmmo (source, 9))
      setAccountData (account, "funmodev2-weaponAmmo10", getPedTotalAmmo (source, 10))
      setAccountData (account, "funmodev2-weaponAmmo11", getPedTotalAmmo (source, 11))
      setAccountData (account, "funmodev2-weaponAmmo12", getPedTotalAmmo (source, 12))
    end
  end
end
addEventHandler ("onPlayerQuit", getRootElement(), onQuit)

function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth)
  if not( isGuestAccount (getPlayerAccount(source)) ) then
    local theWeapon = getPedWeapon (source)
    local weaponAmmo = getPedTotalAmmo (source)
    fadeCamera (source, false)
    setTimer (spawnPlayer, 1000, 1, source, -2462.50,132.90,35.17, 0, getPedSkin (source), 0, 0, getPlayerTeam(source))
    setTimer (setCameraTarget, 1250, 1, source, source)
    setTimer (fadeCamera, 2000, 1, source, true)
  end
end

addEventHandler ("onPlayerWasted", getRootElement(), onWasted)
addEventHandler( "onPlayerWasted", getRootElement( ),
    function()
        setTimer( spawnPlayer, 2000, 1, source, -2462.50,132.90,35.17, 0, getPedSkin (source), 0, 0, getPlayerTeam(source))
    end
)


Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-12, 10:09


#404







Wiek: 27
Na forum: 4912 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Do spawnPlayer musisz doda? getAccountData, na konto tego gracza, z warto?ci? na skin.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-12, 12:18


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"DestroY" napisał/a:

Do spawnPlayer musisz doda? getAccountData, na konto tego gracza, z warto?ci? na skin.


Da?em, i dalej CJ jest ;(

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-12, 16:02


#404







Wiek: 27
Na forum: 4912 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
Masz bl?dy w tym zapisie, zapisuje na niewiadomo jakie konto. Zamien to sobe i powinno by?


function playerLogin (theCurrentAccount)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-12, 16:21


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"DestroY" napisał/a:

Masz bl?dy w tym zapisie, zapisuje na niewiadomo jakie konto. Zamien to sobe i powinno by?


function playerLogin (theCurrentAccount)


A poprawisz? Bo dalej nie wiem jak to zrobi? :-?

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-12, 17:30


#404







Wiek: 27
Na forum: 4912 dni
Posty: 1438

Piwa: 2512

Respekt: 833,5
Respekt: 833,5Respekt: 833,5

Ostrzeżeń: 60%
jg2aviva1, no przecie? Ci poda?em co ma by?...

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-12, 18:08


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"DestroY" napisał/a:

jg2aviva1, no przecie? Ci poda?em co ma by?...


No ale na co mam zamienic?

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-12, 19:37


luki123luki123

Place Game






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

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

jg2aviva1, nie jest to pro?ciej ?
function skin ()
setElementModel( source, idskina )

end
addEventHandler("onPlayerLogin", root, skin )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-12, 21:37


jg2aviva1

Rusek :D






Wiek: 25
Na forum: 4275 dni
Posty: 446
Nick w MP: _Wolfenstei[N]^.^

Piwa: 1034

Respekt: 240
Respekt: 240Respekt: 240

Ostrzeżeń: 60%
"luki123luki123" napisał/a:

jg2aviva1, nie jest to pro?ciej ?
function skin ()
setElementModel( source, idskina )

end
addEventHandler("onPlayerLogin", root, skin )


Nie jest pro?ciej bo:

1. Skina daje po zalogowaniu ale nie daje po zrespieniu
2. Musze to jako? striggerowa? albo "w?o?y?" tam funkcj? daj?c? skina po zrespieniu.


Wi?c dalej nie wiem jak to zrobi? :x

Podpis



GTAO Member: 2015-08-23, 14:26

Postaw piwo autorowi tego posta
 

 
Tagi: dawanie :: skina :: zalogowaniu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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