English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 278 279 280 ... 338 339 Next To the start
12.10.10 08:53:31 pm
Up
maPmaKer
User
Offline Off
Can anybody tell me the code for a lua script so when admin enters his chat will be coloured in green for example?

And can it work with U.S.G.N. IDs so I can put more IDs for more admins?

Thanks!
maPmaKer
12.10.10 09:33:58 pm
Up
SQ
Moderator
Offline Off
maPmaKer has written:
Can anybody tell me the code for a lua script so when admin enters his chat will be coloured in green for example?

Use NewAdmin(USGN ID,"COLOR NAME") function to add more admins. (Use this command in the end of the script)
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = {}

addhook("say","AdminSay")

function NewAdmin(USGN,COLOR)
     AdminTable[USGN] = COLOR
end

function AdminSay(P,T)
     local A = AdminTable[player(P,"usgn")]
     if A then
          msg("©"..Colors[string.lower(A)]..player(P,"name").."(Admin): "..T)
          return(1)
     end
     return(0)
end

NewAdmin(5537,"Red")
12.10.10 09:35:15 pm
Up
RyceR
User
Offline Off
Hey, has anybody "RolePlay" script from "rp_shopmap" map?
if yes plz give me
edited 1×, last 13.10.10 08:11:07 am
IMG:http://img704.imageshack.us/img704/4043/userbargimp.png
13.10.10 08:32:08 am
Up
maPmaKer
User
Offline Off
GrandMyth has written:
maPmaKer has written:
Can anybody tell me the code for a lua script so when admin enters his chat will be coloured in green for example?

Use NewAdmin(USGN ID,"COLOR NAME") function to add more admins. (Use this command in the end of the script)
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = {}

addhook("say","AdminSay")

function NewAdmin(USGN,COLOR)
     AdminTable[USGN] = COLOR
end

function AdminSay(P,T)
     local A = AdminTable[player(P,"usgn")]
     if A then
          msg("©"..Colors[string.lower(A)]..player(P,"name").."(Admin): "..T)
          return(1)
     end
     return(0)
end

NewAdmin(5537,"Red")


Thanks it works! But how to add more classes like "Moderator" or "Gamer"? I tryed to add but it isn't working
edited 1×, last 13.10.10 09:48:20 am
13.10.10 12:33:51 pm
Up
Snake_Eater
User
Offline Off
Hi guys!
I need help at this...

Code:
1
2
3
4
5
6
addhook ("say","lat")
function lat(p,t)
if (t == "[^","]+,[^","]+") then -- doesnt work
msg ("Works")
end
end


I want if somebody says :"ONE OR MORE LETTERS UNEQUAL "," then a "," AND ONE OR MORE LETTERS UNEQUAL "," "

pls help
edited 1×, last 13.10.10 03:32:25 pm
[Death Note]
13.10.10 02:33:22 pm
Up
Jaso
BANNED
Offline Off
addhook('hit','hit.weap')


-- Check if the gun is a pistol
function hit.weap(id,sid,w)
if w > 0 and w < 7 then hit.team(id,sid) return 1
else return 0 end
end


-- Check if it's fired by a Terrorist
function hit.team(id,sid)
if player(sid,'team') == 1 then hit.teleport(id)
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function hit.teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end

When i try this script i get error can some one fix the wrong thing in the script?
13.10.10 03:31:50 pm
Up
Snake_Eater
User
Offline Off
the error is because the functions...(hit.teleport....)
thats must work...
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook('hit','weap')

-- Check if the gun is a pistol
function weap(id,sid,w)
if w > 0 and w < 7 then team(id,sid) return 1
else return 0 end
end


-- Check if it's fired by a Terrorist
function team(id,sid)
if player(sid,'team') == 1 then teleport(id)
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end


Ps:

Hi guys!
I need help at this...

Code:
1
2
3
4
5
6
addhook ("say","lat")
function lat(p,t)
if (t == "[^","]+,[^","]+") then -- doesnt work
msg ("Works")
end
end


I want if somebody says :"ONE OR MORE LETTERS UNEQUAL "," then a "," AND ONE OR MORE LETTERS UNEQUAL "," "

pls help
[Death Note]
13.10.10 03:33:07 pm
Up
Jaso
BANNED
Offline Off
@Snake_Eater ok thanks but how can i change it so its only for ct?

addhook('hit','weap')

-- Check if the gun is a pistol
function weap(id,sid,w)
if w > 0 and w < 7 then team(id,sid) return 1
else return 0 end
end
-- Check if it's fired by a Terrorist

function team(id,sid)
if player(sid,'team') == 1 then teleport(id)
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end
13.10.10 03:44:41 pm
Up
Snake_Eater
User
Offline Off
@jaso55

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook('hit','weap')

-- Check if the gun is a pistol
function weap(id,sid,w)
if w > 0 and w < 7 then team(id,sid) return 1
else return 0 end
end


-- Check if it's fired by a Terrorist
function team(id,sid)
if player(sid,'team') == 2 then teleport(id) --Here team1 = terrorists team2 = counterterrorists
elseif player(sid,'team') ~= 1 then msg2(sid,"©255000000You can't arrest people!") end
end


