Gallagher Posted January 26, 2014 Share Posted January 26, 2014 (edited) hello! I have this script but it does not work as I expected. if getElementData(getLocalPlayer(), "Pizza") > 5 then dxDrawText("PIZZA " a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end I want the setElementData (source, "Pizza", 1) is activated if "Pizza") = 5 to 10 how to do it? "Pizza" is an element of the dayz I want this dxDrawText be created only when I have 5-10 pizzas currently appears if I have the DrawText 5,6,7,8,9,10,11,12 ... Pizzas. I want that if I have 12 or more pizzas to the DrawText not appear. Understand? Edited January 26, 2014 by Guest Link to comment
iPrestege Posted January 26, 2014 Share Posted January 26, 2014 hello! I have this script but it does not work as I expected. if getElementData(getLocalPlayer(), "Pizza") > 5 then setElementData (source, "Pizza", 1 ) end I want the setElementData (source, "Pizza", 1) is activated if "Pizza") = 5 to 10 how to do it? Can you please post the whole function because i can't understand that source and getLocalPlayer () -.- You're trying to set the 'Pizza' Data to how? Link to comment
Gallagher Posted January 26, 2014 Author Share Posted January 26, 2014 "Pizza" is an element of the dayz I want this dxDrawText be created only when I have 5-10 pizzas currently appears if I have the DrawText 5,6,7,8,9,10,11,12 ... Pizzas. I want that if I have 12 or more pizzas to the DrawText not appear. Understand? function createTest1 ( ) if getElementData(getLocalPlayer(), "Pizza") >= 5 then dxDrawText("PIZZA " a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering11 ) Link to comment
iPrestege Posted January 26, 2014 Share Posted January 26, 2014 "Pizza" is an element of the dayzI want this dxDrawText be created only when I have 5-10 pizzas currently appears if I have the DrawText 5,6,7,8,9,10,11,12 ... Pizzas. I want that if I have 12 or more pizzas to the DrawText not appear. Understand? function createTest1 ( ) if getElementData(getLocalPlayer(), "Pizza") >= 5 then dxDrawText("PIZZA " a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering11 ) You can simply check that if player have 5 or less as you're doing and check if the player have 12 and less . Link to comment
Gallagher Posted January 27, 2014 Author Share Posted January 27, 2014 "Pizza" is an element of the dayzI want this dxDrawText be created only when I have 5-10 pizzas currently appears if I have the DrawText 5,6,7,8,9,10,11,12 ... Pizzas. I want that if I have 12 or more pizzas to the DrawText not appear. Understand? function createTest1 ( ) if getElementData(getLocalPlayer(), "Pizza") >= 5 then dxDrawText("PIZZA " a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering11 ) You can simply check that if player have 5 or less as you're doing and check if the player have 12 and less . function createTest1 ( ) if getElementData(getLocalPlayer(), "Pizza") >= 5 then dxDrawText("PIZZA " a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end if getElementData(getLocalPlayer(), "Pizza") >= 11 then dxDrawText("PIZZA 11" a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end if getElementData(getLocalPlayer(), "Pizza") >= 16 then dxDrawText("PIZZA 16" a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering11 ) Understand now? If I have 16 Pizzas will appear dxDrawText all, but I want to appear only the last Link to comment
iPrestege Posted January 27, 2014 Share Posted January 27, 2014 "Pizza" is an element of the dayzI want this dxDrawText be created only when I have 5-10 pizzas currently appears if I have the DrawText 5,6,7,8,9,10,11,12 ... Pizzas. I want that if I have 12 or more pizzas to the DrawText not appear. Understand? function createTest1 ( ) if getElementData(getLocalPlayer(), "Pizza") >= 5 then dxDrawText("PIZZA " a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering11 ) You can simply check that if player have 5 or less as you're doing and check if the player have 12 and less . function createTest1 ( ) if getElementData(getLocalPlayer(), "Pizza") >= 5 then dxDrawText("PIZZA " a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end if getElementData(getLocalPlayer(), "Pizza") >= 11 then dxDrawText("PIZZA 11" a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end if getElementData(getLocalPlayer(), "Pizza") >= 16 then dxDrawText("PIZZA 16" a,screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end function HandleTheRendering11 ( ) addEventHandler ( "onClientRender", root, createTest1 ) end addEventHandler ( "onClientResourceStart", resourceRoot, HandleTheRendering11 ) Understand now? If I have 16 Pizzas will appear dxDrawText all, but I want to appear only the last addEventHandler ( "onClientRender", root, function ( ) local screenWidth, screenHeight = guiGetScreenSize ( ) local Pizza = getElementData ( localPlayer,'Pizza' ) if Pizza and Pizza >= 5 and Pizza <= 12 then dxDrawText("PIZZA ",screenWidth*0.248, screenHeight*0.955, screenWidth*0.0, screenHeight*0.0, tocolor(230, 252, 250, 255), 0.45, "bankgothic", "left", "top", false, false, false, false, false) end end ) Link to comment
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