DeathMta Posted September 10, 2015 Posted September 10, 2015 ERROR : nivel.lua:95 attempt to concatenate local "rang" (a nil value) Help please function HudExpRangos() local screenWidth, screenHeight = guiGetScreenSize ( ) local nivel = getElementData(getLocalPlayer(), "level") local rang = getElementData(getLocalPlayer(), "Rango") if nivel == 1 then setElementData(source, "Rango","Mediocre") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 2 then setElementData(source, "Rango","Novato") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 3 then setElementData(source, "Rango","Novato Medio") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 4 then setElementData(source, "Rango","Aprendiz") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 5 then setElementData(source, "Rango","Semi - Campero") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 6 then setElementData(source, "Rango","Campero") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 7 then setElementData(source, "Rango","Asesino") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 8 then setElementData(source, "Rango","Sicario") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 9 then setElementData(source, "Rango","Killero") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 10 then setElementData(source, "Rango","Teniente") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 11 then setElementData(source, "Rango","Sangriento") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 12 then setElementData(source, "Rango","Mortero") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 13 then setElementData(source, "Rango","Capitan") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 14 then setElementData(source, "Rango","Super-Killer") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 15 then setElementData(source, "Rango","Death") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 16 then setElementData(source, "Rango","Por Ahi :v") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 17 then setElementData(source, "Rango","General") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 18 then setElementData(source, "Rango","Sargento") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 19 then setElementData(source, "Rango","Avanzado") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 20 then setElementData(source, "Rango","Semi-Pro") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 21 then setElementData(source, "Rango","Pro") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 22 then setElementData(source, "Rango","Master") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) elseif nivel == 23 then setElementData(source, "Rango","Rey Pro") dxDrawText("Rango:"..rang,screenWidth*0.7561, screenHeight*0.161, screenWidth*0.95, screenHeight*0.5,tocolor(0,0,0),0.4,"bankgothic","right","top",false,false,false) dxDrawText("Rango:"..rang,screenWidth*0.756, screenHeight*0.16, screenWidth*0.95, screenHeight*0.5,tocolor(255,255,255,255),0.4,"bankgothic","right","top",false,false,false) end end addEventHandler("onClientHUDRender",getRootElement(),HudExpRangos) Nesecitas Ayudas solo Mandame PM!! Death Scripts Ayudando a la comunidad sin fines de lucro!
JR10 Posted September 10, 2015 Posted September 10, 2015 The "Rango" element data doesn't exist for the local player, that's why it returns nil and the script complains. Setting a fallback value like zero will prevent such errors: local rang = getElementData(getLocalPlayer(), "Rango") or 0 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
DeathMta Posted September 10, 2015 Author Posted September 10, 2015 Thanks Visit mi server in spanish : mtasa://74.91.118.193:22003 Nesecitas Ayudas solo Mandame PM!! Death Scripts Ayudando a la comunidad sin fines de lucro!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now