Welcome to Open Carnage

A resource for modders and technology enthusiasts; have a wander to see why we're worth the time! EST. 2012

Sign in to follow this  
Followers 0
LIMONconSAL

Edit to script

Good afternoon, how could I run these scripts, is a script but I just want to rescue these two functions that come in the OnPlayerDie (PlayerIndex, KillerIndex)
Someone who could help me thanks a lot, my sv is rocket with no shield:

elseif last_damage[PlayerIndex] == frag_explode then
                    execute_command('say * "$name muerto con una granada de $kname"', PlayerIndex)

                    elseif last_damage[PlayerIndex] == rocket_melee then
                    execute_command('say * "$name ha recibido una nalgada de $kname"', PlayerIndex)
                    if back_tap[PlayerIndex] then -- backtap: melee from behind/top (rarely registers, if ever)
                        execute_command('say me "$name sobate!"', PlayerIndex)                
                        back_tap[PlayerIndex] = false
                    end    

Share this post


Link to post
Share on other sites

Members of Open Carnage never see off-site ads.

10 hours ago, LIMONconSAL said:

Good afternoon, how could I run these scripts, is a script but I just want to rescue these two functions that come in the OnPlayerDie (PlayerIndex, KillerIndex)
Someone who could help me thanks a lot, my sv is rocket with no shield:

elseif last_damage[PlayerIndex] == frag_explode then
                    execute_command('say * "$name muerto con una granada de $kname"', PlayerIndex)

                    elseif last_damage[PlayerIndex] == rocket_melee then
                    execute_command('say * "$name ha recibido una nalgada de $kname"', PlayerIndex)
                    if back_tap[PlayerIndex] then -- backtap: melee from behind/top (rarely registers, if ever)
                        execute_command('say me "$name sobate!"', PlayerIndex)                
                        back_tap[PlayerIndex] = false
                    end    

 

First off you should move back tap handling right to OnDamageApplication since a backtap is going to be a one hit kill no matter what and this way is way more accurate.

Backtap_msg = "has backtapped"

function OnDamageApplication(PlayerIndex, Causer, MetaID, Damage, HitString, Backtap)
	if Causer then	
		if Backtap then
			say_all(get_var(Causer, "$name") .. " " .. Backtap_msg .. " " .. get_var(PlayerIndex, "$name"))
		end
	end
end

 

Tucker933 likes this

Share this post


Link to post
Share on other sites
On 1/27/2017 at 10:31 AM, LIMONconSAL said:

It does not work, I do not know what to do

Please send your script so we know what we are trying to help you with.

Share this post


Link to post
Share on other sites
6 hours ago, LIMONconSAL said:

The message does not appear only I get the shield which I do not want I just want a message when you kill someone with a blow

 

ohko.lua

 

This is a script by 002.  So if you want to report a bug in his script you should go to the release page of the script and let him know.  Anyway if you only want it to report backtaps then this is all you need.  Anything else requires a bit more.
Edit: This replaces the entire other script if its what you want, just copy/paste it into notepad and save it as a .lua file.


MESSAGE = "%s was killed in one hit by %s!"-- Message to display

api_version = "1.10.0.0"

function OnScriptLoad()
	register_callback(cb['EVENT_DAMAGE_APPLICATION'],"OnDamage")
end

function OnScriptUnload()  end

function OnDamage(PlayerIndex, Causer, MetaID, Damage, HitString, Backtap)
	if Backtap then
		say_all(string.format(MESSAGE, get_var(PlayerIndex, "$name"), get_var(Causer, "$name")))
	end
end

 

Edited by Devieth
Tucker933 likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0
  • Recently Browsing   0 members

    No registered users viewing this page.