English Reward for end

16 replies
Goto Page
To the start Previous 1 Next To the start
11.07.18 03:43:41 pm
Up
tos12345678
User
Offline Off
Hi, i need a help in this script

If counter-terrostist win then
each counter-terrorist player will receive: coins[id]=coins[id]+100

\\
I would ask for an example script, thanks.
11.07.18 04:30:54 pm
Up
Yates
Reviewer
Offline Off
You're almost there. Here's how you check what the end result of the round is: cs2d cmd endround
11.07.18 04:47:24 pm
Up
tos12345678
User
Offline Off
But, when i scripting with addhook endround then
Each players gains 100 coins
edited 1×, last 11.07.18 04:48:03 pm
11.07.18 04:47:45 pm
Up
Code:
1
2
3
4
5
6
7
8
addhook('endround','endround_hook')
function endround_hook(mode)
if mode==2 then
for _, id in ipairs(player(0, "team2")) do
coins[id]=coins[id]+100
end
end
end
edited 5×, last 11.07.18 06:49:19 pm
11.07.18 04:48:35 pm
Up
tos12345678
User
Offline Off
Okey
11.07.18 05:45:11 pm
Up
px20
GAME BANNED
Offline Off
Code:
1
2
3
4
5
6
7
8
function end_hook(mode)
 if mode==2 then
  for k,id in ipairs(player(0,"team2")) do
   coins[id]=coins[id]+100
  end
 end
end
addhook("endround","end_hook")
11.07.18 05:48:15 pm
Up
Masea
Super User
Offline Off
@user KingShadow: What is that? You do not know how to code, so try to not help at things which you don't know.
Create and design your GUI easy and fast: file cs2d GUI Framework (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
11.07.18 06:06:17 pm
Up
@user Masea: what is your problem with me ? i just writing too fast so i made that :v also i forgot to add id in ipairs

PS:Edited!
edited 1×, last 11.07.18 06:15:12 pm
11.07.18 06:13:18 pm
Up
Yates
Reviewer
Offline Off
@user KingShadow: His issue is that your code doesn't do what the person asked and that's very annoying. Please don't do that. If you don't fully understand the request, don't post. If you want to understand the request, ask.
11.07.18 06:16:08 pm
Up
user Yates has written:
@user KingShadow: His issue is that your code doesn't do what the person asked and that's very annoying. Please don't do that. If you don't fully understand the request, don't post. If you want to understand the request, ask.


dude i edited it i know and i understand what he wants but i was writing too fast
11.07.18 06:48:22 pm
Up
Yates
Reviewer
Offline Off
It's still wrong. He only wants CT's to receive cash.
11.07.18 06:52:26 pm
Up
and now?
11.07.18 06:55:26 pm
Up
tos12345678
User
Offline Off
This code doesn't working with my coins=initArray(32)
in shortcut i dont get coins after CT win.
11.07.18 08:23:33 pm
Up
Masea
Super User
Offline Off
user KingShadow has written:
i just writing too fast so i made that :v
Then write slowly instead if that could teach me something wrong. Nothing enforces you to post faster than the light, right?

user KingShadow has written:
also i forgot to add id in ipairs
Lol. How did you forget that though? It was main and the only thing user tos12345678 wants anyway.

Furthermore, your approach is actually true - I have many problemos with you indeed.
Create and design your GUI easy and fast: file cs2d GUI Framework (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (25)
16.07.18 11:28:25 am
Up
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
--HOOK--

addhook("endround","end_hook")
addhook("join","join_hook")

--TABLES--

coins = {}

--FUNCTIONS--

function join_hook(id)
  coins[id] = 0
end

function end_hook(mode)
 if mode == 2 then
  for _,id in pairs(playerlist) do
   if player(id, 'team') == 2 then
     coins[id] = coins[id] + 100
   end
  end
 end
end
16.07.18 12:18:21 pm
Up
Cure Pikachu
User
Offline Off
@user princeofpersia: You did not call anything like
playerlist = player(0,"table")
so your code will just bug out at line 18. Just do what user KingShadow and user px20 did with the looping.

Let's not forget that once objectives are thrown into the picture, CTs can win in a variety of ways that isn't killing the opposition (see cs2d lua hook endround). If you want to factor that, try this:
Code:
1
2
3
4
5
6
7
8
addhook("endround","end_hook")
function end_hook(mode)
     if mode == 2 or mode == 22 or (mode%10 == 1 and mode > 1) then
          for _, id in pairs(player(0,"team2")) do
               coins[id] = coins[id] + 100
          end
     end
end
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
16.07.18 01:42:00 pm
Up
tos12345678
User
Offline Off
Thanks
To the start Previous 1 Next To the start