Forum

> > CS2D > Scripts > AMX2D Command Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English AMX2D Command Help

10 replies
To the start Previous 1 Next To the start

old AMX2D Command Help

ULtiMa
User Off Offline

Quote
Hey guys.. i have a amx2d and i want it with !resetscore which the original doesnt have and i coded it with lua and the console doesnt show any errors.. so is this code correct?

Spoiler >


P.S : I edited the !resetscore
P.S2: I shows "The Command !resetscore doesnt exist..

old Re: AMX2D Command Help

Admir
User Off Offline

Quote
1
2
3
4
5
function act_resetscore(p, typ, cmd)
	parse("setscore "..id 0)     
	parse("setdeath "..id 0)
	msg(sv.source_clr, player(p, "name") .. " use !resetscore")
end

old Re: AMX2D Command Help

Surplus
User Off Offline

Quote
and try to use correct words
1
msg(sv.source_clr, player(p, "name") .. " used !resetscore")


"useD" not "use"

old try this :p

Dovahkin
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("say", "sayfunction")

function sayfunction(id, txt)
if(txt=="!resetscore") then
parse("setscore "..id.." 0")
parse("setdeaths "..id.." 0")
msg("You have RESETED SCORE")
return 1
end
end


>ill think it will work

old Re: AMX2D Command Help

Lee
Moderator Off Offline

Quote
1
2
3
4
5
6
function act_resetscore(id, typ, cmd)
	local fmt = "%s %s 0"
	parse(fmt:format("setscore",id))
	parse(fmt:format("setdeaths",id))
	msg(sv.source_clr, player(p, "name") .. " used !resetscore") -- assuming sv.source_clr is a valid color
end

or in spirit of the original

1
2
3
4
5
function act_resetscore(id, typ, cmd)
	parse("setscore "..id.." 0")
	parse("setdeaths "..id.." 0")
	msg(sv.source_clr, player(p, "name") .. " used !resetscore")
end
edited 1×, last 29.03.11 03:45:24 pm

old Re: AMX2D Command Help

Lee
Moderator Off Offline

Quote
oops, my bad, change p to id

1
2
3
4
5
function act_resetscore(id, typ, cmd)
	parse("setscore "..id.." 0")
	parse("setdeaths "..id.." 0")
	msg(sv.source_clr, player(id, "name") .. " used !resetscore")
end

Also ensure that sv.source_clr is a valid identifier
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview