Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2272 273 274338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
Hey guys I need help...at this script.....

1
2
3
4
5
6
7
8
9
10
11
addhook ("join","namewrite")
function namewrite(p)
for v in io.lines("names.txt") do
    if (player(p,"name")~=v) then 
	break 
	end
    local file = assert(io.open("names.txt" , "a"))
    file:write(""..player(p,"name").."\n")
    file:close()
end
end

I have a text file (names.txt) and I want if somebody join and if the name hasn't been already written in text file the computer write it in like in a "Collectnames script".
But my version doesn't work.....
help pls

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
Snake_Eater hat geschrieben
Hey guys I need help...at this script.....

1
2
3
4
5
6
7
8
9
10
11
addhook ("join","namewrite")
function namewrite(p)
for v in io.lines("names.txt") do
    if (player(p,"name")~=v) then 
	break 
	end
    local file = assert(io.open("names.txt" , "a"))
    file:write(""..player(p,"name").."\n")
    file:close()
end
end


I have a text file (names.txt) and I want if somebody join and if the name hasn't been already written in text file the computer write it in like in a "Collectnames script".
But my version doesn't work.....
help pls


i think this should work

1
2
3
4
5
6
7
8
9
10
11
12
addhook ("join","namewrite")
function namewrite(p)
	for v in io.lines("names.txt") do
		if (player(p,"name") == v) then 
			--
		else
  			local file = assert(io.open("names.txt" , "a"))
			file:write(""..player(p,"name").."\n")
			file:close()
		end
	end
end

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook ("join","namewrite")
function namewrite(p)
	local function findline(txt)
		for v in io.lines("names.txt") do
			if v == txt then
				return true
			end
		end
		return false
	end
	
	if not findline(player(p,"name")) then
		local file = assert(io.open("names.txt" , "a"),"ERROR, CANNOT FIND FILE")
		file:write(player(p,"name").."\n")
		file:close()
	end
end

alt .YeaH.

FiiD
User Off Offline

Zitieren
Can any say me what is wrong on this script???

1
2
3
4
5
6
addhook("break","money") 
function money(x,y)
if x==x and y==y then 
	parse("setmoney "..id.." "..player(id,"money")+1000)
    end  
end

I need this script for my new map...

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
FiiD hat geschrieben
addhook("break","money")
function money(x,y)
if x==x and y==y then
parse("setmoney "..id.." "..player(id,"money")+1000)
end
end


Maybe you should type x and y cordinates instead of x and y letters

alt Re: Lua Scripts/Questions/Help

pivot
User Off Offline

Zitieren
Tajifun hat geschrieben
1
2
3
4
5
6
7
8
addhook("say","Adminsay")
function Adminsay(id,txt)
	-- Admin equip A
	if (txt=="!a12345") then
		parse("speedmod "..id.." 20")
		return 1
	end
end

That should work.


The Return 1 don't worked!
1× editiert, zuletzt 04.10.10 20:37:18

alt Re: Lua Scripts/Questions/Help

RyceR
User Off Offline

Zitieren
1
2
3
4
5
6
addhook("say","Adminsay")
function Adminsay(id,txt)
	 if (txt=="!a12345") then
		parse("speedmod "..id.." 20")
	end
end
try this...

alt Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Zitieren
pivot hat geschrieben
Tajifun hat geschrieben
1
2
3
4
5
6
7
8
addhook("say","Adminsay")
function Adminsay(id,txt)
	-- Admin equip A
	if (txt=="!a12345") then
		parse("speedmod "..id.." 20")
		return 1
	end
end

That should work.


The Return 1 don't worked!


do you use another Say Hook function on your scripts? then please dont do that, that wil lfuck up your script completely

you can 0nly use 1 say hook on the whole script

alt Re: Lua Scripts/Questions/Help

Tajifun
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
addhook("break","money")
function money(x,y)
for id=1,32 do
if player(id,"exists") then
if x == NUMBER OF BREAKABLE X and y == NR. OF BRE. Y then
bonusmoney = player(id,"money")+1000
parse("setmoney "..id.." "..bonusmoney.."")
end
end
end
end

Try this.
IDK if it works. :]


@ pivot
let lua check the usgn id!
example:
1
2
3
4
5
6
7
addhook("spawn","Admin")
function Admin(id)
     if player(id,"usgn") == 8529 then -- Change 8529 with your usgn
          parse("speedmod "..id.." 20")
          msg2(id,"You are an Admin!") -- remove this if you want. :D
     end
end

Good Luck :b
1× editiert, zuletzt 05.10.10 16:45:42

alt Re: Lua Scripts/Questions/Help

pivot
User Off Offline

Zitieren
Tajifun hat geschrieben
1
2
3
4
5
6
7
8
9
10
11
addhook("break","money")
function money(x,y)
for id=1,32 do
if player(id,"exists") then
if x == NUMBER OF BREAKABLE X and y == NR. OF BRE. Y then
bonusmoney = player(id,"money")+1000
parse("setmoney "..id.." "..bonusmoney.."")
end
end
end
end

Try this.
IDK if i work. :]


@ pivot
let lua check the usgn id!
example:
1
2
3
4
5
6
7
addhook("spawn","Admin")
function Admin(id)
     if player(id,"usgn") == 8529 then -- Change 8529 with your usgn
          parse("speedmod "..id.." 20")
          msg2(id,"You are an Admin!") -- remove this if you want. :D
     end
end

Good Luck :b


Perfect! Thanks!

alt Re: Lua Scripts/Questions/Help

FiiD
User Off Offline

Zitieren
batlaizys hat geschrieben
FiiD hat geschrieben
addhook("break","money")
function money(x,y)
if x==x and y==y then
parse("setmoney "..id.." "..player(id,"money")+1000)
end
end


Maybe you should type x and y cordinates instead of x and y letters


No sorry...it dont works...

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
shuft hat geschrieben
how i fade a weapon if its spawned ( spawned i mean with parse("spawnitem bla bla")...
plz help


Instead of using parse use this function:

1
2
3
4
5
6
7
8
9
10
11
function spawnitem(id,x,y)--This one
	parse("spawnitem "..id.." "..x.." "..y)
	local a = item(0,"table")
	a = a[#a]
	timer(tonumber(game("mp_weaponfadeout"))*1000,"parse","removeitem "..a,1)
end

addhook("collect","_collect")
function _collect(id,iid)
	freetimer("parse","removeitem "..iid)
end

alt Re: Lua Scripts/Questions/Help

Tajifun
User Off Offline

Zitieren
@ FiiD

How I already said:
Try this

1
2
3
4
5
6
7
8
9
10
11
addhook("break","money")
function money(x,y)
for id=1,32 do
if player(id,"exists") then
if x == BREAKABLE X and y == BREAKABLE Y then -- Fill in the posistion of the breakable
bonusmoney = player(id,"money")+1000
parse("setmoney "..id.." "..bonusmoney.."")
end
end
end
end

If you brea the wall at x == your breakable X and y = your breakable Y you will get 1000$.

alt Re: Lua Scripts/Questions/Help

Blacko
User Off Offline

Zitieren
Hello, I need help please ! I have RP server, but the server don't save money and license ... I test many script for save, but nobody run ... Please help me !
I hope you answer me !
Thanks you all ...
Zum Anfang Vorherige 1 2272 273 274338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht