English Custom Attack Machete

9 replies
Goto Page
To the start Previous 1 Next To the start
20.02.11 05:06:09 pm
Up
Blacko
User
Offline Off
Hello all !
I need a script.
>When I use Machete, an explosion appear where I hit If you prefer, it's the same of RP... And just USGN list can use Machete explosion, for other it's basic Machete... Thanks for help me !
iDios.
IMG:http://www.web-modules.net/upload/cache/userbar/123/452.gif
IMG:http://www.web-modules.net/upload/cache/userbar/124/277.gif
20.02.11 06:17:05 pm
Up
Robotic-Brain
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
admins={YOUR USGN, XXXXX, YYYYY}
addhook("hit","hithook")
function hithook(id, source, weapon)
     if (searchArray(admins,source) and weapon == 69) then
          parse("explosion "..player(id,"x").." "..player(id,"y").." 64 10 "..source)
     end
end

function searchArray(array,value)
     for k,v in pairs(array) do
          if v==value then return true end
     end
     return false
end


not tested

for the oter params:
http://cs2d.com/help.php?cat=all&cmd=explosion#cmd

did you want it like that?
20.02.11 06:41:16 pm
Up
EngiN33R
Moderator
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
addhook("attack","a")
function a(id)
     local rot = player(id,"rot")
        if rot < -90 then rot = rot + 360 end
     local rad = math.rad(math.abs( rot + 90 )) - math.pi
     local x = player(id,"x") + math.cos(rad) * 56
        local y = player(id,"y") + math.sin(rad) * 56
     if (player(id,"weapon")==69) then
          parse("explosion "..x.." "..y.." 64 10 "..id)
     end
end


This is the function. The explosion appears 56 pixels away from the player. You can adjust it.
I didn't put any RP functions, you'll put them yourself if you want to.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
20.02.11 06:57:07 pm
Up
Blacko
User
Offline Off
Thanks, but don't work :s
IMG:http://www.web-modules.net/upload/cache/userbar/123/452.gif
IMG:http://www.web-modules.net/upload/cache/userbar/124/277.gif
20.02.11 07:01:39 pm
Up
Robotic-Brain
User
Offline Off
which?

EngiN33Rs mine or both?

they should both work
20.02.11 07:25:04 pm
Up
Blacko
User
Offline Off
Your, because for Engin33R I don't understand
IMG:http://www.web-modules.net/upload/cache/userbar/123/452.gif
IMG:http://www.web-modules.net/upload/cache/userbar/124/277.gif
20.02.11 08:06:23 pm
Up
EngiN33R
Moderator
Offline Off
Are you stupid? Just copy my code into a script and run it on your server, that's all, what didn't you understand?
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
20.02.11 08:08:34 pm
Up
Yates
Reviewer
Offline Off
People these days, copy the script then put in this file..
counter strike-2d/sys/lua/server
Put it in there..
The "server", open it with notepad then just paste the script..
edited 1×, last 20.02.11 08:17:02 pm
20.02.11 08:12:57 pm
Up
Robotic-Brain
User
Offline Off
ah of course

Code:
1
2
3
4
5
function hithook(id, source, weapon)
     if (searchArray(admins,player(source,"usgn")) and weapon == 69) then
          parse("explosion "..player(id,"x").." "..player(id,"y").." 64 10 "..source)
     end
end


i forgot to take the usgn istead the id value
20.02.11 11:01:33 pm
Up
Blacko
User
Offline Off
Thanks !
IMG:http://www.web-modules.net/upload/cache/userbar/123/452.gif
IMG:http://www.web-modules.net/upload/cache/userbar/124/277.gif
To the start Previous 1 Next To the start