English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 124 125 126 ... 338 339 Next To the start
27.12.09 04:47:59 pm
Up
SQ
Moderator
Offline Off
Hmm? Hook adding function requires "string".
addhook(Hook,"Function String")
Anyway, your function is working now...

× I haven't tried, but it shouldn't work like this:
Code:
1
2
-- Probably it's returning integer (nil valuable) in this case...
addhook(always,my_function)
27.12.09 05:10:28 pm
Up
Vectarrio
User
Offline Off
How can I know, what is the tile? snow or step?
27.12.09 08:23:17 pm
Up
Noxic
User
Offline Off
When I use the 'strip' command on an inventory item I get an error message. Is it impossible to remove non-weapons?

Also waiting for the ammo changing script Blazzingxx mentioned two pages ago. I've looked into it, but I really can't find a way to do this (unless there's some hidden/invisible 'player' or 'item' table with variables that change their respective properties).
27.12.09 08:56:20 pm
Up
SQ
Moderator
Offline Off
Trick is about hud "ammo text" and NOT default ammo system.
27.12.09 09:16:12 pm
Up
Noxic
User
Offline Off
What about forcing teams?

I can force a teamchange if someone chooses the team I don't want them to join, but then they automaticly switch back to their team of choice after they die (which they do when I force the teamchange). Maybe a way to remove the team from the menu?

EDIT: Also, I'm still curious about hidden tables. Anything undocumented, in fact.
edited 1×, last 27.12.09 09:50:34 pm
27.12.09 10:02:32 pm
Up
Vectarrio
User
Offline Off
How can I use default "pink" translucent color in "image" function?
And how can I use only one "piece" of image?
27.12.09 10:04:17 pm
Up
NozliW
User
Offline Off
i think black is traslucent on image function
i didn't understand that "piece" thing
27.12.09 10:06:32 pm
Up
Vectarrio
User
Offline Off
Yes, black, but can I use exactly |255,0,255| color?
piece: I want to draw a tile from tileset, but I dont want to make many tiles cropped from that tileset
Just I am going to do Stereoscopic thing (Exactly:Anaglyph)

And How to turn string into the value?
edited 1×, last 27.12.09 10:46:13 pm
28.12.09 01:20:14 am
Up
Flacko
User
Offline Off
You should try different blending modes and see if one of them works.
As far as I know, you can't blit a rectangle from a bitmap with CS2D's functions.
If you want to turn a string into a number, you sould use tonumber(), if you want to call a function thru a string, you should put your function inside a table and call it like this
Code:
1
2
3
4
5
6
epic_table={
     function da_function(a_string)
          print(a_string)
     end
}
epic_table["da_function"]("A printed text") --Here we call the function


Or you could use metatables but that would be too complicated and maybe even useless in this case

Edit: Oh sorry, I fail terribly, you don't need to put the functions in a table, you can simply call your function from the main table _G["Your function"](Your parameters)
edited 3×, last 28.12.09 11:32:49 am
28.12.09 02:03:09 pm
Up
Vectarrio
User
Offline Off
Thank you very much
28.12.09 02:15:17 pm
Up
Flacko
User
Offline Off
You are welcome
28.12.09 10:46:09 pm
Up
Trotskygrad
User
Offline Off
I would like to use the "effect" command in a script. HOwever,this requires me to use two sets of quotes, which lua assumes is not part of the quote (the code is
parse("effect "colorsmoke" "..player(, etc.
28.12.09 11:15:02 pm
Up
YellowBanana
BANNED
Offline Off
parse('effect "colorsmoke" '..player(,etc..)
28.12.09 11:18:58 pm
Up
memo
COMMUNITY BANNED
Offline Off
ok i make script for my new mod but i donot why it dosen't
work the hook is add to game ( i see it from console) but nothing happen, its about that when your HP goes under 50 a msg pop up and tell you " you are Hurt,Get Covered" but when i start the game and my Hp gose under 50 a msg on console that shows Lua error the "player" must have a nil number somthing like that ? what wrong on it ?

Spoiler >
Call Of Duty - World At War [Work on progress] | official CoD scripts site
28.12.09 11:27:15 pm
Up
Trotskygrad
User
Offline Off
YellowBanana has written:
parse('effect "colorsmoke" '..player(,etc..)


ty
28.12.09 11:44:53 pm
Up
Lee
Moderator
Offline Off
memo has written:
ok i make script for my new mod but i donot why it dosen't
work the hook is add to game ( i see it from console) but nothing happen, its about that when your HP goes under 50 a msg pop up and tell you " you are Hurt,Get Covered" but when i start the game and my Hp gose under 50 a msg on console that shows Lua error the "player" must have a nil number somthing like that ? what wrong on it ?

Spoiler >


Code:
1
2
3
4
5
6
addhook("hit","cod4.hit")
function cod4.hit(id)
     if player(id,"health") < 50 then
          msg2(id, "You are hurt, Get Cover!")
     end
end
29.12.09 12:18:56 am
Up
Trotskygrad
User
Offline Off
leegao has written:
memo has written:
ok i make script for my new mod but i donot why it dosen't
work the hook is add to game ( i see it from console) but nothing happen, its about that when your HP goes under 50 a msg pop up and tell you " you are Hurt,Get Covered" but when i start the game and my Hp gose under 50 a msg on console that shows Lua error the "player" must have a nil number somthing like that ? what wrong on it ?

Spoiler >


Code:
1
2
3
4
5
6
addhook("hit","cod4.hit")
function cod4.hit(id)
     if player(id,"health") < 50 then
          msg2(id, "You are hurt, Get Cover!")
     end
end


lol, sorry to interrupt (leegao's code should work, I've done that stuff before). Shouldn't it be... "You are badly hurt, get to cover!"
29.12.09 12:36:40 am
Up
memo
COMMUNITY BANNED
Offline Off
thanks Trotsygrad but this msg come after i die i want it befroe dieing ?? like when my HP go on 49 the msg come on middle of the scrren thats what i want but thanks any way
Call Of Duty - World At War [Work on progress] | official CoD scripts site
29.12.09 12:40:37 am
Up
Flacko
User
Offline Off
memo has written:
thanks Trotsygrad but this msg come after i die i want it befroe dieing ?? like when my HP go on 49 the msg come on middle of the scrren thats what i want but thanks any way


You should thank leegao.
And this won't work very well if you get hit by an RPG/2xZ.AWP/Laser in case you were testing the script with those guns.
edited 1×, last 29.12.09 03:22:09 am
29.12.09 02:28:42 am
Up
sonnenschein
User
Offline Off
Flacko has written:
You should thank leegao.
And this won't work very well if you get hit by an RPG/2xZ.AWP/Laser.

Can't you add a code that returns 0 if certain weapon hit you?

Code:
1
2
3
4
5
6
7
8
9
10
addhook("hit","cod4.hit")
function cod4.hit(id,source,weapon,hpdmg,apdmg)
     if player(id,"health") < 50 then
          if "weapon = bla bla" then
               return 0
          else
               msg2(id, "You are hurt, Get Cover!")
          end
     end 
end
To the start Previous 1 2 ... 124 125 126 ... 338 339 Next To the start