Forum

> > CS2D > Scripts > Rank + Image
Forums overviewCS2D overview Scripts overviewLog in to reply

English Rank + Image

6 replies
To the start Previous 1 Next To the start

old Rank + Image

Akira Kurusu
User Off Offline

Quote
Hi!
Translated by Khan ( My neighbour )
i have a csgo rank icons, and i found this script.
this gave me an idea!

<-Credit-> Mozilla. ( Khan says caps is a kid things so i made it normal )

I need help for this script, i got CSGO Rank Icons. And this code, all i want is how to make the image apply to each rank, well i need help, i will share if theres somebody in need :3 well thanks. that's all.

Array.lua
Spoiler >


Function.lua
Spoiler >


Hooks.lua
Spoiler >


Thanks for the help! i will give credits! at my server
edited 1×, last 10.02.16 04:50:46 pm

old Re: Rank + Image

Pseudon
User Off Offline

Quote
Please do not do this, ask somebody to help with the translation if needed.

old Re: Rank + Image

GeoB99
Moderator Off Offline

Quote
On Arrays file create a table, name it as levelimage and assign it to every levelname indexed table with square brackets (e.g. levelname[1] must be assigned with levelimage[1] and specify the path of an image as well). You have to do that for every levelname till you reach the last level.

Once you finished, go to Functions file and check for a function declaration that checks the level of a player. Afterwards, create a local variable as img and define it for cs2d lua cmd image. Note that the path of an image must be as a string in this scenario so it should be like ..levelimage.. and choose the preferable X and Y coordination of it in your wish. You need also to define the Image table (seeing that it exists there in Functions code) to nil for the sake of recycled image IDs which would create many problems if we don't remove them.

And finally, go to Hooks file and find for a function declaration that checks when a player leaves completely the server. Define the table there to nil also so we can be sure that there will not be any problems with recycled image IDs (well, I do think cs2d lua hook leave would do that by itself but I do not know exactly). Hope that helps somehow.

user Akira Kurusu has written
Translated by Khan ( My neighbour )

You will realize after that using a translator or seeking help from someone at speaking in English and such for you is a huge mistake. Better learn for yourself, it's more better. √

old Re: Rank + Image

THEMUD
User Off Offline

Quote
@user Akira Kurusu: Well, you can do it in a simple way without defining any further variables.

First of all, list the rank images' names as numbers like 1.png, 2.png and so on in ordinal.

Second of all, in the 'leveling up' section in your script, set the p_rank variable to indicate to the p_level variable by parsing the image command but adding the p_level in the last image path.
So it will give your current rank the appropriate image as you listed.

Like this:
1
p_rank[id] = image("gfx/YOUR_PATH/YOUR_PATH/"..p_level[id]..".png", 0, 0, id+200)
Otherwise, don't forget to add the freeimage command before adding a rank to prevent the script of replacing the ranks overflowed.

old Re: Rank + Image

Akira Kurusu
User Off Offline

Quote
_T Can you make the script for me??? sorry im noob
edited 1×, last 12.02.16 05:06:26 pm

old Re: Rank + Image

GeoB99
Moderator Off Offline

Quote
Indexed tables are only reserved for obvious reasons. p_rank table holds a key which it describes the id of a player. You don't simply replace the key with the rank name in that way otherwise you might get unexpected behaviour. Same for p_level as well.

Besides of it, I may ask you, (referring to your previous post) what it doesn't work? Providing to us only an information that it simply does not work is not enough to get the needed help. Have you even tried to see and check if the Console prints an error or something?

• Edit: Right, you edited the last post. Yet I urge you to read my second prerequisite.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview