English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 272 273 274 ... 338 339 Next To the start
04.10.10 06:44:54 pm
Up
Snake_Eater
User
Offline Off
Hey guys I need help...at this script.....

Code:
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
[Death Note]
04.10.10 06:58:00 pm
Up
HaRe
User
Offline Off
Snake_Eater has written:
Hey guys I need help...at this script.....

Code:
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

Code:
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
w0w im so eXotiK
04.10.10 07:03:35 pm
Up
Flacko
User
Offline Off
do you realize that your code will write the name of the player for every line in the file?
04.10.10 07:05:00 pm
Up
Snake_Eater
User
Offline Off
Can you help me Flacko?
[Death Note]
04.10.10 07:31:01 pm
Up
Flacko
User
Offline Off
Code:
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
04.10.10 07:35:07 pm
Up
Snake_Eater
User
Offline Off
Oh thx you're the best Flacko

thxcookie
[Death Note]
04.10.10 08:10:09 pm
Up
FiiD
User
Offline Off
Can any say me what is wrong on this script???

Code:
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...
04.10.10 08:24:54 pm
Up
Rainoth
Moderator
Offline Off
FiiD has written:
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
04.10.10 08:26:39 pm
Up
pivot
User
Offline Off
Tajifun has written:
Code:
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!
edited 1×, last 04.10.10 08:37:18 pm
04.10.10 09:24:55 pm
Up
RyceR
User
Offline Off
Code:
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...
IMG:http://img704.imageshack.us/img704/4043/userbargimp.png
04.10.10 09:41:29 pm
Up
HaRe
User
Offline Off
pivot has written:
Tajifun has written:
Code:
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
w0w im so eXotiK
04.10.10 09:51:00 pm
Up
Tajifun
User
Offline Off
Code:
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:
Code:
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
edited 1×, last 05.10.10 04:45:42 pm
Tajifun yay.
04.10.10 10:08:14 pm
Up
pivot
User
Offline Off
Tajifun has written:
Code:
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:
Code:
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!
04.10.10 10:45:20 pm
Up
FiiD
User
Offline Off
batlaizys has written:
FiiD has written:
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...
05.10.10 01:21:06 am
Up
TDShuft
User
Offline Off
how i fade a weapon if its spawned ( spawned i mean with parse("spawnitem bla bla")...
plz help
Sorry , I can't be Perfect !
05.10.10 08:38:15 am
Up
Flacko
User
Offline Off
shuft has written:
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:

Code:
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
05.10.10 10:41:42 am
Up
SDKey
User
Offline Off
Sorry,
How to spawn nps with health?
05.10.10 11:09:14 am
Up
Vectarrio
User
Offline Off
SDKey has written:
Sorry,
How to spawn nps with health?

With env_NPC entities in the map, cs2d cmd spawnnpc spawns NPCs with default health
05.10.10 04:50:20 pm
Up
Tajifun
User
Offline Off
@ FiiD

How I already said:
Try this

Code:
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$.
Tajifun yay.
05.10.10 07:52:25 pm
Up
Blacko
User
Offline Off
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 ...
IMG:http://www.web-modules.net/upload/cache/userbar/123/452.gif
IMG:http://www.web-modules.net/upload/cache/userbar/124/277.gif
To the start Previous 1 2 ... 272 273 274 ... 338 339 Next To the start