CheiN Posted March 4, 2013 Share Posted March 4, 2013 exports.scoreboard:scoreboardAddColumn( "Top Times") function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then top = getElementData(source,"Top Times") or 0 setElementData(source,"Top Times",top+1) end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) function saverhere () local account = getPlayerAccount( source ) if ( account ) and not isGuestAccount ( account ) then local toptimes1 = getElementData ( source, "Top Times" ) if ( account ) then setAccountData ( account, "toptimes.top", toptimes1 ) end end end function loger ( account ) if ( account ) then local toptimes = getAccountData ( account, "toptimes.top" ) if ( toptimes ) then setElementData ( source, "toptimes.top", toptimes ) end end end addEventHandler ( "onPlayerQuit", getRootElement( ), saverhere ) addEventHandler ( "onPlayerLogin", getRootElement ( ), loger ) (i made this toptimes on scoreboard so im not stolling rights.) can some one help me or explain me why this is not working? Link to comment
Danii Posted March 4, 2013 Share Posted March 4, 2013 Try: exports.scoreboard:scoreboardAddColumn( "Top Times") function someoneReachedHunter(number, sort, model) if sort == "vehiclechange" and model == 425 then top = getElementData(source,"Top Times") or 0 setElementData(source,"Top Times",top+1) end end addEvent("onPlayerPickUpRacePickup",true) addEventHandler("onPlayerPickUpRacePickup",getRootElement(),someoneReachedHunter) function saverhere () local account = getPlayerAccount( source ) if ( account and not isGuestAccount(account) ) then local toptimes1 = getElementData ( source, "Top Times" ) setAccountData ( account, "toptimes.top", toptimes1 ) end end function loger ( _,account ) if ( account ) then local toptimes = getAccountData ( account, "toptimes.top" ) if ( toptimes ) then setElementData ( source, "Top Times", toptimes ) end end end addEventHandler ( "onPlayerQuit", getRootElement( ), saverhere ) addEventHandler ( "onPlayerLogin", getRootElement ( ), loger ) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now