English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 212 213 214 ... 338 339 Next To the start
26.06.10 09:50:35 pm
Up
Cliffe_Snake
User
Offline Off
How to use image in Cutomkill comand? I want to draw own weapon_k in death_notice. Who knows?
26.06.10 09:55:46 pm
Up
TheKingOfP90
User
Offline Off
Hello! I have a problem: io.open function doesn't want to open my .txt file. How do I fix it?
The thing is - I want to save data for this USGN number in a separate file. I use io.open with parameter "w", and then with "r", but even when I choose to read numbers only, it still doesn't want to read it. What do I do? Or is there any tutorial for this?
26.06.10 10:00:04 pm
Up
Flacko
User
Offline Off
Code:
1
2
3
4
5
6
a = io.open("file.txt","w")
a:write("asd")
a:close()
a = io.open("file.txt","r")
text = a:read("l")
if text=="asd" then print("success")
26.06.10 10:16:26 pm
Up
TheKingOfP90
User
Offline Off
Thanks! And what about reading the variable in this file and setting the variable in script to the one in file? I may be not too understandable

EDIT:
Code:
1
2
3
4
5
6
a = io.open("sys/lua/data/file.txt","w")
a:write("asd")
a:close()
a = io.open("file.txt","r")
text = a:read("l")
variable[id]=text
26.06.10 10:51:19 pm
Up
Flacko
User
Offline Off
If you expect a number value then you would have to tonumber() your result because the FILE:read() function returns strings, unless you call it with the parameter "*n"

Code:
1
2
3
4
5
6
file = io.open("5.txt","w")
file:write(player(5,"money"))
file:close()
file = io.open("5.txt","r") -- Reopen the file for reading
parse("setmoney 5 " .. (file:read("*n")) )--Read the number
file:close()
26.06.10 11:31:48 pm
Up
Snake_Eater
User
Offline Off
Hi all! I want if I shoot somebody with deagle that this player teleports AND SPAWN again and again at a special place.For example at x=2160 y=784.
CAN ANYBODY SHOW ME A SCRIPT LIKE THIS PLS PLS??
I am repeating me but there is no answer
PLS answer me and help
ty if you know and tell it me
[Death Note]
26.06.10 11:36:05 pm
Up
archmage
User
Offline Off
Code:
1
2
3
4
addhook("hit", "hit_")
function hit_ (id,source,weapon,hpdmg,apdmg)
     parse("spawnplayer "..id.." 2160 784")
end
We must secure the existence of our people and a future for white children. 14/88
26.06.10 11:41:03 pm
Up
Cure Pikachu
User
Offline Off
I'll fix up the first part.
Code:
1
2
3
4
5
6
addhook("hit","tele")
function tele(id,source,weapon)
     if (weapon==3) then
          parse("spawnplayer "..id.." 2160 784")
     end
end

The part about teleporting at the same spot after getting hit, I have no idea.
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
26.06.10 11:48:38 pm
Up
Snake_Eater
User
Offline Off
THX BUT THERE IS A PROBLEM.I want that this player spawn there again and again
[Death Note]
Up
Cliffe_Snake
User
Offline Off
Snake_Eater, try this
Code:
1
2
3
4
5
6
addhook("kill","NoWhereToRun")
function NoWhereToRun(killer,victim,weapon,x,y)     
     if (weapon==3) then
          parse("spawnplayer "..victim.." "..x.." "..y)
     end
end

Why forum trims blanks and tabs in my code???
27.06.10 04:27:51 am
Up
Cure Pikachu
User
Offline Off
I wonder if that's gonna work...
And the forum doesn't trim your tabs and blanks. Did you tab them well in here?
IMG:https://i.imgur.com/uUrye71.png
IMG:https://i.imgur.com/xpsyQRX.png
27.06.10 04:47:26 am
Up
archmage
User
Offline Off
@SnakeEater
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
array = {}
addhook("kill","NoWhereToRun")
addhook("move", "m")
function NoWhereToRun(killer,victim,weapon,x,y)     
if (weapon==3) then
parse("spawnplayer "..victim.." 2160 784")
array[victim] = 1
end
end

function m (id)
     if ( array[id] ~= nil and array[id] == 1 ) then
          parse("spawnplayer "..victim.." 2160 784")
     elseif ( array[id] = nil ) then
          array[id] = 0
     end
end
We must secure the existence of our people and a future for white children. 14/88
27.06.10 11:02:51 am
Up
Snake_Eater
User
Offline Off
There is an error @Dark byte i think
my console says :Lua Error: sys/lua/1.lua:14:')' expected near '='
[Death Note]
27.06.10 11:24:14 am
Up
YellowBanana
BANNED
Offline Off
insert an = before nil at line 14 then..
27.06.10 11:42:09 am
Up
Snake_Eater
User
Offline Off
I dont get it
I am a noob in scripting
so I need a full script
[Death Note]
27.06.10 11:45:38 am
Up
DRoNe
User
Offline Off
@SnakeEater

Code:
1
2
elseif ( array[id] == nil ) then
...


put this to line 14

in IF,ELSEIF
=×
==√
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
27.06.10 11:56:16 am
Up
Snake_Eater
User
Offline Off
OMFG A NEW PROBLEM: I NEED A PRISON SCRIPT BUT THEY CAN USE CMD:"kill" SO THEY ARE FREE AGAIN
[Death Note]
27.06.10 03:04:23 pm
Up
martis67
User
Offline Off
i think thats a stupid question but how create lua script?
Learning lua
27.06.10 04:01:07 pm
Up
DRoNe
User
Offline Off
@martis67

yeah very
read sys/lua/info.txt and look to sys/lua/samples/...
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
27.06.10 04:05:42 pm
Up
Szkieletor
User
Offline Off
martis67 has written:
i think thats a stupid question but how create lua script?

Create a text file, then Save as... Name.lua
Name can be anything you want. You also have to learn scripting, DRoNe already said where to look.
To the start Previous 1 2 ... 212 213 214 ... 338 339 Next To the start