English Teamchange Script

11 replies
Goto Page
To the start Previous 1 Next To the start
21.05.13 07:11:08 pm
Up
Kebabgamer
User
Offline Off
I'm Searching a TeamChange script if i write !change then all ct's goes to t and all t's goes to ct (only usgn) can do this.

- I Already searched but i dont found one.

greaze
21.05.13 07:26:54 pm
Up
limonata
User
Offline Off
Here you are. Works.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Admin = {xxxxx}

addhook("say","_say")
function _say(id,txt)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
local ct = player(0,"team2")
local t = player(0,"team1")
if txt == "!change" then
for _,ctp in pairs(ct) do
for _,tp in pairs(t) do
parse("makect "..tp)
parse("maket "..ctp)
return 1
end
end
end
end
end
end
21.05.13 07:27:40 pm
Up
Ashelin
BANNED
Offline Off
How about u make one? Just simple Say and Makect hooks n stuff.

More >
21.05.13 07:32:56 pm
Up
Kebabgamer
User
Offline Off
@user Ashelin: i already tried but it dont works

@user limonata: but if its an 5 vs 5 it dont changes all only 1 Player from each team
21.05.13 07:36:56 pm
Up
Alistaire
User
Offline Off
user limonata has written:
Here you are. Works.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Admin = {xxxxx}

addhook("say","_say")
function _say(id,txt)
for _, usgn in ipairs(Admin) do
if player(id,'usgn') == usgn then
local ct = player(0,"team2")
local t = player(0,"team1")
if txt == "!change" then
for _,ctp in pairs(ct) do
for _,tp in pairs(t) do
parse("makect "..tp)
parse("maket "..ctp)
return 1
end
end
end
end
end
end


Why the Christ did you add a loop in a loop. This makes the pairs(t) one run pairs(ct) times.

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
Admins = {
     [20877] = true
}

addhook('say', 'sayHook')

function sayHook(id, txt)
     if txt:sub(1, 1) == '!' or txt:sub(1, 1) == '@' then
          if txt:sub(2) == 'change' and Admins[player(id, 'usgn')] then
               switchTeams()
          else
               msg2(id, '©255100100Not a saycommand')
          end
          return 1;
     end
end

function switchTeams()
     local a, b = player(0, 'team1'), player(0, 'team2')
     for _, id in pairs(a) do
          parse('makect '..id)
          parse('msg2 '..id..' "©000000255Your whole team has been switched to CT"')
     end
     for _, id in pairs(b) do
          parse('maket '..id)
          parse('msg2 '..id..' "©255000000Your whole team has been switched to T"')
     end
end
edited 1×, last 21.05.13 08:16:15 pm
IMG:http://i.imgur.com/5zhwOTP.png
21.05.13 07:57:45 pm
Up
limonata
User
Offline Off
I'm not perfect at lua. But thanks for your comment.
21.05.13 08:12:49 pm
Up
Kebabgamer
User
Offline Off
@user Alistaire: Now if i write !change it changes all to terrorists but the terrorists not to ct..
22.05.13 12:05:08 pm
Up
eyez
User
Offline Off
I worked a bit today with lua because i'am ill and i have the time :

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
-------------------CS:2D TEAM SWITCH--------------------
--------------------------------------------------------

addhook('say','SayCommands')
function SayCommands(id,message) a = player(id,'usgn')
     for adm = 1,#admins do
          if a == admins[adm] and message == '@lock' then 
          lock_ct=1
          lock_tt=1
          msg('©255000000All Teams are locked!')
          return 1
               elseif a == admins[adm] and message == '@unlock' then 
               lock_ct=0 
               lock_tt=0 
               msg('©000255000All teams were unlocked!')
               return 1
          end
     end
end

addhook("team","OnTeam")
function OnTeam(id,team)
     if team == 1 then
          if lock_tt == 1 then
          msg2(id,"©255000000Teams are unlocked!")
          return 1
     end 
          elseif team == 2 then
               if lock_ct == 1 then
               msg2(id,"©255000000Teams are unlocked!")
               return 1
          end
     end
end


have fun, i tested it - it works!

but you need to change this one :
Code:
1
2
for adm = 1,#[u]admins[/u] do
          if a == [u]admins[/u][adm] and message == '@lock' then


There you need to write "the name of your admin list" : i think your list will be like this :
Code:
1
Admin = {xxxx}


if you dont know how to change it just use this one :
Code:
1
admins = {2422 , xxxxx , xxxxx}
edited 2×, last 22.05.13 01:02:51 pm
22.05.13 09:41:27 pm
Up
omg
User
Offline Off
invictus u idiot, u obviously didnt test it + it wont work well + u didnt even answer the original request
will code for food
22.05.13 09:43:58 pm
Up
Alistaire
User
Offline Off
user Kebabgamer has written:
@user Alistaire: Now if i write !change it changes all to terrorists but the terrorists not to ct..


I've fixed it, like just when you posted this comment.
IMG:http://i.imgur.com/5zhwOTP.png
23.05.13 09:20:04 pm
Up
eyez
User
Offline Off
user omg has written:
invictus u idiot, u obviously didnt test it + it wont work well + u didnt even answer the original request


it works well lol "lock team -> and unlock"
and yea i missunderstand something but it is not a reason to call me as idiot.
23.05.13 10:44:47 pm
Up
omg
User
Offline Off
the code doesnt even have the right number of "end". enough said
will code for food
To the start Previous 1 Next To the start