Help with LUA Scripts
+9
ZxC
_Yank
Nighthawk
zAzz
Soushiant.iR
Mommy123
piWi.
cracker22
alaa
13 posters
Page 2 of 2
Page 2 of 2 • 1, 2
Re: Help with LUA Scripts
- Code:
addhook("projectile","_projectile")
function _projectile(id,weapon,x,y)
if (weapon==86) then
local gut = math.random(1,91)
parse("spawnitem "..gut.." "..x.." "..y)
elseif (weapon==54) then
local flare = math.random(25,91)
parse("spawnitem "..flare.." "..x.." "..y)
elseif (weapon==53) then
local smoke = math.random(50,91)
parse("spawnitem "..smoke.." "..x.." "..y)
end
end
Error:
- Code:
ERROR: spawnitem - position is out of map bounds!
plis help
Re: Help with LUA Scripts
@Se7en: Even though the projectile reference tells X and Y position in pixels, spawnitem only accepts tile positions. Some people tend to forget this and is the one of the main reason why CS2D triggers this issue. To fix this, simply use math.floor function from Math library for both X and Y variables. Like this:
Now it should work properly without giving any further technical error. Please, keep this in mind this tip whenever you attempt to use spawnitem command within projectile hook!
- Code:
function _projectile(id, weapon, x, y)
if (weapon == 86) then
local gut = math.random(1, 91)
parse("spawnitem ".. gut .." ".. math.floor(x/32) .." ".. math.floor(y/32))
elseif (weapon == 54) then
local flare = math.random(25, 91)
parse("spawnitem ".. flare .." ".. math.floor(x/32) .." ".. math.floor(y/32))
elseif (weapon == 53) then
local smoke = math.random(50, 91)
parse("spawnitem ".. smoke .." ".. math.floor(x/32) .." ".. math.floor(y/32))
end
end
addhook("projectile","_projectile")
Now it should work properly without giving any further technical error. Please, keep this in mind this tip whenever you attempt to use spawnitem command within projectile hook!
Re: Help with LUA Scripts
Thanks, how can you remove the effects of the flare and smoke after dropped?
This is a lottery script
This is a lottery script
Re: Help with LUA Scripts
freeprojectile frees (removes) instantly any type of a projectile if its value type is declared inside the snippet of code. You must also incorporate a timer function within freeprojectile in "function" argument parameter. Why you should do that because it makes sense: after you dropped a smoke grenade for example, why the effect must vanish instantly? Guess the answer.
So, if we want the flare effect to disappear after 12 seconds are elapsed for example, the snippet of timer function should be like this (already added in the main snippet of code anyways).
12000 = 12 seconds (in ms - milliseconds). You can change the time parameter nevertheless as you wish.
So, if we want the flare effect to disappear after 12 seconds are elapsed for example, the snippet of timer function should be like this (already added in the main snippet of code anyways).
- Code:
function _projectile(id, weapon, x, y)
if (weapon == 86) then
local gut = math.random(1, 91)
parse("spawnitem ".. gut .." ".. math.floor(x/32) .." ".. math.floor(y/32))
timer(12000, "freeprojectile", gut)
elseif (weapon == 54) then
local flare = math.random(25, 91)
parse("spawnitem ".. flare .." ".. math.floor(x/32) .." ".. math.floor(y/32))
timer(12000, "freeprojectile", flare)
elseif (weapon == 53) then
local smoke = math.random(50, 91)
parse("spawnitem ".. smoke .." ".. math.floor(x/32) .." ".. math.floor(y/32))
timer(12000, "freeprojectile", smoke)
end
end
addhook("projectile","_projectile")
12000 = 12 seconds (in ms - milliseconds). You can change the time parameter nevertheless as you wish.
Re: Help with LUA Scripts
Idk where to post this so im going for here.
Is there any helpfull advice how to change this childish new mod (wepons,skins etc.)
Much love for anyone who help me.
Is there any helpfull advice how to change this childish new mod (wepons,skins etc.)
Much love for anyone who help me.
gozugosu- Site user
- Posts : 376
Points : 413
Join date : 2015-09-07
Age : 25
Location : Home
Re: Help with LUA Scripts
gozugosu wrote:Idk where to post this so im going for here.
Is there any helpfull advice how to change this childish new mod (wepons,skins etc.)
Much love for anyone who help me.
Pretty simple fix (as long as the new update doesnt change how sprites are handled); the sprites are in \Counter-Strike 2D\gfx\player and \Counter-Strike 2D\gfx\weapons, you just have to download the old ones somewhere and replace the files. You can probably download an older version of CS2D to get em
Zer0o- Site user
- Gender : Posts : 64
Points : 76
Join date : 2015-03-16
Location : Good ol' Germania
Re: Help with LUA Scripts
open launcher.exe and select mods choose classic and go back to first tab, then create batch file and close
open the new batch file that appeared (u can create shortcut and change icon/name later)
open the new batch file that appeared (u can create shortcut and change icon/name later)
Re: Help with LUA Scripts
Both not working but yeah...thanks anyways.
If u guys know any other solution i'l be very thankfull
If u guys know any other solution i'l be very thankfull
gozugosu- Site user
- Posts : 376
Points : 413
Join date : 2015-09-07
Age : 25
Location : Home
Re: Help with LUA Scripts
Hey guys. I want this script in hc > modules > Messaging but i don't know how to make it. I hope anyone can help me. THANKS
- Code:
addhook("say","_say")
function _say(id,txt)
if string.sub(txt,1,6)=="!warn " then
local p = string.sub(txt,7)
warn_func_r(id,tonumber(p))
return 1
end
end
warn_func={}
function warn_func_r(id,p)
if player(p,"exists") then
if warn_func[p]==nil then warn_func[p]=0 end
if warn_func[p]==0 then
msg("\169255255255"..player(p,"name").." \169255255000WARNED ( 1 ) \169255255255"..player(id,"name"))
parse("slap "..p.."")
warn_func[p]=1
elseif warn_func[p]==1 then
msg("\169255255255"..player(p,"name").." \169255255000WARNED ( 2 ) \169255255255"..player(id,"name"))
parse("killplayer "..p.."")
warn_func[p]=2
elseif warn_func[p]==2 then
msg("\169255255255"..player(p,"name").." \169255255000WARNED ( 3 ) \169255255255"..player(id,"name"))
parse("kick "..p.." 'WARNS: 3'")
warn_func[p]=3
end
end
end
Re: Help with LUA Scripts
Francis this should be in the moderation file... Unless you want everyone to have access to it...
Re: Help with LUA Scripts
But this is a command, i can get it on hc.cfg that only mods and higher can use it.
Re: Help with LUA Scripts
I know... it needs to be in moderation file...
Example:
in moderation.lua
Example:
- Code:
hc.add_say_command("rcon", hc.moderation.rcon_command, hc.RCON_LEVEL, "<command>", "Execute an rcon command.")
in moderation.lua
Re: Help with LUA Scripts
1. Open messaging.lua
2. Add this line in the hc.messaging.init() function
3. Add this AFTER the hc.messaging.init() function
2. Add this line in the hc.messaging.init() function
- Code:
hc.add_say_command("warn", hc.messaging.warn_command, hc.MODERATOR1, "[<id>]", "Warn a player", true)
3. Add this AFTER the hc.messaging.init() function
- Code:
warn_func={}
function hc.messaging.warn_command(id,p)
if player(p,"exists") then
if warn_func[p]==nil then warn_func[p]=0 end
if warn_func[p]==0 then
msg("\169255255255"..player(p,"name").." \169255255000WARNED ( 1 ) \169255255255"..player(id,"name"))
parse("slap "..p.."")
warn_func[p]=1
elseif warn_func[p]==1 then
msg("\169255255255"..player(p,"name").." \169255255000WARNED ( 2 ) \169255255255"..player(id,"name"))
parse("killplayer "..p.."")
warn_func[p]=2
elseif warn_func[p]==2 then
msg("\169255255255"..player(p,"name").." \169255255000WARNED ( 3 ) \169255255255"..player(id,"name"))
parse("kick "..p.." 'WARNS: 3'")
warn_func[p]=3
end
end
end
Page 2 of 2 • 1, 2
Page 2 of 2
Permissions in this forum:
You cannot reply to topics in this forum
|
|