Destroyer.- Posted July 24, 2014 Share Posted July 24, 2014 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) Link to comment
RottenFlesh Posted July 25, 2014 Share Posted July 25, 2014 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. Link to comment
Destroyer.- Posted July 25, 2014 Author Share Posted July 25, 2014 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 Link to comment
RottenFlesh Posted July 25, 2014 Share Posted July 25, 2014 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) Link to comment
Destroyer.- Posted July 25, 2014 Author Share Posted July 25, 2014 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 Link to comment
Recommended Posts