Jump to content

Ayuda con comando


Recommended Posts

Posted

Hola me pueden ayudar es que estoy tratando de hacer un contador de arrestos y como test quiero hacer esto pero no me funciona me aparece

attempt to perform arithmetic on local 'point' (a nil value)

function asd(player) 
ap = getElementData(player,"arrests") 
local point = tonumber(ap) 
setElementData(player,"arrests", point + 1) 
end 
addCommandHandler("holaxd", asd) 
  

Posted

Si estas haciendo ese script en client-side, los comandos no tienen el argumento de player.

localPlayer -- Usa esta variable si quieres obtener al player del lado del cliente. 

Posted
Si estas haciendo ese script en client-side, los comandos no tienen el argumento de player.
localPlayer -- Usa esta variable si quieres obtener al player del lado del cliente. 

Lo hice en Server :S

Posted

Supongo yo que en alguna parte del script tu les pones ese element data, sino por eso te da error.

Prueba esto:

function asd(player) 
    local ap = getElementData(player, "arrests") 
    local point = tonumber(ap) or 0 
    setElementData(player,"arrests", point + 1) 
end 
addCommandHandler('holaxd', asd) 

Posted
Supongo yo que en alguna parte del script tu les pones ese element data, sino por eso te da error.

Prueba esto:

function asd(player) 
    local ap = getElementData(player, "arrests") 
    local point = tonumber(ap) or 0 
    setElementData(player,"arrests", point + 1) 
end 
addCommandHandler('holaxd', asd) 

Sisi es un test para el contador y gracias si funciono :D

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...