Jump to content

trigger if statement on kill


Wiebrendh

Recommended Posts

In singeplayer is tjere an option to trigger an if statement when you kill someone, could not find sh*t on google..

*there

Link to comment
Share on other sites

LordOfTheBongs

u really should download ilspy and try to figure it out ;)

 

koqm.png

 

obviously u would need to check more than once... so use a tick event (There's alotta gta scripts out there u can look at for examples... use ilspy to decompile .net scripts, u need to learn by looking at other people's scripts and connecting the dots)

Link to comment
Share on other sites

u really should download ilspy and try to figure it out ;)

 

koqm.png

 

obviously u would need to check more than once... so use a tick event (There's alotta gta scripts out there u can look at for examples... use ilspy to decompile .net scripts, u need to learn by looking at other people's scripts and connecting the dots)

 

Oke, i downloaded it, and it works fine :D

 

But when i try to use it in here:

    public class NotifyKill : Script    {        bool KilledChar = false;                public NotifyKill()        {            Interval = 1000;            this.Tick += new EventHandler(testTick);        }        public void testTick(object sender, EventArgs e)        {            KilledChar = GTA.Native.Function.Call<bool>("IS_CHAR_DEAD");            Game.DisplayText(Convert.ToString(KilledChar));        }    }

But when i load the game, the bool KilledChar is already true..??

Please help

Edited by Wiebrendh
Link to comment
Share on other sites

LordOfTheBongs

why are u using the native when u can see the scripthookdotnet has a property in the ped class for u to use?

 

and ur using the native wrong... look at how the scripthookdotnet uses the native and then look what ur doing

 

this isnt even checking a ped btw... GTA.Native.Function.Call<bool>("IS_CHAR_DEAD");

 

i assume this code will give u access violations eventually, u usually get those when u use natives wrong

 

anways... read this... http://www.gtamodding.com/index.php?title=IS_CHAR_DEAD

 

so after reading i know u need to do this...

 

GTA.Native.Function.Call<bool>("IS_CHAR_DEAD", thePedHere);

 

u need to check what arguments are required by natives, if u use wrong u screw up the game's memory

Edited by LordOfTheBongs
Link to comment
Share on other sites

why are u using the native when u can see the scripthookdotnet has a property in the ped class for u to use?

 

and ur using the native wrong... look at how the scripthookdotnet uses the native and then look what ur doing

 

this isnt even checking a ped btw... GTA.Native.Function.Call<bool>("IS_CHAR_DEAD");

 

i assume this code will give u access violations eventually, u usually get those when u use natives wrong

 

anways... read this... http://www.gtamodding.com/index.php?title=IS_CHAR_DEAD

 

so after reading i know u need to do this...

 

GTA.Native.Function.Call<bool>("IS_CHAR_DEAD", thePedHere);

 

u need to check what arguments are required by natives, if u use wrong u screw up the game's memory

When i use this, the thePedHere is under a red line..

Edited by Wiebrendh
Link to comment
Share on other sites

LordOfTheBongs

 

why are u using the native when u can see the scripthookdotnet has a property in the ped class for u to use?

 

and ur using the native wrong... look at how the scripthookdotnet uses the native and then look what ur doing

 

this isnt even checking a ped btw... GTA.Native.Function.Call<bool>("IS_CHAR_DEAD");

 

i assume this code will give u access violations eventually, u usually get those when u use natives wrong

 

anways... read this... http://www.gtamodding.com/index.php?title=IS_CHAR_DEAD

 

so after reading i know u need to do this...

 

GTA.Native.Function.Call<bool>("IS_CHAR_DEAD", thePedHere);

 

u need to check what arguments are required by natives, if u use wrong u screw up the game's memory

When i use this, the thePedHere is under a red line..

 

 

and why wouldnt it be underlined in red? u never declared this variable in your script so visual studio is telling u this... just read the error, hopefully u know how to open the error dialog in visual studio, it is pretty important because it will tell u what is wrong in your syntax

 

here is a tip since you are new... STOP COPYING AND PASTING CODE EXAMPLES YOU FIND AND WRITE YOURSELF

 

visual studio will teach you stuff about what your doing as u type

 

;D

Edited by LordOfTheBongs
Link to comment
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
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.