Forum

> > CS2D > Scripts > give your points to other player, points system
Forums overviewCS2D overview Scripts overviewLog in to reply

English give your points to other player, points system

9 replies
To the start Previous 1 Next To the start

old give your points to other player, points system

KagamineLen
User Off Offline

Quote
hello, i want to have help making my points system with save system, but i can't add this fucntions

• sent your points to another player

anyway i forgot the error but here is my script

More >


is there a way to improve this script
i want to add

• @givepoints
• @setpoints

everytime i try to make this scripts i always go error. so i really need your help guys.
edited 5×, last 06.03.13 07:45:56 pm

old Re: give your points to other player, points system

Gajos
BANNED Off Offline

Quote
ADD IT TO YOUR SCRIPT:
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--=======================--
--== Gajos PL (108942) ==--
--=======================--

Admins = {108942}

--=======================--

c = string.char(169)
point = {}

point.initArray = function(value)
	local array = {}
	for _ = 1,32 do
		array[_] = value
	end
	return array
end

point.ToTable = function(t,match)
	local cmd = {};
	if not match then match = "[^%s]+" end
	for word in string.gmatch(t,match) do
		table.insert(cmd,word)
	end
	return cmd
end

point.bug = function(id,txt)
	msg2(id,c.."200000000Unknown command: "..c.."000255255"..txt)
end

point.noadm = function(id)
	msg2(id,c.."200000000You don't have enough level to do this!")
end

point.noe = function(id)
	msg2(id,c.."200000000This player doesn't exist!")
end

point.isAdmin = function(id)
	for _, i in pairs(Admins) do
		if player(id,"usgn") == i then
			return true
		end
	end
	return false
end

addhook("say","point.say")
point.say = function(id,txt)
	local p = point.ToTable(txt)
	local cmd = string.lower(p[1])
	if txt:sub(1,1) == "@" and txt ~= "rank" then
		if cmd == "@setpoints" then
			if point.isAdmin then
				local pl = tonumber(p[2])
				local points = tonumber(p[3])
				if pl ~= nil and points ~= nil then
					if player(pl,"exists") then
						killpt[id] = points
					else
						noe(id)
					end
				else
					msg2(id,c.."200000000Correct syntax: @setpoints <id> <points>")
				end
			else
				point.noadm(id)
			end
		elseif cmd == "@givepoints" then
			if point.isAdmin then
				local pl = tonumber(p[2])
				local points = tonumber(p[3])
				if pl ~= nil and points ~= nil then
					if player(pl,"exists") then
						killpt[id] = killpt[id] + points
					else
						noe(id)
					end
				else
					msg2(id,c.."200000000Correct syntax: @givepoints <id> <points>")
				end
			else
				point.noadm(id)
			end
		else
			point.bug(id,txt)
		end
		return 1
	end
end

old Re: give your points to other player, points system

Dousea
User Off Offline

Quote
Didn't tested, maybe works.
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
function totable(t,match)
	local cmd = {}
	if not match then match = "[^%s]+" end
	for word in string.gmatch(t, match) do
		table.insert(cmd, word)
	end 
	return cmd 
end

addhook("say","_say")
function _say(id,txt)
	local parse, pl, pt = totable(txt), tonumber(parse[2]), tonumber(parse[3])
	if string.sub(txt, 1, 10) == "@setpoints" then
		if pl ~= nil and pt ~= nil then
			if player(pl,"exists") then
				if player(pl,"health") > 0 then
					killpt[pl] = pt
				else
					msg2(id,string.char(169).."255000000"..player(pl,"name").." is dead")
				end
			else
				msg2(id,string.char(169).."255000000Player with ID "..pl.." doesn't exist")
			end
		else
			msg2(id,string.char(169).."255000000Command doesn't have right parameters ( @setpoints <id> <points> )")
		end
	elseif string.sub(txt, 1, 11) == "@givepoints" then
		if pl ~= nil and pt ~= nil then
			if player(pl,"exists") then
				if player(pl,"health") > 0 then
					if killpt[id] >= pt then
						killpt[id] = killpt[id] - pt
						killpt[pl] = killpt[pl] + pt
					else
						msg2(id,string.char(169).."255000000You doesn't have more than "..pt.." Kill Points")
					end
				else
					msg2(id,string.char(169).."255000000"..player(pl,"name").." is dead")
				end
			else
				msg2(id,string.char(169).."255000000Player with ID "..pl.." doesn't exist")
			end
		else
			msg2(id,string.char(169).."255000000Command doesn't have right parameters ( @givepoints <id> <points> )")
		end
	end
end

@user KagamineLen: Well just wrong name.
edited 1×, last 07.03.13 03:22:39 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview