English Script Needed

16 replies
Goto Page
To the start Previous 1 Next To the start
15.04.16 10:02:46 am
Up
3r
User
Offline Off
yoyo my friends of this 2d shooter,

i have no idea of scripting and honestly too busy with job and other stuff to learn it. To make it short i need a script which should contain the following points.

- each player spawns with a deagle every round
- every player has 800$ at the start of every round
- you can only buy equipment (except tactical shield)

if someone could do that, i would be really thankfull

regards rav3r
15.04.16 10:08:49 am
Up
Rygna
User
Offline Off
Maybe, i just can give you This.
this is from sample scripts.

Code:
1
2
3
4
5
addhook("startround" , "UseDeagle")
function UseDeagle(id)
     parse("equip "..id.." 3")
     parse("setweapon "..id.." 3")
end
Begone.
15.04.16 10:24:22 am
Up
Yates
Reviewer
Offline Off
@user Rygna: Never use equip in the spawn hook, it may lead to problems as stated on the help page.

Code:
1
2
3
4
5
6
7
function _spawn(id)
  parse("setmoney "..id.." 800")
  return "3"
end
addhook("spawn", "_spawn")

parse("mp_buymenu '56, 57, 58, 59, 61, 62'")

You can also add the ID 60 to the list, it will allow people to buy the gasmask, which is also seen as an equipment item.
15.04.16 01:11:21 pm
Up
Bowlinghead
User
Offline Off
cs2d cmd mp_unbuyable 41 is also an option
Share time limited free games here
15.04.16 01:30:07 pm
Up
Yates
Reviewer
Offline Off
@user Bowlinghead:

Quote:
- you can only buy equipment (except tactical shield)
15.04.16 01:56:33 pm
Up
Rainoth
Moderator
Offline Off
@user Yates: I'll assume you didn't read the command properly.
You do: "Lets allow to buy equipment with these IDs"
While he does "Lets allow to buy equipment without this ID"

It's essentially the same, just a matter of writing more IDs.

If user 3r wants ONLY the equipment and not other weapons to be sold then user Yates' command fits better here.
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
15.04.16 03:30:28 pm
Up
Yates
Reviewer
Offline Off
Oh right yeah, totally misread.
16.04.16 01:36:20 am
Up
3r
User
Offline Off
is it also possible to let cts respawn with a defuse kit? can i just include the kit in there or does it lead to any probs when it tries to let tts respawn with a kit?
16.04.16 01:55:26 am
Up
Rainoth
Moderator
Offline Off
I believe attempting to equip equipment (only equipment) will fail and print a message in console saying that it would "lead to problems". There are workarounds though.
MAL • DeviantArt • For Wallpaper Engine users • Check YT for playlists... •
16.04.16 03:05:02 am
Up
VADemon
User
Offline Off
@user 3r: you can use file cs2d [ADMN] TooManyWeapons 1.3b (42)'s internal function "TMW.equipUnequipable(id, itemID)" that can give items like defuse kits to players. I don't know how it will work if you call it immediately inside the spawn hook, so you better delay this equip with cs2d lua cmd timer

PS: Ah you can't script. Ok.
Code:
1
2
3
4
5
6
7
8
9
10
addhook("spawn", "vademon_equip_defusekit", -10)
function vademon_equip_defusekit(id)
     if TMW then     -- TMW installed / loaded?
          if player(id, "team") == 2 then     -- CT Team?
               TMW.equipUnequipable(id, 56)     -- 56 = defuse kit ID
          end
     else
          print("[ERROR] vademon_equip_defusekit - TooManyWeapons is not installed!")
     end
end
22.04.16 06:28:44 am
Up
3r
User
Offline Off
VADemon

no thx, its gonna be far too complicated and i need to be 100% sure that it works.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("spawn","_spawn")
function _spawn(id)
     parse("strip "..id.." 1")
     parse("strip "..id.." 2")
     parse("setweapon "..id.." 3")
     parse("setweapon "..id.." 56")
end

addhook("buy","_buy")
function _buy(id,weapon)
     msg2(id,"©255000000You can't buy any weapons.")
return 1
end


^thats how i got so far. The only thing left to add is that they can't buy anything. And also they dont spawn with a deagle or defuse kit. Someone sees the fault?
22.04.16 06:42:27 am
Up
GeoB
Moderator
Offline Off
Setweapon command isn't that good within the spawn hook. Just return those ID values (check the cs2d lua hook spawn hook reference).
22.04.16 07:15:48 am
Up
tontonEd
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
function _spawn(id)
  parse("setmoney "..id.." 800")
  if player(id,"team")== 1 then
     return "3"
  elseif player(id,"team")== 2 then
     return "3,56"
  else
     return ""
  end 
end
addhook("spawn", "_spawn")

parse('mp_buymenu "|||||51,52,53,54,57,58,59"')


I edited Yates's solution, it works for me.
22.04.16 10:51:12 am
Up
3r
User
Offline Off
Dunno whats wrong but it still doesnt work for me. What i need is only a few things now:

- spawn with deagle (old guns removed)
- cts spawn with kit
- no buying allowed
22.04.16 11:41:13 am
Up
Yates
Reviewer
Offline Off
@user 3r: What is not working for you?
22.04.16 01:01:04 pm
Up
Hajt
User
Offline Off
user 3r has written:
Dunno whats wrong but it still doesnt work for me. What i need is only a few things now:

- spawn with deagle (old guns removed)
- cts spawn with kit
- no buying allowed

Maybe doesn't work because you're using two smilar scripts, try it:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
rav3r = {}

addhook("buy","rav3r.buy",666)
function rav3r.buy()
   return 1
end

addhook("spawn","rav3r.spawn",666)
function rav3r.spawn(id)
   if player(id,"team") == 2 then
      return "3,56"
   else
      return "3"
   end
end
22.04.16 01:07:25 pm
Up
3r
User
Offline Off
works perfectly,

thanks to everyone who (tried) help(ing)ed me
To the start Previous 1 Next To the start