Forum

> > CS2D > Scripts > This script isn't work! :(
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch This script isn't work! :(

7 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt This script isn't work! :(

HedShot
User Off Offline

Zitieren
Hi all!

I want to create this script, but it doesn't work!
Help me PLS!

1
2
3
4
5
6
7
8
addhook("say","bsay")
addhook("sayteam","bsay")
function bsay(id,msgg)
	if (string.sub(msgg,1,10)=="!explosion" and player(id,"usgn")=="116544") then
		range = string.sub(msgg,12,100)
		parse("explosion "..player(id,"x").." "..player(id,"y").." "..range)
	end
end

alt Re: This script isn't work! :(

VADemon
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("say","bsay")
addhook("sayteam","bsay")
function bsay(id,msgg)
	if (string.sub(msgg,1,10)=="!explosion" and player(id,"usgn")=="116544") then
		local range = string.sub(msgg,12) --is gonna go until the end of the string
		-- also make it a local variable

		local dmg = 32 --damage of explosion

		-- also you failed at parameters of the explosion command:
		parse("explosion "..player(id,"x").." "..player(id,"y").." "..range.." "..dmg.." "..id)
	end
end

cs2d cmd explosion

alt Re: This script isn't work! :(

DarkBooy
User Off Offline

Zitieren
user VADemon hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("say","bsay")
addhook("sayteam","bsay")
function bsay(id,msgg)
	if (string.sub(msgg,1,10)=="!explosion" and player(id,"usgn")=="116544") then
		local range = string.sub(msgg,12) --is gonna go until the end of the string
		-- also make it a local variable

		local dmg = 32 --damage of explosion

		-- also you failed at parameters of the explosion command:
		parse("explosion "..player(id,"x").." "..player(id,"y").." "..range.." "..dmg.." "..id)
	end
end

cs2d cmd explosion



i try your code but... its not work ..

@user HedShot: this work (just say !explosion)
1
2
3
4
5
6
7
8
9
10
11
addhook("say","bsay")
addhook("sayteam","bsay")
function bsay(id,msgg)
	if (player(id,"usgn")==116544) then
     if string.sub(msgg,1,10)=="!explosion" then
          local range = string.sub(msgg,12) 
          local dmg = 32        
          parse("explosion "..player(id,"x").." "..player(id,"y").." "..range.." "..dmg.." "..id)
     end
     end
end

or ...

take this : (just say !e dmg)
This Code Is better >
5× editiert, zuletzt 29.03.13 15:46:15

alt Re: This script isn't work! :(

omg
User Off Offline

Zitieren
seriously? im no genius, but im pretty sure string:sub(2,2) is always an empty string or out of bounds. nice try, dark

alt Re: This script isn't work! :(

Infinite Rain
Reviewer Off Offline

Zitieren
1
2
3
4
5
6
7
8
addhook("say","bsay")
addhook("sayteam","bsay")
function bsay(id,msgg)
     if (string.sub(msgg,1,10)=="!explosion" and player(id,"usgn")==116544) then
          range = string.sub(msgg,12)
          parse("explosion "..player(id,"x").." "..player(id,"y").." "..range.." 32 ".. id)
     end
end

Here you go, you had 2 mistakes:
1. player(id,"usgn")=="116544" - Wrong because player(id, 'usgn') will return the numeric(!) value.
2. range = string.sub(msgg,12,100) - You just need to do it like so: string.sub(msgg,12)
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht