Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. News

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
BiiXteR

Calling hooks in C#.NET ?

Recommended Posts

BiiXteR

So, i want to know how to call hooks using c#.net.

Dees anyone know this? Should be pretty simple, right? :3

Share this post


Link to post
Share on other sites
pillow

So, i want to know how to call hooks using c#.net.

Dees anyone know this? Should be pretty simple, right? :3

google is your best friend

 

what you mean to hook?

Edited by pillow

Share this post


Link to post
Share on other sites
leftas

What hooks ? In c# you can hook by +=, bu about what hooks calling you talking about ?

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
BiiXteR

Found out how to call, however how would i change it?

Function.Call(Hash.whateveryouwanttocall, what goes here?)

And how would i example increase player wanted level by 1?

 

Function.Call(Hash.SET_PLAYER_WANTED_LEVEL)

How would i increase this by 1 each time it's called?


What hooks ? In c# you can hook by +=, bu about what hooks calling you talking about ?

All the best,
Paul.

 

 

 

So, i want to know how to call hooks using c#.net.

Dees anyone know this? Should be pretty simple, right? :3

google is your best friend

 

what you mean to hook?

 

Sorry, meant the hash thingys, read my other reply to understand what i mean better... >.<

Edited by BiiXteR

Share this post


Link to post
Share on other sites
pillow

afaik you can increase it by using ++; orr += 1 ..etc

if(GetKeystate(0x59)<0)){    int wantedlevel;    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    wantedlevel++;}orif(GetKeystate(0x59)<0)){    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    int wantedlevel;    if (wantedlevel >= 6)    {        wantedlevel= 0;    }else{	wantedlevel = wantedlevel + 1;    }}
Edited by pillow
  • Like 1

Share this post


Link to post
Share on other sites
BiiXteR

 

afaik you can increase it by using ++; orr += 1 ..etc

if(GetKeystate(0x59)<0)){    int wantedlevel;    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    wantedlevel++;}orif(GetKeystate(0x59)<0)){    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    int wantedlevel;    if (wantedlevel >= 6)    {        wantedlevel= 0;    }else{	wantedlevel = wantedlevel + 1;    }}

Ok, just what i needed! Thanks! :)

  • Like 1

Share this post


Link to post
Share on other sites
pillow

 

 

afaik you can increase it by using ++; orr += 1 ..etc

if(GetKeystate(0x59)<0)){    int wantedlevel;    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    wantedlevel++;}orif(GetKeystate(0x59)<0)){    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    int wantedlevel;    if (wantedlevel >= 6)    {        wantedlevel= 0;    }else{	wantedlevel = wantedlevel + 1;    }}

Ok, just what i needed! Thanks! :)

 

Anytime bro :santa:

Share this post


Link to post
Share on other sites
BiiXteR

 

afaik you can increase it by using ++; orr += 1 ..etc

if(GetKeystate(0x59)<0)){    int wantedlevel;    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    wantedlevel++;}orif(GetKeystate(0x59)<0)){    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    int wantedlevel;    if (wantedlevel >= 6)    {        wantedlevel= 0;    }else{	wantedlevel = wantedlevel + 1;    }}

The bool should always be false though :)

(So other people reading will know :3 )

*Edit* Didn't work, no wanted level added.

*Edit again* Works but has like a 7 second delay before it actually does something. (this seems only to be when it has 0 stars or is about to reach 0 stars)

*Edit once again* Seems to only be delayed when adding stars, removing them has no delay.

 

My current code is :

    void WantedIncrease()    {        if (wantedLevel < 5)        {            wantedLevel += 1;            Function.Call(Hash.SET_PLAYER_WANTED_LEVEL, player, wantedLevel, false);            UI.Notify("Wanted level increased by 1");        }        else        {            UI.Notify("Wanted level is already at highest possible", true);        }    }    void WantedDecrease()    {        if (wantedLevel > 0)        {            wantedLevel -= 1;            Function.Call(Hash.SET_PLAYER_WANTED_LEVEL, player, wantedLevel, false);            UI.Notify("Wanted level decreased");        }        else        {            UI.Notify("Wanted level is already at minimum level!", true);        }    }

And, the part calling it the functions is :

        var button2 = new MenuButton("Increase Wanted Level", "");        button2.Activated += (sender, args) => WantedIncrease();        menuItems.Add(button2);        var button3 = new MenuButton("Decrease Wanted Level", "");        button3.Activated += (sender, args) => WantedDecrease();        menuItems.Add(button3);
Edited by BiiXteR

Share this post


Link to post
Share on other sites
pillow

 

 

afaik you can increase it by using ++; orr += 1 ..etc

if(GetKeystate(0x59)<0)){    int wantedlevel;    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    wantedlevel++;}orif(GetKeystate(0x59)<0)){    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    int wantedlevel;    if (wantedlevel >= 6)    {        wantedlevel= 0;    }else{	wantedlevel = wantedlevel + 1;    }}

