Castillo Posted January 23, 2014 Share Posted January 23, 2014 Do you have this added? exports.scoreboard:addScoreboardColumn ( 'Drift Rank' ) Link to comment
Castillo Posted January 23, 2014 Share Posted January 23, 2014 The scoreboard column appears? Link to comment
Sil3nT Posted January 23, 2014 Author Share Posted January 23, 2014 Nop And best drift isnt saving Link to comment
Castillo Posted January 23, 2014 Share Posted January 23, 2014 Show me the script where you put the scoreboard column creation. Link to comment
Sil3nT Posted January 23, 2014 Author Share Posted January 23, 2014 exports.scoreboard:addScoreboardColumn('Drift Rank') addEventHandler ( "onPlayerLogin", root, function ( _, account ) local driftPoints = tonumber ( getAccountData ( account, "Best Drift" ) ) or 0 checkDrift ( source, driftPoints ) end ) addEvent ( "onPlayerGotBetterDrift", true ) addEventHandler ( "onPlayerGotBetterDrift", root, function ( value ) checkDrift ( source, value ) end ) function checkDrift ( thePlayer, value ) if ( value >= 0 ) and ( value <= 29999 ) then setElementData ( thePlayer, "Drift Rank", "Sucky" ) elseif ( value >= 30000 ) and ( value <= 89999 ) then setElementData ( thePlayer, "Drift Rank", "Newbie" ) elseif ( value >= 90000 ) and ( value <= 149999 ) then setElementData ( thePlayer, "Drift Rank", "Grandpa" ) end end ) Link to comment
Castillo Posted January 23, 2014 Share Posted January 23, 2014 You added a parentheses at the end of the 'checkDrift' function, that was causing the script to don't start. exports.scoreboard:addScoreboardColumn ( 'Drift Rank' ) addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount ( player ) if ( not isGuestAccount ( account ) ) then local driftPoints = tonumber ( getAccountData ( account, "Best Drift" ) ) or 0 checkDrift ( player, driftPoints ) end end end ) addEventHandler ( "onPlayerLogin", root, function ( _, account ) local driftPoints = tonumber ( getAccountData ( account, "Best Drift" ) ) or 0 checkDrift ( source, driftPoints ) end ) addEvent ( "onPlayerGotBetterDrift", true ) addEventHandler ( "onPlayerGotBetterDrift", root, function ( value ) checkDrift ( source, value ) end ) function checkDrift ( thePlayer, value ) if ( value >= 0 ) and ( value <= 29999 ) then setElementData ( thePlayer, "Drift Rank", "Sucky" ) elseif ( value >= 30000 ) and ( value <= 89999 ) then setElementData ( thePlayer, "Drift Rank", "Newbie" ) elseif ( value >= 90000 ) and ( value <= 149999 ) then setElementData ( thePlayer, "Drift Rank", "Grandpa" ) end end Link to comment
Sil3nT Posted January 23, 2014 Author Share Posted January 23, 2014 Okay now i have everything! But that rank isnt changing if i beat sucky drift rank then its not changing on newbie Do we dont need like onElementDataChange Link to comment
Castillo Posted January 23, 2014 Share Posted January 23, 2014 Replace client side ( drft.lua ) with this one: --these are the banned vehicle ids where you cannot get drift points. local BannedIDs = { 432, 532 } local rootElem = getRootElement() local thisRoot = getResourceRootElement(getThisResource()) local player = getLocalPlayer() local vehicle local size = 1.2 local modo = 0.01 local score = 0 local screenScore = 0 local tick local idleTime local multTime local driftTime local Yellow = tocolor(255,232,25) local Red = tocolor(234,0,3) local TempCol = Yellow local mult = 1 local tablamult = {350,1400,4200,11200} local anterior = 0 local mejor = 0 local total = 0 local global_mejor = 0 local global_nombre = "N/A" local screenWidth, screenHeight = guiGetScreenSize() local x1,y1,x2,y2 = screenWidth*0.2,screenHeight*0.1,screenWidth*0.8,screenHeight*0.8 addEventHandler("onClientResourceStart", thisRoot, function() addEventHandler("onClientRender", rootElem, showText) outputChatBox("Waiting for server drift data...") triggerServerEvent("driftClienteListo", rootElem, player) end ) addEventHandler("onClientResourceStop", thisRoot, function() removeEventHandler("onClientRender", rootElem, showText) end ) function isValidVehicle() local temp = getPedOccupiedVehicle(player) if not temp or getVehicleOccupant(temp,0) ~= player or getVehicleType(temp) ~= "Automobile" then return false end local vehID = getElementModel(temp) for k,v in ipairs(BannedIDs) do if vehID == v then return false end end return temp end function showText() dxDrawText(string.format("Best Drift: %s - %d",global_nombre,global_mejor),44,screenHeight-43,screenWidth,screenHeight,Yellow,1,"pricedown") vehicle = isValidVehicle() if not vehicle then return end if size > 1.3 then modo = -0.01 elseif size < 1.2 then modo = 0.01 end size = size + modo tick = getTickCount() local angulo,velocidad = angle() local tempBool = tick - (idleTime or 0) < 750 if not tempBool and score ~= 0 then anterior = score setElementData(player, "Last Drift", anterior) total = total+anterior setElementData(player, "Total Drift", total) if score > mejor then mejor = score setElementData(player, "Best Drift", mejor) end if ( score > 0 ) then triggerServerEvent ( "updatePlayerDrift", localPlayer, score ) end triggerEvent("onVehicleDriftEnd", rootElem, tick-driftTime-750) score = 0 end if angulo ~= 0 then if score == 0 then triggerEvent("onVehicleDriftStart", rootElem) driftTime = tick end if tempBool then score = score + math.floor(angulo*velocidad)*mult else score = math.floor(angulo*velocidad)*mult end if TempCol == Red then TempCol = Yellow end screenScore = score idleTime = tick end local temp2 = string.format("Factor: X%d\n%s",mult,mult~=5 and string.format("Gain X%d with %d",mult+1,tablamult[mult]) or "MAX") dxDrawText(temp2, 20,155,screenWidth,screenHeight, Yellow, 1.2, "sans","left","top", false,true,false) if velocidad <= 0.3 and mult ~= 1 then dxDrawText("\n\nToo Slow!", 20,155,screenWidth,screenHeight, Yellow, 1.2, "sans","left","top", false,true,false) end if tick - (idleTime or 0) < 3000 then local temp = "DRIFT" if score >= 100000 then temp = "DRIFT\n\nDrift King!" elseif score >= 50000 then temp = "DRIFT\n\nInsane Drift!" elseif score >= 20000 then temp = "DRIFT\n\nOutrageous!" elseif score >= 15000 then temp = "DRIFT\n\nColossal!" elseif score >= 7000 then temp = "DRIFT\n\nSuberb!" elseif score >= 3000 then temp = "DRIFT\n\nGreat Drift!" elseif score >= 1000 then temp = "DRIFT\n\nGood Drift!" end dxDrawText(temp, x1,y1,x2,y2, TempCol, 2.2, "sans","center","top", false,true,false) dxDrawText(string.format("\n%d",screenScore), x1,y1-10,x2,y2, TempCol, size, "pricedown","center","top", false,true,false) end end function angle() local vx,vy,vz = getElementVelocity(vehicle) local modV = math.sqrt(vx*vx + vy*vy) if not isVehicleOnGround(vehicle) then return 0,modV end local rx,ry,rz = getElementRotation(vehicle) local sn,cs = -math.sin(math.rad(rz)), math.cos(math.rad(rz)) local deltaT = tick - (multTime or 0) if mult~= 1 and modV <= 0.3 and deltaT > 750 then mult = mult-1 multTime = tick elseif deltaT > 1500 then local temp = 1 if score >= 11200 then temp = 5 elseif score >= 4200 then temp = 4 elseif score >= 1400 then temp = 3 elseif score >= 350 then temp = 2 end if temp>mult then mult = temp multTime = tick end end if modV <= 0.2 then return 0,modV end --speed over 40 km/h local cosX = (sn*vx + cs*vy)/modV if cosX > 0.966 or cosX < 0 then return 0,modV end --angle between 15 and 90 degrees return math.deg(math.acos(cosX))*0.5, modV end addEvent("driftCarCrashed", true) addEventHandler("driftCarCrashed", rootElem, function() if score ~= 0 then score = 0 mult = 1 TempCol = Red triggerEvent("onVehicleDriftEnd", rootElem, 0) end end ) addEvent("driftActualizarRecord", true) addEventHandler("driftActualizarRecord", rootElem, function(score, name) global_mejor = score global_nombre = name end ) function resetScore() anterior,mejor,total = 0,0,0 setElementData(player, "Last Drift", anterior) setElementData(player, "Total Drift", total) setElementData(player, "Best Drift", mejor) end addEvent("driftResetAllScores", true) addEventHandler("driftResetAllScores", rootElem, resetScore) addCommandHandler("resetdrift", resetScore) function checkPuntaje() if total > global_mejor then triggerServerEvent("driftNuevoRecord", rootElem, total, getPlayerName(player)) end end addEventHandler("onClientPlayerFinish", rootElem, checkPuntaje) addEventHandler("onClientPlayerOutOfTime", rootElem, checkPuntaje) Link to comment
Sil3nT Posted January 23, 2014 Author Share Posted January 23, 2014 Nop doesnt changing the drift rank! Mybe add me on skype? nick mazais233 (search for sil3nt) Link to comment
Castillo Posted January 23, 2014 Share Posted January 23, 2014 You got 30000 drift points? because that's the next rank. Link to comment
Sil3nT Posted January 23, 2014 Author Share Posted January 23, 2014 Yeah i get 1 milion Link to comment
Castillo Posted January 23, 2014 Share Posted January 23, 2014 But how did you get it? Link to comment
Sil3nT Posted January 23, 2014 Author Share Posted January 23, 2014 With drifting on SF airport then i stoped on 1mil and i was "Sucky" Link to comment
Karuzo Posted January 24, 2014 Share Posted January 24, 2014 Any Errors in debugscript 3 ? Link to comment
Sil3nT Posted January 24, 2014 Author Share Posted January 24, 2014 nop. Just doesnt changing rank! Link to comment
Castillo Posted January 24, 2014 Share Posted January 24, 2014 Use this and tell me what does it say when you drift: exports.scoreboard:addScoreboardColumn ( 'Drift Rank' ) addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do local account = getPlayerAccount ( player ) if ( not isGuestAccount ( account ) ) then local driftPoints = tonumber ( getAccountData ( account, "Best Drift" ) ) or 0 checkDrift ( player, driftPoints ) end end end ) addEventHandler ( "onPlayerLogin", root, function ( _, account ) local driftPoints = tonumber ( getAccountData ( account, "Best Drift" ) ) or 0 checkDrift ( source, driftPoints ) end ) addEvent ( "onPlayerGotBetterDrift", true ) addEventHandler ( "onPlayerGotBetterDrift", root, function ( value ) outputChatBox ( "onPlayerGotBetterDrift: You got ".. tostring ( value ), source ) checkDrift ( source, value ) end ) function checkDrift ( thePlayer, value ) if ( value >= 0 ) and ( value <= 29999 ) then setElementData ( thePlayer, "Drift Rank", "Sucky" ) elseif ( value >= 30000 ) and ( value <= 89999 ) then setElementData ( thePlayer, "Drift Rank", "Newbie" ) elseif ( value >= 90000 ) and ( value <= 149999 ) then setElementData ( thePlayer, "Drift Rank", "Grandpa" ) end end Link to comment
Sil3nT Posted January 25, 2014 Author Share Posted January 25, 2014 Uhmm nothing just my drifting counter and on scoreboard is Drift rank List and there is only sucky Link to comment
Castillo Posted January 25, 2014 Share Posted January 25, 2014 Yes, but does it output something to the chat box? Link to comment
Sil3nT Posted January 25, 2014 Author Share Posted January 25, 2014 nope! i create something like this now (another script) local mejor is in drift counter resource named "best drift" exports.scoreboard:addScoreboardColumn('Drift Rank') addEventHandler("onVehicleDriftEnd",root, function() local account = getPlayerAccount(source) local mejor = getAccountData(account,"Best drift") if ( value >= 0 ) and ( value <= 29999 ) then setAccountData ( account, "Drift Rank", "Sucky" ) elseif ( value >= 30000 ) and ( value <= 89999 ) then setAccountData ( account, "Drift Rank", "Newbie" ) elseif ( value >= 90000 ) and ( value <= 149999 ) then setAccountData ( account, "Drift Rank", "Grandpa" ) elseif ( value >= 150000) and ( value <= 299999) then setAccountData ( account, "Drift Rank", "Amateur" ) elseif ( value >= 300000) and ( value <= 499999) then setAccountData ( account, "Drift Rank", "NewbieDrifter" ) elseif ( value >= 500000) and ( value <= 699999) then setAccountData ( account, "Drift Rank", "StreetDrifter" ) elseif ( value >= 700000) and ( value <= 9999999) then setAccountData ( account, "Drift Rank", "CrazyDrifter" ) elseif ( value >= 1000000) and ( value <= 1499999) then setAccountData ( account, "Drift Rank", "AwesomeDrifter" ) elseif ( value >= 1500000) and ( value <= 1999999) then setAccountData ( account, "Drift Rank", "MonsterDrift" ) elseif ( value >= 2000000) and ( value <= 2999999) then setAccountData ( account, "Drift Rank", "UltimateDrifter" ) elseif ( value >= 3000000) and ( value <= 3999999) then setAccountData ( account, "Drift Rank", "NoFeaR" ) elseif ( value >= 4000000) and ( value <= 4999999) then setAccountData ( account, "Drift Rank", "AnimalDrifter" ) elseif ( value >= 5000000) and ( value <= 5999999) then setAccountData ( account, "Drift Rank", "ServerDrifter" ) elseif ( value >= 6000000) and ( value <= 6999999) then setAccountData ( account, "Drift Rank", "PsyhoDrifter" ) elseif ( value >= 7000000) and ( value <= 7999999) then setAccountData ( account, "Drift Rank", "JDM|Drifter" ) elseif ( value >= 8000000) and ( value <= 9999999) then setAccountData ( account, "Drift Rank", "ProDrifter" ) elseif ( value >= 10000000) and ( value <= 20000000) then setAccountData ( account, "Drift Rank", "Elite-Drifter" ) end end ) Link to comment
Castillo Posted January 25, 2014 Share Posted January 25, 2014 If it doesn't output anything, then you either copied what I gave you wrong, or you aren't drifting at all, since I just tested it and it did output something when I finished my drift. Download this: https://www.dropbox.com/s/hzpl4b1bc8knlpx/resources.rar it contains both drift and drift rank resources. Link to comment
Sil3nT Posted January 25, 2014 Author Share Posted January 25, 2014 but the tab is working for u? is it changing drift rank? Link to comment
Sil3nT Posted January 25, 2014 Author Share Posted January 25, 2014 Everything is okay! YEAH ALL SAVES TNX A LOT MAN! Edit: CAn u help me one more thing? Ppl are saying that they need to best and total drift saves when reconnect! How to doo that? What to add in script? 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