Jump to content

help


golanu21

Recommended Posts

Posted

client

if progCount == 0 then 
        guiSetText(nivlab, "0") 
        guiProgressBarSetProgress ( progressBar, ( guiProgressBarGetProgress ( progressBar ) + 50) ) 
    elseif progCount == 1 then  
        guiSetText(nivlab, "1") 
        guiProgressBarSetProgress ( progressBar, ( guiProgressBarGetProgress ( progressBar ) + 45) ) 
  
function saveexp() 
triggerServerEvent("lvl", getLocalPlayer(), progCount) 
end 
addEventHandler("onPlayerQuit", getRootElement(), saveexp) 
  

server

function greetingHandler ( progCount ) 
    local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in 
            setAccountData ( playeraccount, "level", progCount ) -- save it in his account 
      end 
end 
addEvent( "lvl", true ) 
addEventHandler( "lvl", getRootElement(), greetingHandler ) 
  
function exp2(_, playeraccount) 
    if (playeraccount) then 
        local exp = getAccountData( playeraccount, "level") 
        if (exp) then 
            --there idk what i need to type ... 
end 
addEventHandler("onPlayerLogin", getRootElement(), exp2) 

i want to setAccountData the progCount (level)

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted

onPlayerQuit is a server side event, you can't use it client side.

You'll have to set some element data storing the "progCount" value, then get it server side when they quit.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

When you update the progressbar, set element data on the local player.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
if progCount == 0 then 
        guiSetText(nivlab, "0") 
        guiProgressBarSetProgress ( progressBar, ( guiProgressBarGetProgress ( progressBar ) + 50) ) 
setElementData(getLocalPlayer(), "lvl1", progCount) ------ 
    elseif progCount == 1 then 
        guiSetText(nivlab, "1") 
        guiProgressBarSetProgress ( progressBar, ( guiProgressBarGetProgress ( progressBar ) + 45) ) 

like this ?

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Posted

Something like that, yes.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

and when player login, how i make ? like this ?

function exp2(_, playeraccount) 
    if (playeraccount) then 
        local exp = getAccountData( playeraccount, "level") 
        if (exp) then 
            --there idk what i need to type ... 
end 
addEventHandler("onPlayerLogin", getRootElement(), exp2) 

XajVsWV.png

168_zps269f1907.gif[Dev]BloWnRPG - We BloW the World [1%]168_zps269f1907.gif

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...