Jump to content

onPlayerToptimeImprovement D:


#Paper

Recommended Posts

Posted

Does not show any error but doesn't set the data:

function onTopTime (player,newPos,newTime,oldPos,oldTime,random1,random2) 
    if isGuestAccount(getPlayerAccount(source)) == false then 
        if newPos <= 10 then 
            addStat(getPlayerAccount(source), "Top Times", 1) 
        end 
    end 
end 
addEvent("onPlayerToptimeImprovement",true) 
addEventHandler("onPlayerToptimeImprovement",getRootElement(), onTopTime) 

Posted
function onTopTime (player,newPos,newTime,oldPos,oldTime,random1,random2) 
    if isGuestAccount(getPlayerAccount(player)) == false then 
        if newPos <= 10 then 
            addStat(getPlayerAccount(player), "Top Times", 1) 
        end 
    end 
end 
addEvent("onPlayerToptimeImprovement",true) 
addEventHandler("onPlayerToptimeImprovement",getRootElement(), onTopTime) 

Posted
function onTopTime (player,newPos,newTime,oldPos,oldTime,random1,random2) 
    if isGuestAccount(getPlayerAccount(player)) == false then 
        if newPos <= 10 then 
            addStat(getPlayerAccount(player), "Top Times", 1) 
        end 
    end 
end 
addEvent("onPlayerToptimeImprovement",true) 
addEventHandler("onPlayerToptimeImprovement",getRootElement(), onTopTime) 

i tryed too, but it says bad argument @ line 2

Posted (edited)

i tryed too, but it says bad argument @ line 2

You forgot to add the 2 brackets(), try this:

function onTopTime (player,newPos,newTime,oldPos,oldTime,random1,random2) 
    if (isGuestAccount(getPlayerAccount(player)) == false) then 
        if newPos <= 10 then 
            addStat(getPlayerAccount(player), "Top Times", 1) 
        end 
    end 
end 
addEvent("onPlayerToptimeImprovement",true) 
addEventHandler("onPlayerToptimeImprovement",getRootElement(), onTopTime) 
-- OR 
function onTopTime (player,newPos,newTime,oldPos,oldTime,random1,random2) 
              local account = getPlayerAccount(player) 
    if isGuestAccount(account) then 
        if newPos <= 10 then 
            addStat(getPlayerAccount(player), "Top Times", 1) 
        end 
    end 
end 
addEvent("onPlayerToptimeImprovement",true) 
addEventHandler("onPlayerToptimeImprovement",getRootElement(), onTopTime) 

Edited by Guest
Posted

You forgot to add the 2 brackets(), try this:

That doesn't change anything.

Try:

function onTopTime (player,newPos,newTime,oldPos,oldTime,random1,random2) 
     local account = getPlayerAccount(player) 
    if account then 
    if not isGuestAccount(account) then 
        if newPos <= 10 then 
            addStat(account, "Top Times", 1) 
        end 
    end 
end 
addEvent("onPlayerToptimeImprovement",true) 
addEventHandler("onPlayerToptimeImprovement",getRootElement(), onTopTime) 

Posted

i tryed too whit debugstrings beetween "if account then" and "if not isGuestAccount(account) then" but doesn't appear :S

Btw it's triggered from "race_toptimes/toptimes_server.lua"

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