- Messages
- 5,093
- Reaction score
- 2,881
- Points
- 1,103
Hello everyone,
today I will share some 3 example Create-uiElements-Functions developed by me! Because at the start there are some changes on bo3 to call the normal ui functions.. Feel free to use them in your project with credits!
createText
Create a String/Text uiElement
Example:
createRectangle
Create a Rectangle uiElement
Example:
createValueElement
Create a Value uiElement
Example:
Regards,
CabCon.
today I will share some 3 example Create-uiElements-Functions developed by me! Because at the start there are some changes on bo3 to call the normal ui functions.. Feel free to use them in your project with credits!
createText
Create a String/Text uiElement
Example:
Code:
self.element_2 = self createText("default", 1.5, 0, "Join CabConModding", "CENTER", "CENTER", -250, 0, 1,(1,1,1));
Code:
function createText(font,fontSize, sorts, text, align, relative, x, y, alpha, color)
{
uiElement = hud::createFontString(font, fontSize);
uiElement hud::setPoint(align, relative, x, y);
uiElement settext(text);
uiElement.sort = sorts;
uiElement.hidewheninmenu = true;
if( isDefined(alpha) )
uiElement.alpha = alpha;
if( isDefined(color) )
uiElement.color = color;
return uiElement;
}
createRectangle
Create a Rectangle uiElement
Example:
Code:
self.element_3 = self createRectangle("CENTER", "CENTER", 0, 0, 100, 100, (1,0,0), 1, 1, "white");
Code:
function createRectangle(align, relative, x, y, width, height, color, sort, alpha, shader)
{
uiElement = newClientHudElem( self );
uiElement.elemType = "bar";
uiElement.width = width;
uiElement.height = height;
uiElement.xOffset = 0;
uiElement.yOffset = 0;
uiElement.hidewheninmenu = true;
uiElement.children = [];
uiElement.sort = sort;
uiElement.color = color;
uiElement.alpha = alpha;
uiElement hud::setParent( level.uiParent );
uiElement setShader( shader, width , height );
uiElement.hidden = false;
uiElement hud::setPoint(align,relative,x,y);
return uiElement;
}
createValueElement
Create a Value uiElement
Example:
Code:
self.element = self createValueElement(1.5, 0, 1337, "CENTER", "CENTER", 250, 0, 1, (1,1,1));
Code:
function createValueElement(fontSize, sorts, value, align, relative, x, y, alpha, color)
{
uiElement = hud::createFontString("default", fontSize);
uiElement hud::setPoint(align, relative, x, y);
uiElement setvalue(value);
uiElement.sort = sorts;
uiElement.hidewheninmenu = true;
if( isDefined(alpha) )
uiElement.alpha = alpha;
if( isDefined(color) )
uiElement.color = color;
return uiElement;
}
Credits
CabCon
CabCon
Regards,
CabCon.
Last edited: