Wysłany: 2016-11-11, 19:26
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
Witam, zrobi?em sobie HUD na serwer wszystko dzia?a, gites tylko jeszcze go podpiac jakos pod mysql, pomoze ktos ?
Wysłany: 2016-11-11, 19:41
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
macieq. , Co??? Jak HUD pod Mysql?? wtf? Mysql to baza danych a hud to tekst lub inne rzeczy wy?wietlane graczowi wiec jak ty chcesz te dwie rzeczy po??czy??
Wysłany: 2016-11-11, 19:49
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
Chodzi mi o pieniadze, i jego zapis
Wysłany: 2016-11-11, 19:59
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3810 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
Nie lepiej zrobi? to na accountdata?
Wysłany: 2016-11-11, 20:19
macieq.
Grafik
Wiek: 28 Na forum: 3513 dni Posty: 42
Nick w MP: 1Macieq
Wysłany: 2016-11-11, 21:05
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
function onPlayerQuit ( )
-- when a player leaves , store his current money amount in his account data
local playeraccount = getPlayerAccount ( source )
if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in
local playermoney = getPlayerMoney ( source ) -- get the player money
setAccountData ( playeraccount , "piraterpg.money" , playermoney ) -- save it in his account
end
end
function onPlayerLogin ( _ , playeraccount )
-- when a player logins , retrieve his money amount from his account data and set it
if ( playeraccount ) then
local playermoney = getAccountData ( playeraccount , "piraterpg.money" )
-- make sure there was actually a value saved under this key ( check if playermoney is not false ).
-- this will for example not be the case when a player plays the gametype for the first time
if ( playermoney ) then
setPlayerMoney ( source , playermoney )
end
end
end
addEventHandler ( "onPlayerQuit" , getRootElement ( ), onPlayerQuit )
addEventHandler ( "onPlayerLogin" , getRootElement ( ), onPlayerLogin )
Server Side. Zapis oraz wczytywanie pieni?dzy.
Podpis
"amited" napisał/a :
Wysłany: 2016-11-11, 22:16
Pawel5321
Szkrypter
Wiek: 36 Na forum: 3810 dni Posty: 237
Nick w MP: Pawell
Piwa : 2315
amited nie uwzgl?dni?e? resetu pieni?dzy podczas wylogowania , wi?c mog? wyst?pi? bugi.
Tu masz nieco zedytowany skrypt z community
addEventHandler ( "onPlayerLogin" , getRootElement (),
function ( prevAcc , currAcc , autoLogin )
setPlayerMoney ( source ,
( getAccountData ( currAcc , "money" ) or 0 )
)
end )
addEventHandler ( "onPlayerLogout" , getRootElement (),
function ( prevAcc , currAcc )
setAccountData ( prevAcc , "money" , getPlayerMoney ( source ))
setPlayerMoney ( source , 0 )
end )
addEventHandler ( "onPlayerQuit" , getRootElement (),
function ()
local pAcc = getPlayerAccount ( source )
if ( pAcc and not isGuestAccount ( pAcc )) then
setAccountData ( pAcc , "money" , getPlayerMoney ( source ))
end
end )
Ostatnio zmieniony przez Pawel5321 2016-11-11, 22:32, w całości zmieniany 2 razy
Wysłany: 2016-11-11, 22:29
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
Pawel5321 , Co ty gadasz? 'nie reetu pieni?dzy podczas uwzgl?dni?e? wylogowania " ?
Podpis
"amited" napisał/a :
Tagi: hud
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: