Forum

> > CS2D > Scripts > created a new one closed
Forums overviewCS2D overview Scripts overviewLog in to reply

English created a new one closed

14 replies
To the start Previous 1 Next To the start

old Re: created a new one closed

Masea
Super User Off Offline

Quote
Well, there was a function called
removeitem
which I'm actually not sure about the name at functions.lua. Find it and see how it works, then you're done.

It'd work like:
if removeitem(id, itemid, amount) then

old Re: created a new one closed

Yates
Reviewer Off Offline

Quote
In addition to the above if you are checking for multiple items and will use the
removeitem
function make sure to add them back if not all conditions are met.

old Re: created a new one closed

Ryden
User Off Offline

Quote
@user Masea: @user Yates: Thank you guys I'll go check right now

Edit: I've resolved it thank you very much for your help guys

I added a nd question about another thing guys
edited 3×, last 05.08.17 05:22:57 pm

old Re: created a new one closed

Talented Doge
User Off Offline

Quote
Quote
And it says in chat you level up ...
How Do I change it in the TOP like for all players can see that you've level up,


You will find some stuffs like
msg2(id,"You leveled up!")
, change it to
msg(player(id, "name").." leveled up!")

old Re: created a new one closed

Ryden
User Off Offline

Quote
@user Talented Doge: In Function.lua I found this can you check if it's the code that I've got to change?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function addexp(id, exp)
	PLAYERS[id].Experience = PLAYERS[id].Experience + exp
	local prevlevel = PLAYERS[id].Level
	while PLAYERS[id].Experience >= EXPTABLE[PLAYERS[id].Level+1] do
		PLAYERS[id].Level = PLAYERS[id].Level + 1
	end
	if prevlevel ~= PLAYERS[id].Level then
		parse('effect "colorsmoke" ' .. player(id, 'x') .. ' ' .. player(id, 'y') .. ' 0 64 0 128 255')
		message(id, "You have leveled up to level " .. PLAYERS[id].Level .. "!")
		parse("sv_sound2 " .. id .. " fun/Victory_Fanfare.ogg")
	end
	updateHUD(id)
	return true
end

old Re: created a new one closed

Masea
Super User Off Offline

Quote
user Ryden has written
1
2
3
4
5
if prevlevel ~= PLAYERS[id].Level then
	parse('effect "colorsmoke" ' .. player(id, 'x') .. ' ' .. player(id, 'y') .. ' 0 64 0 128 255')
	message(id, "You have leveled up to level " .. PLAYERS[id].Level .. "!")
	parse("sv_sound2 " .. id .. " fun/Victory_Fanfare.ogg")
end
This place is what you're looking for.

And this is how to make the message shown up for all players in the server:
message(id, "You have leveled up to level " .. PLAYERS[id].Level .. "!")


to:

msg("You have leveled up to level " .. PLAYERS[id].Level .. "!")

old Re: created a new one closed

Ryden
User Off Offline

Quote
1
2
3
4
5
6
7
8
if prevlevel ~= PLAYERS[id].Level then
		parse('effect "colorsmoke" ' .. player(id, 'x') .. ' ' .. player(id, 'y') .. ' 0 64 0 128 255')
		msg("You have leveled up to level " .. PLAYERS[id].Level .. "!")
		parse("sv_sound2 " .. id .. " fun/Victory_Fanfare.ogg")
	end
	updateHUD(id)
	return true
end

This is the code at the end but It says "You are leveled up..." but not for all it's the same as the precedent one,

How to add this like this "(name) is now level..." at the top of the screen for every level ups

old Re: created a new one closed

Masea
Super User Off Offline

Quote
user Ryden has written
How to add this like this "(name) is now level..." at the top of the screen for every level ups
Well, if you want to see at the top of the screen then we should use cs2d cmd hudtxt instead.

That would be something like that:
parse('hudtxt 49 "'..player(id,name)..' has leveled up to '..PLAYERS[id].Level..'!" 320 60 2')

49 is the hudtxt id by the way. It could be used before somewhere else, so check for all(0-49) and see which is the one for you.

And since people can have different resolutions, we gotta use this one as well:
parse("mp_hudscale 2")

This is a basic command. You might want to put it to the very start of the script.

old Re: created a new one closed

Ryden
User Off Offline

Quote
EDIT: Resolved!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function addexp(id, exp)
     PLAYERS[id].Experience = PLAYERS[id].Experience + exp
     local prevlevel = PLAYERS[id].Level
     while PLAYERS[id].Experience >= EXPTABLE[PLAYERS[id].Level+1] do
          PLAYERS[id].Level = PLAYERS[id].Level + 1
     end
     if prevlevel ~= PLAYERS[id].Level then
          parse('effect "colorsmoke" ' .. player(id, 'x') .. ' ' .. player(id, 'y') .. ' 0 64 0 128 255')
          msg(""..player(id,"name").." reached Level "..PLAYERS[id].Level.. "!@C")
          parse("sv_sound2 " .. id .. " fun/Victory_Fanfare.ogg")
     end
     updateHUD(id)
     return true
end
edited 1×, last 06.08.17 04:32:42 pm

old Re: created a new one closed

Ryden
User Off Offline

Quote
Yes but I wanted for other players can see too but,
I think it's not possible

Anyway at least i got the letters in the middle of screen

@user apex2d: thank you
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview