1 (edited by moritz. 2011-10-30 18:54:12)

Topic: [HELP]How i can do this?

Hey Guys,

I'm new in the coding in the Teeworlds Source.
I want to coding a little Level Mod. But I do not know
how to write the level before the name.

This is my Code:

char buf [512];
str_format (. (buf), sizeof (buf), "[% d]% s", "lvl: 1," m_aClients [ClientID] m_aName);
return buf;

But that does not work.

So, i ask you. How i can doing this right? Can you give me the right code?
I hope you can help me.

Thank you.. smile

PS: Sorry for my Bad English, im 11 Yeahrs Old big_smile

2

Re: [HELP]How i can do this?

You cannot return an array like this, since it's been allowed into the function, it will be destroyed at the end of it. Only solution would be to put the array as a parameter of the function.
By the way, you should definitely try to involve in learning C++ programming before going deep in the Teeworlds code.

Not Luck, Just Magic.

3

Re: [HELP]How i can do this?

Okay, i try this.
Thank you wink

4

Re: [HELP]How i can do this?

E.g.
in player.h
int m_Lvl;
next
char a[128];
str_format(a, sizeof(a), "[%d]%s", m_Lvl, Server()->ClientName(m_ClientID));

P.S> This code put in player.cpp

5

Re: [HELP]How i can do this?

You need save the original nick.. if you dont like in the name...

[%d][%d][%d][%d]%s .... bug xD