English Lua Scripts/Questions/Help

6,770 replies
Goto Page
To the start Previous 1 2 ... 280 281 282 ... 338 339 Next To the start
16.10.10 04:50:48 pm
Up
maPmaKer
User
Offline Off
Does anybody has a lua script where:

If there are less then 24 players a bot joins in spec mode, and if there are over 24 players the bot is kicked.

Any help?
16.10.10 05:39:46 pm
Up
Glix
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
addhook("say","player_say")
function player_say(id,txt)
     if(txt=="!usp") then
          parse("equip "..id.." 1")end
     if(txt=="!glock") then
          parse("equip "..id.." 2")end
     if(txt=="!deagle") then
          parse("equip "..id.." 3")end
     end
end


how make it like you need use it on map (trigger_use)>(name, trigger)>(trigger)>(339) and he equip wen click that trigger!!

like that

Code:
1
2
3
4
5
6
7
8
9
10
addhook("use","player_use")
function player_use(id,trigger)
     if(trigger=="339") then
          parse("equip "..id.." 1")end
     if(trigger=="337") then
          parse("equip "..id.." 2")end
     if(trigger=="338") then
          parse("equip "..id.." 3")end
     end
end



sory for my bad english
edited 2×, last 17.10.10 02:35:54 pm
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
16.10.10 08:50:30 pm
Up
CrazyN
User
Offline Off
Does anyone could help me with the gun which teleport on selected position ?
I saw Snake_Eater One Day Prson script but thats not what I mean.
I want that this gun will be Five - Seven .
Thanks For Help
IMG:http://img3.imageshack.us/img3/8939/29153.gif
16.10.10 09:37:36 pm
Up
TimeQuesT
User
Offline Off
Code:
1
2
3
4
5
6
addhook ("hit",hitt")
function hitt(id,source,iid,weapon)
if weapon==yourweapon then
parse ("setpos "..id.." x y")
end
end


this teleports the player to xy if he got hit by xyz gun
Muh
16.10.10 10:00:01 pm
Up
Fehu
User
Offline Off
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
function initArray(m)
local array = {}
for i = 1, m do
array[i]=0
end
return array
end

god=initArray(32)

addhook("say","god_mode")
function god_mode(id,txt)

    if(txt=="/god") then
        if god[id]==0 then
            god[id]=1
            msg2(id,"©000255000God ON! @C")
        elseif god[id]==1 then
            god[id]=0
            msg2(id,"©255000000God OFF! @C")
        end
    end
end

addhook("hit","god_on")
function god_on(id,source,weapon,hpdmg,apdmg)

    if god[id]==1 then
     return 1
     end
end


Why This Dont Work ?
IMG:http://www.flashflashrevolution.com/profile/newsiggy/Fehu/stardust/0/0-1-2-3-4-5.png
16.10.10 10:06:15 pm
Up
SQ
Moderator
Offline Off
CrazyN has written:
Does anyone could help me with the gun which teleport on selected position ?
I saw Snake_Eater One Day Prson script but thats not what I mean.
I want that this gun will be Five - Seven .
Thanks For Help

Try this out.
Use Five-Seven, as you said.
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
addhook("attack","FiveSevenTeleport")
function FiveSevenTeleport(id)
     if (player(id,"weapontype") == 6) then
          local b = { x = player(id,"x"), y = player(id,"y"), dir = math.rad(player(id,"rot") - 90) }
          local i, nx, ny
          while true do
               nx = b.x + math.cos(b.dir) * 16
               ny = b.y + math.sin(b.dir) * 16
               if not tile((nx / 32) - 1,(ny / 32)  - 1,"walkable") then
                    if i then parse(string.format("setpos %s %s %s",id,b.x - 16,b.y - 16)) end
                    msg2(id,"©000255000Teleport!@C")
                    break
               else
                    parse(string.format('effect "fire" %s %s %s',b.x,b.y,1,1))
                    b.x, b.y = nx, ny
                    i = true
               end
          end
     end
end


@Fehuziom,
Instead:
Code:
1
if (txt=="/god") then

Try this:
Code:
1
if (txt=="!god") then
16.10.10 11:14:32 pm
Up
CmDark
User
Offline Off
Blazzing

He's just another of those people I told people about in my thread, it's one of those script that was originally used in the RP server by trot.

He does not mean what you made, he means
when you shoot the five-seven at someone -that someone gets sent to a position chosen beforehand(a jail).
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local jpx=0
local jpy=0
addhook("say","savpos")
function savpos(i,t)
if (t=="savepos") then
     local jpx=player(i,"x")
     local jpy=player(i,"y")
end
end

addhook("hit","fiveseventele")
function fiveseventele(vic,src,wp)
     if (wp==6) then
          parse('setpos '..vic..' '..jpx..' '..jpy)
     return 1
     end
end


well.. something like that


Add:
Anyone up for a new project?

Project: Agent of Truth

*A bot that acts as a god(admin) in the server

Time to learn how to edit/build the Bot AI in cs2d..
edited 3×, last 17.10.10 03:07:13 am
IMG:http://i54.tinypic.com/auk478.png
17.10.10 03:44:45 am
Up
TDShuft
User
Offline Off
maPmaKer has written:
Does anybody has a lua script where:

If there are less then 24 players a bot joins in spec mode, and if there are over 24 players the bot is kicked.

Any help?

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
32
33
34
35
36
37
38
39
40
41
function Array(size,value) 
     local array = {}
     for i = 1, size do
          array[i]=value
     end
     return array
end
player_counted = Array(32,"false")
player_count = 0
pbk >= 25
addhook("join","join")
addhook("spawn","spawn")
addhook("leave","leave")
addhook("ms100","ms")
function join(id)
     if player_counted[id]=="false" then
          player_count = player_count+1
          player_counted[id]="true"
     end
end
function leave(id)
     player_count = player_count-1
     player_counted[id]="false"
end
function spawn(id)
     if player_counted[id]=="false" then
          player_counted[id]="true"
          player_count=player_count+1
     end
end
function ms()
     if player_count >= 24 then
          for id=1,32 do
               if player(id,"bot") then
                    parse("kick "..id)
               end
          end
     else
          parse("bot_add")
     end
end


@CrazyN
I Don't Really Understand What You Want But Try This :
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
p_w = 6 -- Weapon That Takes Player To Prison , Five Seven (6)
only_admins = "true" -- If You Want Just To Be Used For Admins
admins = {22068} -- Put Your Usgn If You Want More Than 1 Then Put ,#usgn

function Array(size,value) 
     local array = {}
     for i = 1, size do
          array[i]=value
     end
     return array
end

function table.find(table,value) 
     for i,v in ipairs(table) do 
          if v == value then 
               return true 
          end 
     end 
end 

prisoned = Array(32,"false")
spawn_x = Array(32,0)
spawn_y = Array(32,0)
prison_x = Array(32,0)
prison_y = Array(32,0)
temp_adm = Array(32,"false")
mode = Array(32,0)
modeb = Array(32,"Nothing/None")

function adm(pl)
     local val
     local usgn = player(pl,"usgn")
     if table.find(admins,usgn) then
          val = "true"
     else
          val = "false"
     end
     return val
end
addhook("leave","p_leave")
function p_leave(id)
     prisoned[id]="false"
     mode[id]="false"
     spawn_y[id]="false"
     spawn_x[id]="false"
     prison_y[id]="false"
     prison_x[id]="false"
     temp_adm[id]="false"
end
addhook("hit","p_hit")
function p_hit(id,source,weapon,hpdmg,apdmg)
     if weapon == p_w then
          if mode[id]==1 then
               if prison_x[source] => 1 or prison_y =>[source] 1 then
                    parse("setpos "..id.." "..prison_x[source].." "..prison_y[source])
                    spawn_x[id] = prison_x[source]
                    spawn_y[id] = prison_y[source]
                    prisoned[id]="true"
                    parse("sv_msg2 "..source.." You Prisoned "..player(id,"name"))
                    parse("sv_msg2 "..id.." You Are Prisoned By "..player(source,"name"))
                    parse('effect "colorsmoke" '..player(id,"x")..' '..player(id,"y")..' 1 1 0 200 0')
               else
                    parse("sv_msg2 "..source.." You Don't Have Prision Position")
               end
               return 1
          elseif mode[id]==2 then
               if prisoned[id]=="true" then
                    prisoned[id]="false"
                    parse("sv_msg2 "..source.." You UnPrisoned "..player(id,"name"))
                    parse("sv_msg2 "..id.." "..player(source,"name").." UnPrisoned You")
                    parse('effect "colorsmoke" '..player(id,"x")..' '..player(id,"y")..' 1 1 0 0 255')
               else
                    prisoned[id]="true"
                    parse("sv_msg2 "..source.." You Prisoned "..player(id,"name"))
                    parse("sv_msg2 "..id.." "..player(source,"name").." Prisoned You")
                    parse('effect "colorsmoke" '..player(id,"x")..' '..player(id,"y")..' 1 1 255 0 0')
               end--91646165
               return 1
          else
               return 0
          end
     end
end
addhook("spawn","p_spawn")
function p_spawn(id)
     if prisoned[id]="true" then
          parse("setpos "..id.." "..spawn_x[id].." "..spawn_y[id])
     end
end
addhook("serveraction","f2")
function f2(id,action)
     if action==1 then -- If Pressed F2 Appear Prison Menu, 2 For F3 and 3 For F4
          if only_admins=="true" then
               if adm(id)=="true" or temp_adm[id]=="true" then
                    menu(id,"Prison Pos@b,Set Prison Pos,Pos_x:|"..prison_x[id]..",Pos_y:|"..prison_y[id]..",Mode|"..mode[id])
               end
          else
               menu(id,"Prison Pos@b,Set Prison Pos,Pos_x:|"..prison_x[id]..",Pos_y:|"..prison_y[id]..",Mode|"..modeb[id])
          end
     end
end
addhook("menu","menu")
function menu(id,t,b)
x = player(id,"x")
y = player(id,"y")
     if t == [[Prison Pos]] then
          if b==1 then
               prison_x[id]=x
               prison_y[id]=y
               parse("sv_msg2 "..id.." Position Saved")
               mode[id]=1
          elseif b==2 then
               prison_x[id]=x
          elseif b==3 then
               prison_y[id]=y
          elseif b==4 then
               if mode[id]==0 then
                    mode[id]=1
                    modeb[id]="Take To Prison"
               elseif mode[id]==1 then
                    mode[id]=2
                    modeb[id]="Prison/UnPrison"
               end     
          end
     end
end
addhook("parse","parse")
function parse(text)
     if string.sub(text,1,8)=="temp_adm" then
          vic_id = string.sub(text,10)
          temp_adm[vic_id]="true"
          parse("sv_msg2 "..id.." You Give "..player(vic_id,"name").." Temporal Admin")
          parse("sv_msg2 "..vic_id.." "..player(id,"name").." Give You Temporal Admin")
     end
end


@Fehuziom
Better You Do This :
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
function Array(size,value) 
     local array = {}
     for i = 1, size do
          array[i]=value
     end
     return array
end

god = Array(32,0)

addhook("say","god_mode")
function god_mode(id,txt)
     if (txt=="!god") then
          if god[id]==0 then
               god[id]=1
               msg2(id,"©000255000God ON! @C")
          elseif god[id]==1 then
               god[id]=0
               msg2(id,"©255000000God OFF! @C")
          end
     end
end

addhook("hit","god_on")
function god_on(id)
     if god[id]==1 then
          return 1
    end
end
edited 3×, last 17.10.10 04:13:05 am
Sorry , I can't be Perfect !
17.10.10 05:57:16 am
Up
Smuckie
User
Offline Off
http://www.mediafire.com/?hcrkjwdffvbha8k

I cannot edit LUA Files. Can someone download this code (Advanced Buying List), edit it for me, and give me the download link?

I want you to either remove Laser, Super Armor, and RPG, or edit them to make them over 25,000$.
-
17.10.10 05:59:48 am
Up
filip33
COMMUNITY BANNED
Offline Off
seems not to work
...
17.10.10 06:52:16 am
Up
CrazyN
User
Offline Off
@GrandMyth: You 're great !!!
IMG:http://img3.imageshack.us/img3/8939/29153.gif
17.10.10 08:52:17 am
Up
maPmaKer
User
Offline Off
@ TDShuft

It gives me errors like "then" expected near "=". What is wrong?
17.10.10 09:23:48 am
Up
CmDark
User
Offline Off
@TDShuft/maPmaKer

that code could be shortened a lot

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("ms100","hook_ms100_botscript")

local botishere=0
function hook_ms100_botscript()
if #player(0,"table") >=24 then
     if botishere==1 then
     for i=1,#player(0,"table") do
     if player(i,"bot") then
     parse("kick "..i)
     botishere=0
     end
     end
     end
elseif #player(0,"table")<24 and botishere~=1 then
     parse("bot_add")
     botishere=1
end


Would theoretically work the same way as your longer script.
IMG:http://i54.tinypic.com/auk478.png
17.10.10 09:49:27 am
Up
maPmaKer
User
Offline Off
CmDark has written:
@TDShuft/maPmaKer

that code could be shortened a lot

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("ms100","hook_ms100_botscript")

local botishere=0
function hook_ms100_botscript()
if #player(0,"table") >=24 then
     if botishere==1 then
     for i=1,#player(0,"table") do
     if player(i,"bot") then
     parse("kick "..i)
     botishere=0
     end
     end
     end
elseif #player(0,"table")<24 and botishere~=1 then
     parse("bot_add")
     botishere=1
end


Would theoretically work the same way as your longer script.


Not working either. It got problems. Please fix. Thanks
17.10.10 10:00:51 am
Up
HaRe
User
Offline Off
maPmaKer has written:
CmDark has written:
@TDShuft/maPmaKer

that code could be shortened a lot

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("ms100","hook_ms100_botscript")

local botishere=0
function hook_ms100_botscript()
if #player(0,"table") >=24 then
     if botishere==1 then
     for i=1,#player(0,"table") do
     if player(i,"bot") then
     parse("kick "..i)
     botishere=0
     end
     end
     end
elseif #player(0,"table")<24 and botishere~=1 then
     parse("bot_add")
     botishere=1
end


Would theoretically work the same way as your longer script.


Not working either. It got problems. Please fix. Thanks


The same error or?

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
botishere=0
addhook("ms100","hook_ms100_botscript")
function hook_ms100_botscript()
     if (#player(0,"table")>=24) then
             if botishere==1 then
               for i=1,#player(0,"table") do
                    if (player(i,"bot")) then
                         parse("kick "..i)
                         botishere=0
                    end
               end
          end
     elseif #player(0,"table")<24 and botishere~=1 then
          parse("bot_add")
          botishere=1
     end
end


try that
edited 1×, last 17.10.10 10:04:09 am
w0w im so eXotiK
17.10.10 10:01:02 am
Up
CmDark
User
Offline Off
@maPmaKer

hehe... forgot to add the end at the end of script...

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("ms100","hook_ms100_botscript")

local botishere=0
function hook_ms100_botscript()
     if #player(0,"table") >=24 then
              if botishere==1 then
                    for i=1,#player(0,"table") do
                         if player(i,"bot") then
                              parse("kick "..i)
               botishere=0
                         end
                    end
               end
     elseif #player(0,"table")<24 and botishere~=1 then
               parse("bot_add")
          botishere=1
     end
end


haRe the ( and ) are unnecessary.
edited 1×, last 17.10.10 10:02:39 am
IMG:http://i54.tinypic.com/auk478.png
17.10.10 10:02:15 am
Up
hyh2
COMMUNITY BANNED
Offline Off
Fonduta has written:
http://www.mediafire.com/?hcrkjwdffvbha8k

I cannot edit LUA Files. Can someone download this code (Advanced Buying List), edit it for me, and give me the download link?

I want you to either remove Laser, Super Armor, and RPG, or edit them to make them over 25,000$.


Here you go:
Spoiler >
IMG:http://www.graphicsgrotto.com/animatedgifs/comments/thankyou/images/agcthankyou4.gif
17.10.10 03:00:04 pm
Up
Glix
User
Offline Off
Code:
addhook("say","player_say")
function player_say(id,txt)
if(txt=="!usp") then
parse("equip "..id.." 1")end
if(txt=="!glock") then
parse("equip "..id.." 2")end
if(txt=="!deagle") then
parse("equip "..id.." 3")end
end
end


how make it like you need use it on map (trigger_use)(name, trigger)(trigger)(339) and he equip wen click that trigger!!

like that

Code:
addhook("use","player_use")
function player_use(id,trigger)
if(trigger=="339") then
parse("equip "..id.." 1")end
if(trigger=="337") then
parse("equip "..id.." 2")end
if(trigger=="338") then
parse("equip "..id.." 3")end
end
end



sory for my bad english
Create free website for your clan! Create server control panel webE --->http://www.000webhost.com/581961.html
17.10.10 03:30:42 pm
Up
RyceR
User
Offline Off
@steam-cs2d use "x" and "y" or "tilex" and "tiley".
IMG:http://img704.imageshack.us/img704/4043/userbargimp.png
17.10.10 04:12:04 pm
Up
maPmaKer
User
Offline Off
@HaRe:

It is working now but how to add the bot immediatly in the spec mode?
To the start Previous 1 2 ... 280 281 282 ... 338 339 Next To the start