The bool should always be false though :)

(So other people reading will know :3 )

*Edit* Didn't work, no wanted level added.

*Edit again* Works but has like a 7 second delay before it actually does something. (this seems only to be when it has 0 stars or is about to reach 0 stars)

*Edit once again* Seems to only be delayed when adding stars, removing them has no delay.

 

My current code is :

        if (wantedLevel < 5)        {            wantedLevel += 1;            Function.Call(Hash.SET_PLAYER_WANTED_LEVEL, player, wantedLevel, false);            UI.Notify("Wanted level increased by 1");        }        else        {            UI.Notify("Wanted level is already at highest possible", true);        }    }    void WantedDecrease()    {        if (wantedLevel > 0)        {            wantedLevel -= 1;            Function.Call(Hash.SET_PLAYER_WANTED_LEVEL, player, wantedLevel, false);            UI.Notify("Wanted level decreased");        }        else        {            UI.Notify("Wanted level is already at minimum level!", true);        }    }

try something like this.. i modiefied it for c++, just convert it 4 C#

int wantedlevel;		wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);		PLAYER::SET_PLAYER_WANTED_LEVEL(playerIndex, wantedlevel, false);        if (wantedLevel < 5)        {            wantedLevel = wantedLevel +1;            UI.Notify("Wanted level increased by 1");        }        else        {            UI.Notify("Wanted level is already at highest possible", true);        }    }    void WantedDecrease()    {		int wantedlevel;		wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);		PLAYER::SET_PLAYER_WANTED_LEVEL(playerIndex, wantedlevel, false);        if (wantedLevel > 0)        {            wantedLevel = wantedLevel -1;            UI.Notify("Wanted level decreased");        }        else        {            UI.Notify("Wanted level is already at minimum level!", true);        }    }
Edited by pillow

Share this post


Link to post
Share on other sites
BiiXteR

 

 

 

afaik you can increase it by using ++; orr += 1 ..etc

if(GetKeystate(0x59)<0)){    int wantedlevel;    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    wantedlevel++;}orif(GetKeystate(0x59)<0)){    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    int wantedlevel;    if (wantedlevel >= 6)    {        wantedlevel= 0;    }else{	wantedlevel = wantedlevel + 1;    }}

The bool should always be false though :)

(So other people reading will know :3 )

*Edit* Didn't work, no wanted level added.

*Edit again* Works but has like a 7 second delay before it actually does something. (this seems only to be when it has 0 stars or is about to reach 0 stars)

*Edit once again* Seems to only be delayed when adding stars, removing them has no delay.

 

My current code is :

        if (wantedLevel < 5)        {            wantedLevel += 1;            Function.Call(Hash.SET_PLAYER_WANTED_LEVEL, player, wantedLevel, false);            UI.Notify("Wanted level increased by 1");        }        else        {            UI.Notify("Wanted level is already at highest possible", true);        }    }    void WantedDecrease()    {        if (wantedLevel > 0)        {            wantedLevel -= 1;            Function.Call(Hash.SET_PLAYER_WANTED_LEVEL, player, wantedLevel, false);            UI.Notify("Wanted level decreased");        }        else        {            UI.Notify("Wanted level is already at minimum level!", true);        }    }

try something like this.. i modiefied it for c++, just convert it 4 C#

int wantedlevel;		wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);		PLAYER::SET_PLAYER_WANTED_LEVEL(playerIndex, wantedlevel, false);        if (wantedLevel < 5)        {            wantedLevel = wantedLevel +1;            UI.Notify("Wanted level increased by 1");        }        else        {            UI.Notify("Wanted level is already at highest possible", true);        }    }    void WantedDecrease()    {		int wantedlevel;		wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);		PLAYER::SET_PLAYER_WANTED_LEVEL(playerIndex, wantedlevel, false);        if (wantedLevel > 0)        {            wantedLevel = wantedLevel -1;            UI.Notify("Wanted level decreased");        }        else        {            UI.Notify("Wanted level is already at minimum level!", true);        }    }

What is "playerIndex" ?

Is it a variable you forgot to add or?

Nevermind, lol.... I'm so stupid... >.<

 

 

 

afaik you can increase it by using ++; orr += 1 ..etc

if(GetKeystate(0x59)<0)){    int wantedlevel;    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    wantedlevel++;}orif(GetKeystate(0x59)<0)){    PLAYER::SET_PLAYER_WANTED_LEVEL(player, wantedlevel, true);    int wantedlevel;    if (wantedlevel >= 6)    {        wantedlevel= 0;    }else{	wantedlevel = wantedlevel + 1;    }}

The bool should always be false though :)

(So other people reading will know :3 )

*Edit* Didn't work, no wanted level added.

