Forum

> > CS2D > Scripts > Weapon Money Reward
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Weapon Money Reward

1 Antwort
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Weapon Money Reward

JohnLOL
User Off Offline

Zitieren
Here we go...

Ok, a simple request..
I looking for a script that you can edit the Money Reward for a kill made with certain Weapon(ID)...

Example: In CSGO, when you kill a enemy with a MP5, you are rewarded in 600 credits instead of 300, like its in CS2D, or When you make a kill with AWP you receive 100 instead of 300, you know what i mean?

Objective: Make a Script that you can edit, and choose its money reward for EVERY Weapon ID...

For Pistols, SMGS, Shotguns, Rifles, Explosives (Except the TR Bomb) and Heavy Weapons...

PS: I do not want the weapons make a dead enemy drop money, i think i made my point clear...

Sorry for my english

alt Re: Weapon Money Reward

Mami Tomoe
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
local weaponTypes = {
	[1] = { kill = 400, assist = 300 }, -- Bonus for assists, will reward them too.
	[2] = { assist = 30 }, -- No kill will default to $300 (default)!
	[45] = { kill = 100 } -- No assist will default to no reward!
}


function kill_hook(killer, victim, weapon, x, y, obj, assistant)
	local weaponType = weaponTypes[weapon]
	
	if not weaponType or type(weaponType) ~= 'table' then
		-- No need for extra calculations.
		
		return
	end
	
	local player = _G.player -- Can be removed, will probably make no difference.
	
	if not player(killer, 'exists') then
		-- I don't trust CS2D, enough said.
		
		return
	end
	
	if player(killer, 'team') == player(victim,  'team') and game('sv_gamemode') ~= '1' then
		-- Checking if team kill, can be removed if not needed.
		
		return
	end
	
	
	-- Kill calculations:
	local amountKill = weaponType.kill
	
	if amountKill then
		parse('setmoney ' .. killer .. ' ' .. player(killer, 'money') + amountKill - 300) -- Removing $300 because it's automated by CS2D.
	end
	
	-- Assist calculations:
	local amountAssist = weaponType.assist
	
	if amountAssist and player(assistant, 'exists') then
		parse('setmoney ' .. assistant .. ' ' .. player(assistant, 'money') + amountAssist)
	end
end

addhook('kill', 'kill_hook')

• Here you go pal, took me like 30 minutes to create.
• I hope the comments help you to somewhat understand how to use it, if you don't, just know that the only thing you need to edit is the table at the top!
> Make sure they're both in the same file as the table is local and not global too!
> The numbers inside the brackets are used for item IDs!
∗ Mami Tomoe is best girl!
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht