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. Diamond Casino & Resort
      2. DLC
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    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  
marhex

[Q] prison mod

Recommended Posts

marhex

what i need to do is a prison mod.

and i need to test is the player is arrested or not.

if he is arrested i whoud like to spawn hin in the prison.

and i use c#

Edited by marhex

Share this post


Link to post
Share on other sites
SYNTHES1SE

That would be easy enough to do,

 

basically, check if player is arrested in your onTick event, if so, teleport player to the prison (youll need to find its coords).

 

the only problem i can see is that when youre in the prison you automatically get a star rating (2 or 3 stars by memory), so youll need to check if youre in there because youve been arrested, then constantly be setting your star rating to 0, unless you start a fight or something in prison.

 

Its not a bad idea, Keep us updated id love to try it out.

Share this post


Link to post
Share on other sites
marhex

That would be easy enough to do,

 

basically, check if player is arrested in your onTick event, if so, teleport player to the prison (youll need to find its coords).

 

the only problem i can see is that when youre in the prison you automatically get a star rating (2 or 3 stars by memory), so youll need to check if youre in there because youve been arrested, then constantly be setting your star rating to 0, unless you start a fight or something in prison.

 

Its not a bad idea, Keep us updated id love to try it out.

but when i teleported to prison i get the arrested screen then i was teleported again to the polise station

Share this post


Link to post
Share on other sites
SYNTHES1SE

youre being immediately arrested again? or are you naturally being arrested and then it doesnt work?

 

id reccomend checking if your mod is still running and hasnt crashed.

Share this post


Link to post
Share on other sites
marhex

youre being immediately arrested again? or are you naturally being arrested and then it doesnt work?

 

id reccomend checking if your mod is still running and hasnt crashed.

my mod still running and when i was arrested i teloported to the prison then the arrest screen show up then i was in the police station

Share this post


Link to post
Share on other sites
SYNTHES1SE

ok i get it, Im at work so cant check code, but youll probably want to do something like this:

 

1. Store a global variable: Boolean isArrested

 

2. in your onTick method, do the following:

Bool isCurrentlyBeingArrested = Function.call<Bool>(Hash.IS_PLAYER_BEING_ARRESTED, player, 0)if(isArrested && !isCurrentlyBeingArrested){    //first point since being arrested    //Teleport player to prison}isArrested = isCurrentlyBeingArrested;

Although that doesnt explain why your code didnt work, Although without seeing it its hard fro me to tell. Try this, and if it doesnt work, maybe post your code.

Share this post


Link to post
Share on other sites
stormy.scp
Although that doesnt explain why your code didnt work,

 

Little game mechanics:

There is a state machine hardcoded in the exe, that handles internally the player state: Playing, Dead, Arrested, Respawn...

And there are the scripts controlling the game from outside, actually unmodifiable, encrypted files. (But decrypted for reading... Alex :inlove:)

The lines below are from the respawn_controller.c4, the main loop:

 

while (1) {

if (l_2C == 0) {

if (PED::IS_PED_INJURED(PLAYER::PLAYER_PED_ID()) || PLAYER::IS_PLAYER_BEING_ARRESTED(PLAYER::PLAYER_ID(), 0)) {

l_67 = 0;

l_2C = 1;

...

To show some number: Search through the script files: "arrested" 970 hits in 298 files / 709 files total, but only some of them are loaded at the same time.

 

When you are in Story mode the respawn_controller is loaded (if you are not in a mission, that's sure), and if you teleport the player to the prison, then that event changes the player state to arrested.

After this the internal and scripted functions will start the respawn process.

Edited by stormy.scp

Share this post


Link to post
Share on other sites
marhex

 

Although that doesnt explain why your code didnt work,

 

Little game mechanics:

There is a state machine hardcoded in the exe, that handles internally the player state: Playing, Dead, Arrested, Respawn...

And there are the scripts controlling the game from outside, actually unmodifiable, encrypted files. (But decrypted for reading... Alex :inlove:)

The lines below are from the respawn_controller.c4, the main loop:

 

while (1) {

if (l_2C == 0) {

if (PED::IS_PED_INJURED(PLAYER::PLAYER_PED_ID()) || PLAYER::IS_PLAYER_BEING_ARRESTED(PLAYER::PLAYER_ID(), 0)) {

l_67 = 0;

l_2C = 1;

...

To show some number: Search through the script files: "arrested" 970 hits in 298 files / 709 files total, but only some of them are loaded at the same time.

 

When you are in Story mode the respawn_controller is loaded (if you are not in a mission, that's sure), and if you teleport the player to the prison, then that event changes the player state to arrested.

After this the internal and scripted functions will start the respawn process.

 

i will chack this out

thx

 

can'i clear all the prison of cops and i spawn some to controle them

and if yes how to clear them

Edited by marhex

Share this post


Link to post
Share on other sites
marhex

this is my code

if (Function.Call<bool>(Hash.IS_PLAYER_BEING_ARRESTED, Game.Player, true))
{
Script.Wait(120);

if (Function.Call<bool>(Hash.IS_PLAYER_BEING_ARRESTED, Game.Player, true))
{
Game.Player.Character.Position = new Vector3(1637.856f, 2608.986f, 45.56487f);
Game.Player.Character.Heading = 4.873306f;

}

}

Edited by marhex

Share this post


Link to post
Share on other sites
leftas

Just kill/terminate the respawn controller and you won't get arrested, is that so hard to do?

To get/control all those cops' peds you can use either GET_PED_NERBY_PEDS(like ScriptHookV does) or GET_CLOSEST_PED or either GET_RANDOM_PED_AT_COORD, because with two lasts you can specify type. If you just want to clear them use CLEAR_AREA_OF_PEDS.

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
marhex

Just kill/terminate the respawn controller and you won't get arrested, is that so hard to do?

To get/control all those cops' peds you can use either GET_PED_NERBY_PEDS(like ScriptHookV does) or GET_CLOSEST_PED or either GET_RANDOM_PED_AT_COORD, because with two lasts you can specify type. If you just want to clear them use CLEAR_AREA_OF_PEDS.

 

All the best,

Paul.

 

how to terminate the respawn controller

 

Share this post


Link to post
Share on other sites
leftas

...

TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
stormy.scp

Just kill/terminate the respawn controller and you won't get arrested, is that so hard to do?

 

Please try out what you suggested and see what happens, let the police to catch you...

Share this post


Link to post
Share on other sites
leftas

 

Just kill/terminate the respawn controller and you won't get arrested, is that so hard to do?

 

Please try out what you suggested and see what happens, let the police to catch you...

 

Sorry, I misread that part. I thought he wanted that it won't show busted screen.

Anyway, maybe try set wanted level to zero.

 

All the best,

Paul.

Share this post


Link to post
Share on other sites
marhex

 

Just kill/terminate the respawn controller and you won't get arrested, is that so hard to do?

 

Please try out what you suggested and see what happens, let the police to catch you...

 

i teleported to the prison and the garde never attacked me.

but the prisoners they flee from me or attack me.

and how to make my ped in prison clothes

Edited by marhex

Share this post


Link to post
Share on other sites
Jitnaught

i teleported to the prison and the garde never attacked me.

but the prisoners they flee from me or attack me.

and how to make my ped in prison clothes

Read your own topic.

Edited by LetsPlayOrDy

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.
Note: Your post will require moderator approval before it will be visible.

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.