Forum

> > CS2D > Scripts > [solved] Money Score on spawn LUA
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch [solved] Money Score on spawn LUA

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt [solved] Money Score on spawn LUA

olieo
User Off Offline

Zitieren
So i'm modifying a script i've found to display who has the most money whenever you spawn and basically i have no idea what i'm doing. Getting an error saying "} expected near yourmon".

here's the script to display the leader:

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
addhook('spawn','moneyking')
function moneyking(id)
t=return_largest_value({yourmon[1],yourmon[2],yourmon[3],yourmon[4],yourmon[5],yourmon[6],yourmon[7],yourmon[8],yourmon[9],yourmon[10],yourmon[11],yourmon[12],yourmon[13],yourmon[14],yourmon[15],yourmon[16]yourmon[17],yourmon[18],yourmon[19],yourmon[20],yourmon[21],yourmon[22],yourmon[23],yourmon[24],yourmon[25],yourmon[26],yourmon[27],yourmon[28],yourmon[29],yourmon[30],yourmon[31],yourmon[32]})
if t==0 then return 0 end
if t==yourmon[1] then msg2(id,"©000200255  Player with the most money:: "..player(1,"name").."  -  Money: "..return_largest_value({yourmon[1]}).."") end
if t==yourmon[2] then msg2(id,"©000200255  Player with the most money:: "..player(2,"name").."  - Money: "..return_largest_value({yourmon[2]}).."") end
if t==yourmon[3] then msg2(id,"©000200255  Player with the most money:: "..player(3,"name").."  - Money: "..return_largest_value({yourmon[3]}).."") end
if t==yourmon[4] then msg2(id,"©000200255  Player with the most money:: "..player(4,"name").."  - Money: "..return_largest_value({yourmon[4]}).."") end
if t==yourmon[5] then msg2(id,"©000200255  Player with the most money:: "..player(5,"name").."  - Money: "..return_largest_value({yourmon[5]}).."") end
if t==yourmon[6] then msg2(id,"©000200255  Player with the most money:: "..player(6,"name").."  - Money: "..return_largest_value({yourmon[6]}).."") end
if t==yourmon[7] then msg2(id,"©000200255  Player with the most money:: "..player(7,"name").."  - Money: "..return_largest_value({yourmon[7]}).."") end
if t==yourmon[8] then msg2(id,"©000200255  Player with the most money:: "..player(8,"name").."  - Money: "..return_largest_value({yourmon[8]}).."") end
if t==yourmon[9] then msg2(id,"©000200255  Player with the most money:: "..player(9,"name").."  - Money: "..return_largest_value({yourmon[9]}).."") end
if t==yourmon[10] then msg2(id,"©000200255  Player with the most money:: "..player(10,"name").."  - Money: "..return_largest_value({yourmon[10]}).."") end
if t==yourmon[11] then msg2(id,"©000200255  Player with the most money:: "..player(11,"name").."  - Money: "..return_largest_value({yourmon[11]}).."") end
if t==yourmon[12] then msg2(id,"©000200255  Player with the most money:: "..player(12,"name").."  - Money: "..return_largest_value({yourmon[12]}).."") end
if t==yourmon[13] then msg2(id,"©000200255  Player with the most money:: "..player(13,"name").."  - Money: "..return_largest_value({yourmon[13]}).."") end
if t==yourmon[14] then msg2(id,"©000200255  Player with the most money:: "..player(14,"name").."  - Money: "..return_largest_value({yourmon[14]}).."") end
if t==yourmon[15] then msg2(id,"©000200255  Player with the most money:: "..player(15,"name").."  - Money: "..return_largest_value({yourmon[15]}).."") end
if t==yourmon[16] then msg2(id,"©000200255  Player with the most money:: "..player(16,"name").."  - Money: "..return_largest_value({yourmon[16]}).."") end
if t==yourmon[17] then msg2(id,"©000200255  Player with the most money:: "..player(17,"name").."  -  Money: "..return_largest_value({yourmon[17]}).."") end
if t==yourmon[18] then msg2(id,"©000200255  Player with the most money:: "..player(18,"name").."  - Money: "..return_largest_value({yourmon[18]}).."") end
if t==yourmon[19] then msg2(id,"©000200255  Player with the most money:: "..player(19,"name").."  - Money: "..return_largest_value({yourmon[19]}).."") end
if t==yourmon[20] then msg2(id,"©000200255  Player with the most money:: "..player(20,"name").."  - Money: "..return_largest_value({yourmon[20]}).."") end
if t==yourmon[21] then msg2(id,"©000200255  Player with the most money:: "..player(21,"name").."  - Money: "..return_largest_value({yourmon[21]}).."") end
if t==yourmon[22] then msg2(id,"©000200255  Player with the most money:: "..player(22,"name").."  - Money: "..return_largest_value({yourmon[22]}).."") end
if t==yourmon[23] then msg2(id,"©000200255  Player with the most money:: "..player(23,"name").."  - Money: "..return_largest_value({yourmon[23]}).."") end
if t==yourmon[24] then msg2(id,"©000200255  Player with the most money:: "..player(24,"name").."  - Money: "..return_largest_value({yourmon[24]}).."") end
if t==yourmon[25] then msg2(id,"©000200255  Player with the most money:: "..player(25,"name").."  - Money: "..return_largest_value({yourmon[25]}).."") end
if t==yourmon[26] then msg2(id,"©000200255  Player with the most money:: "..player(26,"name").."  - Money: "..return_largest_value({yourmon[26]}).."") end
if t==yourmon[27] then msg2(id,"©000200255  Player with the most money:: "..player(27,"name").."  - Money: "..return_largest_value({yourmon[27]}).."") end
if t==yourmon[28] then msg2(id,"©000200255  Player with the most money:: "..player(28,"name").."  - Money: "..return_largest_value({yourmon[28]}).."") end
if t==yourmon[29] then msg2(id,"©000200255  Player with the most money:: "..player(29,"name").."  - Money: "..return_largest_value({yourmon[29]}).."") end
if t==yourmon[30] then msg2(id,"©000200255  Player with the most money:: "..player(30,"name").."  - Money: "..return_largest_value({yourmon[30]}).."") end
if t==yourmon[31] then msg2(id,"©000200255  Player with the most money:: "..player(31,"name").."  - Money: "..return_largest_value({yourmon[31]}).."") end
if t==yourmon[32] then msg2(id,"©000200255  Player with the most money:: "..player(32,"name").."  - Money: "..return_largest_value({yourmon[32]}).."") end
end

