Mlody1200
OKOK
Wiek: 25 Na forum: 1441 dni Posty: 28
Nick w MP: tak
Piwa : 1348
-[[
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 getPremium ( plr , premium )
if premium then
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_users WHERE id=? AND premium=?" , getElementData ( plr , "player:sid" ), premium )
if result and #result > 0 then
return true
else
return false
end
else
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_users WHERE id=?" , getElementData ( plr , "player:sid" ))
if result and #result > 0 then
return true
else
return false
end
end
end
function loadPlayerData ( plr )
local result = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM pystories_users WHERE id=?" , getElementData ( plr , "player:sid" ))
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:srp" , v . srp )
setElementData ( plr , "player:workinjob" , v . worker )
setElementData ( plr , "player:pp" , v . pp )
setElementData ( plr , "player:registerdate" , v . registered )
setElementData ( plr , "player:hours" , v . hours )
setElementData ( plr , "player:skin" , v . skin )
setElementData ( plr , "player:casekeys" , v . caseKeys )
setElementData ( plr , "player:summerpkt" , v . summerpkt )
exports [ "dmta_organizacje" ]: checkOrganization ( plr )
setElementData ( plr , "player:premium" , true )
setElementData ( plr , "premium:level" , 1 )
local avatars = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM discord_connect WHERE sid=?" , v . id )
if avatars and #avatars > 0 and avatars[1].avatarurl then
exports [ "rmAvatars" ]: startImageDownload ( plr , avatars [ 1 ]. avatarurl )
setElementData ( plr , "player:avatar" , avatars [ 1 ]. avatarurl )
end
-- premium +
local queryA = string . format ( "SELECT * FROM pystories_users WHERE id=%d AND premiumplusdate>NOW() LIMIT 1" , getElementData ( plr , "player:sid" ))
local resultA = exports [ "DB2" ]: pobierzWyniki ( queryA )
if ( resultA ) then
setElementData ( plr , "player:premiumplus" , true )
setElementData ( plr , "player:premiumdateplus" , v . premiumplusdate )
setPlayerName ( plr , "" .. getPlayerName ( plr ))
-- setPlayerNametagColor ( plr , 255 , 200 , 0 )
setElementData ( plr , "premium:level" , 2 )
else
setElementData ( plr , "player:premiumplus" , false )
end
local org = exports [ "pystories-db" ]: dbGet ( "SELECT * FROM ms_organizacje WHERE code=? AND uid=? LIMIT 1" , getElementData ( plr , "player:organization" ), getElementData ( plr , "player:sid" )) -- pobieramy tylko JEDEN rekord
local name = getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" )
if org and #org > 0 then
setElementData ( plr , "player:organization" , org [ 1 ]. code )
outputChatBox ( "* Jeste? w organizacji, kt?ra nosi nazwe: " .. org [ 1 ]. code .. "" , plr )
exports [ 'pystories-db' ]: dbSet ( "UPDATE ms_organizacje SET actived=curdate() WHERE uid=?" , getElementData ( plr , "player:sid" ))
end
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 ( "pystories_users> Za?adowano statystyki gracza: " .. getPlayerName ( player ))
end
end )
function savePlayerData ( plr )
local sid = getElementData ( plr , "player:sid" )
if not sid 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 srp = getElementData ( plr , "player:srp" )
local pp = getElementData ( plr , "player:pp" )
local worker = getElementData ( plr , "player:workinjob" )
local caseKeys = getElementData ( plr , "player:casekeys" ) or 0
local hours = tonumber ( getElementData ( plr , "player:hours" )) or 0
local summerpkt = getElementData ( plr , "player:summerpkt" ) or 0
local query = exports [ "pystories-db" ]: dbSet ( "UPDATE pystories_users SET money=?, srp=?, mandate=?, pjA=?, pjB=?, pjC=?, pjL=?, worker=?, hours=?, summerpkt=?, pp=?,caseKeys=? WHERE id=?" ,
money , srp , mandate , licensea , licenseb , licensec , licensel , worker , hours , summerpkt , pp , caseKeys , sid )
if getElementData ( plr , "player:raported" ) then
removeElementData ( plr , "player:raported" );
for i , v in ipairs ( getElementsByType ( "player" )) do
if getElementData ( v , "player:admin" ) then
triggerEvent ( "admin:removeReport" , resourceRoot , getElementData ( plr , "id" ))
outputChatBox ( "[#ff0000RAPORT#ffffff] >> [#ff0000" .. getElementData ( plr , "id" ).. "#ffffff] #ff0000" .. getPlayerName ( plr ): gsub ( "#%x%x%x%x%x%x" , "" ).. "#ffffff wyszed? z serwera zg?oszenie na niego zosta?o usuni?te" , v , 255 , 255 , 255 , true )
end
end
end
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 ( "pystories_users> Zapisano statystyki gracza: " .. getPlayerName ( player ))
end
end )
addEventHandler ( "onPlayerQuit" , root , function() savePlayerData ( source ) end )
[ Dodano : 2022-12-31, 13:14 ]
s_saveplayers
Ostatnio zmieniony przez N0TH1NG 2022-12-31, 23:25, w całości zmieniany 1 raz