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) 

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

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) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

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

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

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) 

Business System viewtopic.php?f=108&t=35797

Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726

SQLite Tutorial viewtopic.php?f=148&t=38203

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"

mtaubluascripter.png

My skype: skiper964

I helped you? Help me! ^^

Help me bro! ^^

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