English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 148 149 150 ... 338 339 Next To the start
26.01.10 10:29:23 pm
Up
SenSidethink
User
Offline Off
K, got everything to work now.

Just one Problem:
Code:
1
parse('hudtxt2 '..id..' 4 "©000255000Weapon: '..item(player(id,"weapontype"),"name")..' " 10 125')

Returns the wrong Wep (yes i know why o_X)
But how to fix it?
26.01.10 11:10:48 pm
Up
Redefinder
User
Offline Off
My post got lost in the previous page so I`m reposting it
redefinder has written:
Why doesn`t this work?
Code:
1
2
3
4
5
6
7
8
9
10
11
12
-----------------------
----ADMIN SAY-----
-----------------------
addhook("say","adminsay")
function adminsay(id)
     for i,_usgn in ipairs(RANK.ADMIN) do
          if player(id,"usgn") == _usgn then
          msg(©000255000 "..player(player, "name").." (Admin): "..text)
          return 1
           end
     end
end

It`s purpose is to make message of admin green and add word (Admin) to it.

Someone help me plz.
26.01.10 11:12:09 pm
Up
SenSidethink
User
Offline Off
I just answered lol

It cant work atm since u dont get a USGN ID
atm because the Server are down.
26.01.10 11:22:36 pm
Up
Redefinder
User
Offline Off
SenSidethink has written:
Shoud be because u cant login to USGN atm.
So u dont have an Id

SenSidethink has written:
I just answered lol

It cant work atm since u dont get a USGN ID
atm because the Server are down.

I know lol......
I tried without those lines that make script to require USGN id
Code:
1
2
3
4
5
6
addhook("say","adminsay")
msg(©000255000 "..player(player, "name").." (Admin): "..text)
return 1
end
end
end
26.01.10 11:25:17 pm
Up
SenSidethink
User
Offline Off
Code:
1
2
3
4
5
6
addhook("say","adminsay")
function adminsay(id,txt)
     if (player(id,"usgn")==xxx) then <- Put ur USGN instand of xxx
     msg("©255255255"..player(id,"name").." (Admin):"..txt)
     End
End


Untested.
26.01.10 11:36:42 pm
Up
Redefinder
User
Offline Off
SenSidethink has written:
addhook("say","adminsay")
function adminsay(id,txt)
if (player(id,"usgn")==xxx) then <- Put ur USGN instand of xxx
msg("©255255255"..player(id,"name").." (Admin):"..txt)
End
End


Untested

Thanks a lot ,it works.
By the way I improved it a bit:
Code:
1
2
3
4
5
addhook("say","adminsay")
function adminsay(id,txt)
     msg("©255000000"..player(id,"name").." (Admin): "..txt)
     return 1
end

And also you don`t need this line for message to work
Code:
1
if (player(id,"usgn")==xxx) then
26.01.10 11:38:07 pm
Up
SenSidethink
User
Offline Off
If u dont have the Line
Code:
1
if (player(id,"usgn")==xxx) then


Everyone will write as a "Admin"...
xDD
26.01.10 11:42:38 pm
Up
Redefinder
User
Offline Off
SenSidethink has written:
If u dont have the Line
Code:
if (player(id,"usgn")==xxx) then


Everyone will write as a "Admin"...
xDD

yes,I just made this to test it because usgn is offline:
Code:
1
2
3
4
5
addhook("say","adminsay")
function adminsay(id,txt)
msg("©255000000"..player(id,"name").." (Admin): "..txt)
return 1
end

When the usgn will be back online the script will look like this:
Code:
1
2
3
4
5
6
7
addhook("say","adminsay")
function adminsay(id,txt)
for i,_usgn in ipairs(RANK.ADMIN) do
if player(id,"usgn") == _usgn then 
msg("©255000000"..player(id,"name").." (Admin): "..txt)
return 1
end
26.01.10 11:48:01 pm
Up
SenSidethink
User
Offline Off
I still got a Problem with this:
Code:
1
parse('hudtxt2 '..id..' 4 "©000255000Weapon: '..item(player(id,"weapontype"),"name")..' " 10 125')


Someone know how to fix it?
26.01.10 11:58:15 pm
Up
Flacko
User
Offline Off
Try this
Code:
1
parse([[hudtxt2 ]]..id..[[ 4 '©000255000Weapon: ]]..item(player(id,"weapontype"),"name")..[[' 10 125]])
27.01.10 12:07:31 am
Up
SenSidethink
User
Offline Off
Still the same (and more fails LOL).
It shows just "Claw" whatever i use

Btw how can i make shapes?
(like a HUD background)
27.01.10 12:30:50 am
Up
Flacko
User
Offline Off
Well, I'd like you to post the rest of your function then.
27.01.10 12:45:20 am
Up
SenSidethink
User
Offline Off
The Func like i have it atm:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-----------------------
-- COMPLETE HUD --
-----------------------
addhook("always","HUD")
function HUD()
     rot = {}
     for id = 1, game("sv_maxplayers"), 1 do
          if player(id,"exists") then
               rot[id] = player(id,"rot")
               parse('hudtxt2 '..id..' 3 "©000255000Coordinates X: '..player(id,"tilex")..' Y: '..player(id,"tiley")..' " 10 100')
               parse('hudtxt2 '..id..' 4 "©000255000Health: '..player(id,"health")..' Armor: '..player(id,"armor")..' " 10 113')
               parse('hudtxt2 '..id..' 5 "©000255000Weapon: '..item(player(id,"weapontype"),"name")..' " 10 126')
               level=sample.ut.level[id]
               parse('hudtxt2 '..id..' 6 "©000255000Level: '..level..' " 10 139')

          end
     end
end


Everything works, just the Wep is allways "Claw"
27.01.10 12:52:00 am
Up
Flacko
User
Offline Off
Oh, yeah, there was a small error
Code:
1
parse([[hudtxt2 ]]..id..[[ 4 '©000255000Weapon: ]]..itemtype(player(id,"weapontype"),"name")..[[' 10 125]])
27.01.10 12:58:53 am
Up
SenSidethink
User
Offline Off
Nice, it shows the right Wep now.

Problem:
It displays

"©000255000Weapon: Knife"
at the top left of the Screen, not at the Pos.



Edit: Fixed it.
Code:
1
parse([[hudtxt2 ]]..id..[[ 4 "©000255000Weapon: ]]..itemtype(player(id,"weapontype"),"name")..[[" 10 125]])


Edit2:
Is it possible to make a Box? (Background for HUD)
With a func?
edited 2×, last 27.01.10 01:43:12 am
27.01.10 07:47:09 am
Up
leoska
User
Offline Off
I need a little help.
I created a Rank system but my kpd need in filtrations. When dialing "rank" he gives such values Kills: 20 Dies: 3 KPD: 6.77777 = [I need 6.77] ...

Sorry i bad speak english.
IMG:https://pp.userapi.com/c639325/v639325546/16590/N8rFaOx_ZXc.jpg
27.01.10 12:26:13 pm
Up
SenSidethink
User
Offline Off
2 Problems i have now.


a) Is there a way to create a Shape
(Background for a HUD) without using a
Image? Like a shape Func?

b) Is there a Var that contains the alive Players?
Because i want to show how much T's and CT's
are alive
27.01.10 12:36:56 pm
Up
wups
User
Offline Off
SenSidethink has written:
2 Problems i have now.


a) Is there a way to create a Shape
(Background for a HUD) without using a
Image? Like a shape Func?

b) Is there a Var that contains the alive Players?
Because i want to show how much T's and CT's
are alive


A) I dont know

B) Use a for loop and check if they are alive. Use own func tion, and add it to the checker. If alive(p) then do this else dead.
27.01.10 01:02:56 pm
Up
SenSidethink
User
Offline Off
Thanks got b) working.

But i still need a).
Is there no func for shapes in Lua?
27.01.10 04:24:37 pm
Up
Flacko
User
Offline Off
@Leo:
Code:
1
2
3
4
local KpD = tostring(K/D) --Kills/Deaths
if(string.len(KpD)>4) then
     KpD = string.sub(KpD,1,4)
end
To the start Previous 1 2 ... 148 149 150 ... 338 339 Next To the start