-- Teleport the player to a quasi-random location
function teleport(id)
local PLACES = {{1680,80},{2000,80},{2032,528}}
local PLACE = PLACES[math.random(1,#PLACES)]
parse('setpos '..id..' '..PLACE[1]..' '..PLACE[2])
end


Ps:

Hi guys!
I need help at this...

Code:
1
2
3
4
5
6
addhook ("say","lat")
function lat(p,t)
if (t == "[^","]+,[^","]+") then -- doesnt work
msg ("Works")
end
end


I want if somebody says :"ONE OR MORE LETTERS UNEQUAL "," then a "," AND ONE OR MORE LETTERS UNEQUAL "," "

pls help
edited 1×, last 13.10.10 04:34:08 pm
[Death Note]
13.10.10 05:43:37 pm
Up
maPmaKer
User
Offline Off
GrandMyth has written:
maPmaKer has written:
Can anybody tell me the code for a lua script so when admin enters his chat will be coloured in green for example?

Use NewAdmin(USGN ID,"COLOR NAME") function to add more admins. (Use this command in the end of the script)
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = {}

addhook("say","AdminSay")

function NewAdmin(USGN,COLOR)
     AdminTable[USGN] = COLOR
end

function AdminSay(P,T)
     local A = AdminTable[player(P,"usgn")]
     if A then
          msg("©"..Colors[string.lower(A)]..player(P,"name").."(Admin): "..T)
          return(1)
     end
     return(0)
end

NewAdmin(5537,"Red")


Thanks it works! But how to add more classes like "Moderator" or "Gamer"? I tryed to add but it isn't working. Still need help please answer
13.10.10 05:53:23 pm
Up
SQ
Moderator
Offline Off
This time use NewAdmin(USGN_ID,"Color","Rank Name")

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- Script By Blazzingxx
Colors = { green = "000255000", red = "255000000", blue = "000000255", yellow = "255255000" }
AdminTable = { }

addhook("say","AdminSay")

function NewAdmin(USGN,COLOR,RANK)
     AdminTable[USGN] = { C = COLOR, R = RANK}
     local A = AdminTable[USGN]
end

function AdminSay(P,T)
     local A = AdminTable[player(P,"usgn")]
     if A then
          msg("©"..Colors[string.lower( A.C )]..player(P,"name").." ("..string.upper( A.R ).."): "..T)
          return(1)
     end
     return(0)
end

NewAdmin(5537,"Red","admin")
edited 2×, last 18.10.10 01:09:18 pm
13.10.10 06:02:11 pm
Up
maPmaKer
User
Offline Off
Thanks man. Now it works perfectly. I knew ur the best. Thanks
13.10.10 06:18:09 pm
Up
hyh2
COMMUNITY BANNED
Offline Off
Hello, who have simple knockback Lua script? If you have please give me or post here.
IMG:http://www.graphicsgrotto.com/animatedgifs/comments/thankyou/images/agcthankyou4.gif
13.10.10 07:00:14 pm
Up
SQ
Moderator
Offline Off
hyh2 has written:
Hello, who have simple knockback Lua script? If you have please give me or post here.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
-- Script By Blazzingxx
addhook("hit","Knockback")
function Knockback(V,S,W)
     if (W > 0 and W < 50) then
          local DMG = (itemtype(W,"dmg") / 2)
          local ROT = math.rad(player(S,"rot") - 90)
          local NX = player(V,"x") + (math.cos(ROT) * DMG)
          local NY = player(V,"y") + (math.sin(ROT) * DMG)
          if tile(NX / 32 - 1,NY / 32 - 1,"walkable") then
               parse(string.format("setpos %s %s %s",V,NX,NY))
          end
     end
end
13.10.10 08:36:35 pm
Up
maPmaKer
User
Offline Off
Does anybody has a working no super supply lua?
14.10.10 07:35:51 am
Up
Admir
User
Offline Off
maPmaKer has written:
Does anybody has a working no super supply lua?


you can't, but you can make script that RPG is not collectable by player.
My curse will sail against the wind and enrage the earth.
14.10.10 07:54:33 am
Up
hyh2
COMMUNITY BANNED
Offline Off
GrandMyth has written:
hyh2 has written:
Hello, who have simple knockback Lua script? If you have please give me or post here.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
-- Script By Blazzingxx
addhook("hit","Knockback")
function Knockback(V,S,W)
     if (W > 0 and W < 50) then
          local DMG = (itemtype(W,"dmg") / 2)
          local ROT = math.rad(player(S,"rot") - 90)
          local NX = player(V,"x") + (math.cos(ROT) * DMG)
          local NY = player(V,"y") + (math.sin(ROT) * DMG)
          if tile(NX / 32 - 1,NY / 32 - 1,"walkable") then
               parse(string.format("setpos %s %s %s",V,NX,NY))
          end
     end
end


Magic. THX.
IMG:http://www.graphicsgrotto.com/animatedgifs/comments/thankyou/images/agcthankyou4.gif
14.10.10 08:06:25 am
Up
senar
User
Offline Off
i wan't a script that when you say !laser equip you a laser for $5000 i made onew but diden't work there was a wrong

ps: i know that is easy but i still learning
14.10.10 08:10:58 am
Up
ohaz
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
addhook("say", "buylaser")
function buylaser(id,txt)
     if (txt == "!laser") then
          if (player(id, "money") > 4999) then
               parse("equip "..id.." 45")
               msg2(id, "Bought Laser!")
               parse("setmoney "..id.." "..player(id,"money") - 5000)
          end
     return 1
     end
end

@senar
https://ohaz.engineer - Software Engineering
14.10.10 09:02:57 am
Up
maPmaKer
User
Offline Off
Does anybody has a lua that RPG is not collectable by players?

(thx to admir for idea)
To the start Previous 1 2 ... 278 279 280 ... 338 339 Next To the start