Here's the script for the whole of the money system (i'm also getting an error on line 80 for this but it doesn't seem to be effecting anything)

Spoiler >
1× editiert, zuletzt 17.05.15 12:55:12

alt Re: [solved] Money Score on spawn LUA

Rainoth
Moderator Off Offline

Zitieren
1
yourmon[16]yourmon[17]
A comma.
1
2
3
4
5
6
7
8
9
local moni = 0
local aid = 0
for k,v in pairs (player(0,"table")) do
	if yourmon[v] > moni then
		moni = yourmon[v]
		aid = v
	end
end
msg(player(aid,"name").." has many moniez!")

Quick code so you could replace that eye cancer you posted. Please use more tag that says "Prepare to go blind" or something similar.

alt Re: [solved] Money Score on spawn LUA

olieo
User Off Offline

Zitieren
@user Rainoth: if yourmon[v] > moni then "Attempt to compare number with nil"

Well i got the other script working, thanks for spotting the dumb mistake

Eye cancer it is indeed.
1× editiert, zuletzt 13.05.15 23:21:19

alt Re: [solved] Money Score on spawn LUA

Rainoth
Moderator Off Offline

Zitieren
yourmon is nil and that's not my variable. It's yours. I don't know how that variable is set up and I won't stay to find out. I just gave you a method to do what you need without writing 40 lines of code.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht