Jump to content

ERRO DEBUGSCRIPT


Recommended Posts

addCommandHandler ("ptr", getRootElement(), ptriniciar12)
function ptriniciar12(thePlayer, cmd, state)
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policial" ) ) then
    if (state == "iniciar" or state == "finalizar") then 
        name = getPlayerName (thePlayer) 
        local horario = showTime()
        if (fileExists ("logPTR.txt")) then 
            newFile = fileOpen ("logPTR.txt") 
            fileSetPos (newFile, fileGetSize (newFile)) 
            if (state == "iniciar") then
                outputChatBox ("Patrulha iniciada.", thePlayer) 
                fileWrite (newFile, "["..horario.."] "name.." Iniciou sua patrulha.\n") -- linha do problema

Este é meu script porém ele da este erro: config.lua:13 ')' expected near 'name'

Link to comment
40 minutes ago, Otavio said:

addCommandHandler ("ptr", getRootElement(), ptriniciar12)
function ptriniciar12(thePlayer, cmd, state)
    local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) 
    if isObjectInACLGroup ("user."..accName, aclGetGroup ( "Policial" ) ) then
    if (state == "iniciar" or state == "finalizar") then 
        name = getPlayerName (thePlayer) 
        local horario = showTime()
        if (fileExists ("logPTR.txt")) then 
            newFile = fileOpen ("logPTR.txt") 
            fileSetPos (newFile, fileGetSize (newFile)) 
            if (state == "iniciar") then
                outputChatBox ("Patrulha iniciada.", thePlayer) 
                fileWrite (newFile, "["..horario.."] "name.." Iniciou sua patrulha.\n") -- linha do problema

Este é meu script porém ele da este erro: config.lua:13 ')' expected near 'name'

Você esqueceu de aplicar uma concatenação antes do uso da variavel name ' .. '

no caso você deve botar a linha assim:

fileWrite (newFile, "["..horario.."] "..name.." Iniciou sua patrulha.\n")

 

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