English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 266 267 268 ... 338 339 Next To the start
26.09.10 09:29:55 pm
Up
SkullFace
User
Offline Off
thanks hare now i dont know how to do when player kills somebody and gets only 10 $ not 300 $
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
26.09.10 10:07:02 pm
Up
HaRe
User
Offline Off
i have an problem with this script
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook("projectile","throwsnowball") function throwsnowball(id,wpn,x,y)
     if wpn==75 then
          parse("spawnitem "..wpn.." "..(x/32).." "..(y/32))
          parse("equip "..id.." 50")
          parse("strip "..id.." 75")
          parse("setweapon "..id.." 50")
          hassnowball=0
     end
end

addhook("ms100","checksnowball") function checksnowball()
     if hassnowball==0 then
          if (item(75,"exists")) then
               --
          else
               parse("equip "..id.." "..math.random(1,game("sv_maxplayers"))
               parse("strip "..id.." 50")
               parse("setweapon "..id.." 75")
               hassnowball=1
          end
     end
end


i want if you throw an snow ball on the wall it dosent spawns there it spawns in the arena
w0w im so eXotiK
27.09.10 04:46:20 am
Up
MasterAsp
User
Offline Off
And question towards others, how can I get a screen x y position of a person on my screen? @Hare, second hook is redundant, as you could just give 10 snowballs when the person spawns, and whenever someone throws a snowball, just equip them. So, besides that, I don't exactly get what your saying, but, if you want it to spawn where the person threw it, just change x/32 and y/32 to player(id,"x")/32 and player(id,"y")/32.
27.09.10 01:06:55 pm
Up
RyceR
User
Offline Off
@Burex try this:
Code:
1
2
3
4
addhook("kill","no_money")
function no_money(id)
     parse("setmoney "..id.." "..(player(id,"money")-290))
end
IMG:http://img704.imageshack.us/img704/4043/userbargimp.png
27.09.10 02:55:33 pm
Up
Surplus
User
Offline Off
iDios has written:
Lol, I don't understand tiiger87, you want make a deal ?!
And i have my RP lua, i just want the save !
What is your pseudo in game ?
...


its like wfws one, only with different design
and i didnt copy it
And yes, i want to make a deal

cookie lololol COOKIES! cookie
27.09.10 03:41:32 pm
Up
GreenDevil
User
Offline Off
I don't get it, i getting an error.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
team1 = 0
addhook("second","on")
function on(id,)
if (team1=1) then
msg(id,"hello world!")
end
end

addhook("say","makeon")
function makeon(id,txt)
if (txt=="!hello") then
team1 = 1
end
end
27.09.10 03:43:54 pm
Up
DRoNe
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
team1 = 0
addhook("second","on")
function on()
     if (team1==1) then
          msg("hello world!") -- for msg that see it one player: msg2(id,"hello world!")
     end
end

addhook("say","makeon")
function makeon(id,txt)
     if (txt=="!hello") then
          team1 = 1
     end
end


in if you must use only: ==, >=, <=, ~=
edited 1×, last 27.09.10 03:53:38 pm
IMG:http://img39.imageshack.us/img39/567/drnatimg.png
27.09.10 03:49:34 pm
Up
GreenDevil
User
Offline Off
thanks much!
27.09.10 04:57:12 pm
Up
SkullFace
User
Offline Off
my god ! what have i done here wrong now ?
Code:
1
2
3
4
5
6
7
if (x == 35 and y == 13) then
          local money = player(id,"money")
             if money>999 then
          parse("setmoney "..id.." "..(player(id,"money") - 1000))
          end
     end
end

doors open even if i didnt had 1000 $ money ...
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
27.09.10 05:06:05 pm
Up
Yasday
User
Offline Off
Code:
1
2
3
4
5
if (player(id,'tilex') == 35 and player(id,'tiley') == 13) then
     if player(id,"money")>=1000 then
          parse("setmoney "..id.." "..(player(id,"money") - 1000))
     end
end


think this should work
27.09.10 05:35:35 pm
Up
Blacko
User
Offline Off
Ok so you can make me the script ?
IMG:http://www.web-modules.net/upload/cache/userbar/123/452.gif
IMG:http://www.web-modules.net/upload/cache/userbar/124/277.gif
27.09.10 05:44:47 pm
Up
Caelenn
User
Offline Off
I have got a question.When I write a word,I want do make
a colored word.For example:
msg2(id,"©160160255Current Class: Infantry")
there is a number how can i know the color of this number in text?
IMG:http://img233.imageshack.us/img233/4059/buttonvrf.jpg
27.09.10 07:03:06 pm
Up
HaRe
User
Offline Off
Nelight has written:
I have got a question.When I write a word,I want do make
a colored word.For example:
msg2(id,"©160160255Current Class: Infantry")
there is a number how can i know the color of this number in text?


map editor -> Create an msg -> Change color ->
RED = First 000
GREEN = Secound 000
BLUE = Third 000

so theres 9 numbers

if you want it to be green then do this

Code:
1
000255000


Red is the first and has no color to mix with
Green is the secound which is 255, 255 = the max value of the colours so it will be fully green
As in the red the Blue has no color to mix with since we wanted to have an green color
w0w im so eXotiK
27.09.10 07:08:28 pm
Up
SkullFace
User
Offline Off
@Yasday
doesnt work ...

pic 1.
IMG:http://i51.tinypic.com/ivg22v.jpg

~~~
pic 2.
IMG:http://i55.tinypic.com/2j5bggh.jpg
IMG:https://i.imgur.com/kZBVkjM.gif
P.S. - I've been extracting recently enviromental sound files from other games, if anyone is interested in them for adding them to their maps, scripts, PM me
27.09.10 07:10:47 pm
Up
HaRe
User
Offline Off
BureX has written:
@Yasday
doesnt work ...

pic 1.
IMG:http://i51.tinypic.com/ivg22v.jpg

~~~
pic 2.
IMG:http://i55.tinypic.com/2j5bggh.jpg


omg

Code:
1
2
3
4
5
6
if (x == 35 and y == 13) then
     if (player(id,"money")>999) then
          parse("setmoney "..id.." "..(player(id,"money") - 1000))
          end
     end
end
w0w im so eXotiK
27.09.10 07:45:18 pm
Up
TimeQuesT
User
Offline Off
... you forgott that you don't have to trigger the door in the editor. Trigger it via lua :

Code:
1
parse ("trigger nameofdoor")
Muh
27.09.10 08:08:16 pm
Up
Deatherr
User
Offline Off
I'm trying to make a script that you kill a zombie (NPC) and you get money (300), but its doesn't work..

Code:
1
2
3
4
addhook("objectkill","npcmoney")
function npcmoney(id,player)
     parse("setmoney "..id.." "..(player(id,"money")+300))
end
Map making has become complex...
27.09.10 10:38:13 pm
Up
J4x
User
Offline Off
Help me with this, i make this lua and it suppose that when i press f2 a image should appear, but nothing happens..



Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
addhook("serveraction","spawn5")
function spawn5(id,action)
if act == 1 then
freeimage(id)
id1=image("gfx/light.bmp",1,1,200+id)
imagescale(id1,1,1)
imageblend(id,1)                                        
imagealpha(id,0.5)
if (player(id,"team") == 2) then
imagecolor(id1,255,255,255)
elseif (player(id,"team") == 1) then
imagecolor(id1,255,255,255)
end
end
end

addhook("buy","spawn2")
function spawn2(id,weapon)
if weapon ==50 then
freeimage(id)
id1=image("gfx/flare2.bmp",0,0,100+id)
imagescale(id1,1,1)
imageblend(id1,1)
imagealpha(id1,0.7)
if (player(id,"team") == 2) then
imagecolor(id1,0,0,0)
elseif (player(id,"team") == 1) then
imagecolor(id1,0,0,0)
end
end
end


FIXED
edited 6×, last 29.09.10 10:26:17 pm
27.09.10 10:59:54 pm
Up
MasterAsp
User
Offline Off
@Deatherr Your using the object ids id for the money equip, you want to use the second parameter for the setmoney funciton.
Code:
1
2
3
4
addhook("objectkill","npcmoney")
function npcmoney(id,player)
parse("setmoney "..player.." "..(player(player,"money")+300))
end


And, I'd also like to ask how to use the string.format function, as I see it as a powerful tool, yet I don't know how to use it.
edited 1×, last 28.09.10 02:07:59 am
28.09.10 02:49:35 am
Up
Deatherr
User
Offline Off
MasterAsp has written:
@Deatherr Your using the object ids id for the money equip, you want to use the second parameter for the setmoney funciton.
Code:
1
2
3
4
addhook("objectkill","npcmoney")
function npcmoney(id,player)
parse("setmoney "..player.." "..(player(player,"money")+300))
end


And, I'd also like to ask how to use the string.format function, as I see it as a powerful tool, yet I don't know how to use it.


Like I said i'm horrible at script so... idk is my anwser.. thanks for fixing it
Map making has become complex...
To the start Previous 1 2 ... 266 267 268 ... 338 339 Next To the start