*Edit again* Works but has like a 7 second delay before it actually does something. (this seems only to be when it has 0 stars or is about to reach 0 stars)

*Edit once again* Seems to only be delayed when adding stars, removing them has no delay.

 

My current code is :

        if (wantedLevel < 5)        {            wantedLevel += 1;            Function.Call(Hash.SET_PLAYER_WANTED_LEVEL, player, wantedLevel, false);            UI.Notify("Wanted level increased by 1");        }        else        {            UI.Notify("Wanted level is already at highest possible", true);        }    }    void WantedDecrease()    {        if (wantedLevel > 0)        {            wantedLevel -= 1;            Function.Call(Hash.SET_PLAYER_WANTED_LEVEL, player, wantedLevel, false);            UI.Notify("Wanted level decreased");        }        else        {            UI.Notify("Wanted level is already at minimum level!", true);        }    }

try something like this.. i modiefied it for c++, just convert it 4 C#

int wantedlevel;		wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);		PLAYER::SET_PLAYER_WANTED_LEVEL(playerIndex, wantedlevel, false);        if (wantedLevel < 5)        {            wantedLevel = wantedLevel +1;            UI.Notify("Wanted level increased by 1");        }        else        {            UI.Notify("Wanted level is already at highest possible", true);        }    }    void WantedDecrease()    {		int wantedlevel;		wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);		PLAYER::SET_PLAYER_WANTED_LEVEL(playerIndex, wantedlevel, false);        if (wantedLevel > 0)        {            wantedLevel = wantedLevel -1;            UI.Notify("Wanted level decreased");        }        else        {            UI.Notify("Wanted level is already at minimum level!", true);        }    }

It did not work.

Error :

Error 2 Cannot implicitly convert type 'void' to 'int' D:\Program Files\Rockstar Games\My modfiles\ModMenu\ModMenu\ModMenu\Class1.cs 109 17
Which is this line : wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);
Edited by BiiXteR

Share this post


Link to post
Share on other sites
pillow

it's -> static int GET_PLAYER_WANTED_LEVEL(Player player) { return invoke<int>(0xE28E54788CE8F12D, player); } // 0xE28E54788CE8F12D 0xBDCDD163

 

static int, for me it works, it means you don't need to do conversion it's already static int..

 

EDIT:

 

int wantedlevel;

 

since GET_PLAYER_WANTED_LEVEL it's static int i'd do -> wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);

 

after you get wanted level increase it with method i gave you.. add me on skype: [email protected]

Edited by pillow

Share this post


Link to post
Share on other sites
BiiXteR

it's -> static int GET_PLAYER_WANTED_LEVEL(Player player) { return invoke<int>(0xE28E54788CE8F12D, player); } // 0xE28E54788CE8F12D 0xBDCDD163

 

static int, for me it works, it means you don't need to do conversion it's already static int..

 

EDIT:

 

int wantedlevel;

 

since GET_PLAYER_WANTED_LEVEL it's static int i'd do -> wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);

 

after you get wanted level increase it with method i gave you.. add me on skype: [email protected]

Hmm, i'll play around with it see if i get it working.

I don't have a mic, should i add you on skype anyways?

 

This does not work either, i think it's pretty much same as the other int problem.

        Hash maxHealth = Hash.GET_ENTITY_MAX_HEALTH;        Function.Call(Hash.SET_ENTITY_HEALTH, player, maxHealth);
Edited by BiiXteR

Share this post


Link to post
Share on other sites
pillow

 

it's -> static int GET_PLAYER_WANTED_LEVEL(Player player) { return invoke<int>(0xE28E54788CE8F12D, player); } // 0xE28E54788CE8F12D 0xBDCDD163

 

static int, for me it works, it means you don't need to do conversion it's already static int..

 

EDIT:

 

int wantedlevel;

 

since GET_PLAYER_WANTED_LEVEL it's static int i'd do -> wantedlevel = PLAYER::GET_PLAYER_WANTED_LEVEL(playerIndex);

 

after you get wanted level increase it with method i gave you.. add me on skype: [email protected]

Hmm, i'll play around with it see if i get it working.

I don't have a mic, should i add you on skype anyways?

 

This does not work either, i think it's pretty much same as the other int problem.

        Hash maxHealth = Hash.GET_ENTITY_MAX_HEALTH;        Function.Call(Hash.SET_ENTITY_HEALTH, player, maxHealth);

GET_ENTITY_MAX health just get your max health character, to increase health you have to use this native -> GET_ENTITY_HEALTH

 

edit: SET_ENTITY_HEALTH <- then use this to increase health, shud work

 

anyway yeah add me on skype

Edited by pillow

Share this post


Link to post
Share on other sites
Prof_Farnsworth

Are you writing in .net? Why not just use Player.WantedLevel = (whatever you want)?

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • 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.