Jump to content

Save Stats Problem!


Klesh

Recommended Posts

Hi community, i have to try edit castillo's script race userpanel to save race wins and race looses, how can i make it, here is the code from old script (better):

function DestructionMoney2() 
local alivePlayers = getAlivePlayers() 
if info == "Destruction derby" then 
   if #alivePlayers == 1 then  
   local playername = getPlayerName(alivePlayers[1]) 
   local serial = getPlayerSerial(alivePlayers[1]) 
   local oldData = executeSQLSelect( "RaceStats", "Wins","serial = '" .. serial .. "'") 
   local oldData = executeSQLSelect( "RaceStats", "Wins","serial = '" .. serial .. "'")    
   newData = tonumber(oldData[1]["Wins"]) + 1 
   setElementData(alivePlayers[1],"Wins",tonumber(getElementData(alivePlayers[1],"Wins"))+1)    
   executeSQLUpdate ( "RaceStats", "Wins = '"..newData.."'","serial = '" .. serial .. "'") 
      end  
   end 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), DestructionMoney2 ) 
addEventHandler ( "onPlayerLogin", getRootElement(), DestructionMoney2 ) 
  
addEventHandler("onPlayerWasted",rootElement, 
function () 
setElementData(source,"Deaths",tonumber(getElementData(source,"Deaths"))+1) 
local serial = getPlayerSerial(source) 
local oldData = executeSQLSelect( "RaceStats", "Deaths","serial = '" .. serial .. "'") 
newData = tonumber(oldData[1]["Deaths"]) + 1 
executeSQLUpdate ( "RaceStats", "Deaths = '"..newData.."'","serial = '" .. serial .. "'")    
end) 
addEventHandler ( "onPlayerSpawn", getRootElement(), source ) 
addEventHandler ( "onPlayerLogin", getRootElement(), source ) 
  
function carColorChanger(carRedBar,carGreenBar,carBlueBar,carBlueBar2) 
playerVehicle = getPedOccupiedVehicle ( source ) 
    if ( playerVehicle ) then        
    setVehicleColor ( playerVehicle, carRedBar,carGreenBar,carBlueBar,carBlueBar2 ) 
   end 
end 
addEvent("changeCarColor", true) 
addEventHandler("changeCarColor", rootElement,carColorChanger) 
  
function carLightsColorChanger(car, r, g, b) 
    if ( car ) then 
    setVehicleHeadLightColor (car, r, g, b) 
   end 
end 
addEvent("changeLightsColor", true) 
addEventHandler("changeLightsColor", rootElement, carLightsColorChanger) 

I try to edited, but nothing, how i can save the wins! Thanks for any help!

Dont worry to try up the wins count, i alredy fixed with the race.zip file.

Link to comment

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...