Wysłany: 2016-08-26, 14:20
AlaneqYT
Uczeń LUA
Wiek: 25 Na forum: 3885 dni Posty: 37
Piwa : 20
Witam, mam kod premium, ale jak kto? wejdzie na serwer a nie ma premium to i tak je dostaje.
Kod:
--[[
Resource : OURGame v2
Developers : Split < split . programista @ gmail . com >
You have no right to use this code without my permission .
( c ) 2015 < split . programista @ gmail . com >. All rights reserved .
]]
function loadPlayerData ( plr )
local result = exports [ "ogrpg-db" ]: dbGet ( "SELECT * FROM ogrpg_users WHERE id=?" , getElementData ( plr , "player:uid" ))
if result and #result > 0 then
local v = result [ 1 ]
setPlayerMoney ( plr , v . money )
setElementModel ( plr , v . skin )
setElementData ( plr , "status" , "Aktywny" )
setElementData ( plr , "player:logged" , true )
setElementData ( plr , "player:mandate" , v . mandate )
setElementData ( plr , "player:license:pjA" , v . pjA )
setElementData ( plr , "player:license:pjB" , v . pjB )
setElementData ( plr , "player:license:pjC" , v . pjC )
setElementData ( plr , "player:license:pjL" , v . pjL )
setElementData ( plr , "player:reputation" , v . reputation )
setElementData ( plr , "player:workinjob" , v . worker )
setElementData ( plr , "player:registerdate" , v . registered )
setElementData ( plr , "player:hours" , v . hours )
local queryA = string . format ( "SELECT * FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1" , getElementData ( plr , "player:uid" ))
local resultA = exports [ "ogrpg-db" ]: dbGet ( queryA )
if ( resultA ) then
setElementData ( plr , "player:premium" , true )
setElementData ( plr , "player:premiumdate" , v . premiumdate )
setPlayerName ( plr , "#dbb234" .. getPlayerName ( plr ))
else
setElementData ( plr , "player:premium" , false )
end
setElementData ( plr , "player:skin" , v . skin )
return true
end
return false
end
addEvent ( "load:player" , true )
addEventHandler ( "load:player" , root , function( player )
if isElement ( player ) and player then
if getElementType ( player ) ~= "player" then return end
loadPlayerData ( player )
outputDebugString ( "Zaladowano statystyki gracza :" .. getPlayerName ( player ))
end
end )
function savePlayerData ( plr )
local uid = getElementData ( plr , "player:uid" )
if not uid then return end
local money = getPlayerMoney ( plr )
local mandate = getElementData ( plr , "player:mandate" )
local licensea = getElementData ( plr , "player:license:pjA" )
local licenseb = getElementData ( plr , "player:license:pjB" )
local licensec = getElementData ( plr , "player:license:pjC" )
local licensel = getElementData ( plr , "player:license:pjL" )
local reputation = getElementData ( plr , "player:reputation" )
local worker = getElementData ( plr , "player:workinjob" )
local hours = tonumber ( getElementData ( plr , "player:hours" )) or 0
local query = exports [ "ogrpg-db" ]: dbSet ( "UPDATE ogrpg_users SET money=?, reputation=?, mandate=?, pjA=?, pjB=?, pjC=?, pjL=?, worker=?, hours=? WHERE id=?" ,
money , reputation , mandate , licensea , licenseb , licensec , licensel , worker , hours , uid )
end
addEvent ( "save:player" , true )
addEventHandler ( "save:player" , root , function( player )
if isElement ( player ) and player then
if getElementType ( player ) ~= "player" then return end
savePlayerData ( player )
outputDebugString ( "Zapisano statystyki gracza :" .. getPlayerName ( player ))
end
end )
addEventHandler ( "onPlayerQuit" , root , function() savePlayerData ( source ) end )
Wysłany: 2016-08-26, 21:52
Pumelowsky
Amator 3D
Wiek: 23 Na forum: 4182 dni Posty: 199
Nick w MP: Pumelowsky
Piwa : 1666
Usu? to i powiedz czy dzia?a
else
setElementData ( plr , "player:premium" , false )
Podpis
Kontakt:
- Skype: live:pumapl_2
- GG: 56865468
- Discord: Pumelowsky#1126
- PW forum
[/center]
Wysłany: 2016-08-26, 22:20
AlaneqYT
Uczeń LUA
Wiek: 25 Na forum: 3885 dni Posty: 37
Piwa : 20
Dalej nie dziala, prosze o szybka pomoc.
Wysłany: 2016-08-26, 22:32
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Troche g?upio to zrobi?e?.
Zr?b w tabeli oprpg_users tabel? PREMIUM a w niej 0/1. O wiele wygodniej b?dzie Ci, i kod b?dzie optymalniejszy.
Wysłany: 2016-08-26, 22:40
AlaneqYT
Uczeń LUA
Wiek: 25 Na forum: 3885 dni Posty: 37
Piwa : 20
Niestety, ja tego nie robilem.
Dalo by rade tylko to zrobic zeby gracz ktory nie mial premium nie dostawal tego premium? A kto ma ten dostaje? Prosze o pomoc z tym.
Wysłany: 2016-08-27, 08:40
Pumelowsky
Amator 3D
Wiek: 23 Na forum: 4182 dni Posty: 199
Nick w MP: Pumelowsky
Piwa : 1666
Daj tak a b?dzie dzia?a? na moim serwerze to dzia?a
local queryA = string . format ( "SELECT * FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1" , getElementData ( plr , "player:uid" ))
local resultA = exports [ "ogrpg-db" ]: dbGet ( queryA )
if #resultA > 0 then
setElementData ( plr , "player:premium" , true )
setElementData ( plr , "player:premiumdate" , v . premiumdate )
end
Podpis
Kontakt:
- Skype: live:pumapl_2
- GG: 56865468
- Discord: Pumelowsky#1126
- PW forum
[/center]
Wysłany: 2016-08-27, 14:15
AlaneqYT
Uczeń LUA
Wiek: 25 Na forum: 3885 dni Posty: 37
Piwa : 20
Dzi?ki, dzia?a
Tagi: premium :: raz
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: