How to include 2 LocalPlayer(): in a draw.SimpleText ?
3 replies, posted
I´m trying to put 2 LocalPlayer(): things into one draw.SimpleText.
This is how my current code looks like:
draw.SimpleText(LocalPlayer():Name() LocalPlayer():getDarkRPVar("level"), "aHUD28", 90, Scrh - HUDHeight + 12, aHUD.Color, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
I don`t have a clue why it isn`t working...
Anyone has an Idea how to solve it?
draw.SimpleText(LocalPlayer():Name()..LocalPlayer():getDarkRPVar("level"), "aHUD28", 90, Scrh - HUDHeight + 12, aHUD.Color, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
You should concatenate (Adding in .. to combine two things) it if you want to combine them, I'd recommend adding in a .." ".. for it to have a space.
User125 gave you your answer
.. is used as concetante operator, this means you are adding it to the end of the value, quite literally, it's like a + without arithmetics! (Like in JS for example.
So for example you can also do:
MyValue = "Hello"
MyValueContinued = " there"
print(MyValue .. MyValueContinued)
Would output:
Hello there
Another example that's good to understand in this scenario:
MyNumber = 10
OtherNumber = 5
print(MyNumber + OtherNumber)
print(MyNumber .. OtherNumber)
Would output:
15
105
Hope this clears it up for you, feel free to ask any questions.
Thank you guys
Sorry, you need to Log In to post a reply to this thread.