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

    1. GTANet.com

    1. GTA Online

      1. Los Santos Summer Special
      2. The Diamond Casino Heist
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

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

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA VI

      1. St. Andrews Cathedral
    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

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

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

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

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

    1. Announcements

    2. Support

    3. Suggestions

Kucikuc24

Never Wanted

Recommended Posts

Kucikuc24

Hi. Pls can you help me with never wanted level ?

I dont know how to creat code for it. I was try somethink, but it worked only as Clean Wanted Level.

 

Please ! I really need it !

 

Share this post


Link to post
Share on other sites
sjaak327

I told you before, never wanted works if you clear the wanted level contineously in tick:

 

 

if (Never_Wanted==1) 	{ 	u32 playerIndex = ConvertIntToPlayerIndex(GetPlayerId()); 	if (IsWantedLevelGreater(playerIndex,0) ==1) 	{ 	AlterWantedLevel(playerIndex,0); 	ApplyWantedLevelChangeNow(playerIndex); 	} 	}

 

This code needs to be placed in void CustomThread::RunTick()

 

To enable /disable, set Never_Wanted to 0 for disable and 1 for enable.

 

 

Share this post


Link to post
Share on other sites
Kucikuc24

0k i have it in tick but what now ?

Share this post


Link to post
Share on other sites
sjaak327

That's it. Now when the player gets a wanted level, it gets reduced immediately.

 

 

Share this post


Link to post
Share on other sites
Kucikuc24

i need code for enable/disable never wanted...i was try somethink but it work only as clear wanted level...

Share this post


Link to post
Share on other sites
sjaak327
i need code for enable/disable never wanted...i was try somethink but it work only as clear wanted level...

This is the closest you will ever get, there is no native that will work as never wanted, so you clear the level when it occurs.

 

Works perfectly fine.

 

 

Share this post


Link to post
Share on other sites
Kucikuc24

0k but i need code for run this code...

Share this post


Link to post
Share on other sites
sjaak327

in the default state:

 

 

if ((GetAsyncKeyState(VK_F1) & 1) != 0){        if (Never_Wanted==0)        {        Never_Wanted=1;        }        else        {        Never_wanted=0;        }}

 

Share this post


Link to post
Share on other sites
Kucikuc24

OMG it still doesnt working...

this is my code:

 

void CustomFiberThread::RunScript(){ if (isNeverWanted) {  LogInfo("Never Wanted enabled");  u32 playerIndex = ConvertIntToPlayerIndex(GetPlayerId());  if (IsWantedLevelGreater(playerIndex,0) ==1)     {   AlterWantedLevel(playerIndex,0);   ApplyWantedLevelChangeNow(playerIndex);     } }while(IsThreadAlive()){       if ((GetAsyncKeyState(VK_F1) & 1) != 0)       { 	{   	NeverWantedOn = !NeverWantedOn;   	const ch *displayString = (NeverWantedOn ? "Never Wanted enabled" : "Never Wanted disabled");   	PrintStringWithLiteralStringNow("STRING", displayString, 2000, 1);   	Wait(550);   }   if(NeverWantedOn)   {   	if(!isNeverWanted)   	{     LogInfo("Never Wanted enabled");     isNeverWanted = true;   	}   }    else   {   	if(isNeverWanted)   	{     isNeverWanted = false;        }           }

 

Share this post


Link to post
Share on other sites
Kucikuc24

BUMP*: pls help me !!!!!!!!!!!!!

Share this post


Link to post
Share on other sites
Erem

This isn't a programming language I have any experience in so this may be a case of the blind leading the blind, but...

 

1) The code Sjaak gave you should do what you want, as far as I can tell. The only thing it doesn't do is display a message when Never Wanted mode is enabled or disabled;

2) Decide whether you're going to call your variable Never_Wanted, NeverWantedOn, or isNeverWanted and use that name throughout. You are using two different variables to perform the same task;

3) Make sure that you have as many { as }. Your code has 10 { but only 7 }.

 

This should go in void CustomThread::RunTick()

 

if (Never_Wanted == 1){ u32 playerIndex = ConvertIntToPlayerIndex(GetPlayerId()); if (IsWantedLevelGreater(playerIndex,0) == 1) {   AlterWantedLevel(playerIndex,0);   ApplyWantedLevelChangeNow(playerIndex); }}

In English: If Never Wanted mode is enabled and the player has a wanted level, remove the wanted level.

 

I think the rest of your code ought to look something like this:

while(IsThreadAlive()){ if ((GetAsyncKeyState(VK_F1) & 1) != 0) {   Never_Wanted = !Never_Wanted;   const ch *displayString = (Never_Wanted ? "Never Wanted enabled" : "Never Wanted disabled");   PrintStringWithLiteralStringNow("STRING", displayString, 2000, 1);   LogInfo(displayString);   Wait(550); }}

In English: Repeatedly check to see if F1 is pressed. If it is, toggle Never Wanted mode (i.e. if it is on, turn it off; if it's off, turn it on) and then display whether Never Wanted mode is now enabled or disabled.

 

I think Never_Wanted = !Never_Wanted should work. If it doesn't, replace it with the following (as in Sjaak's example):

if (Never_Wanted == 0){ Never_Wanted = 1;}else{ Never_Wanted=0;}

 

I hope that helps.

 

Sjaak (or anyone else), please correct me if I'm talking nonsense. blush.gif

Share this post


Link to post
Share on other sites
Kucikuc24

i can you give me identifier for Never_Wanted ?

Share this post


Link to post
Share on other sites
sjaak327
i can you give me identifier for Never_Wanted ?

int Never_Wanted in this care, or use a bool if you feel more comfortable with bools.

 

 

Share this post


Link to post
Share on other sites
Kucikuc24

Never_Wanted = true

Share this post


Link to post
Share on other sites
sjaak327
Never_Wanted = true

?

 

This is standard C++, if you use never_wanted =true, then you would declare bool never_wanted.

 

http://www.cplusplus.com

 

Maybe read a bit of the above ?

 

Share this post


Link to post
Share on other sites
Kucikuc24

how i must declare Never_Wanted ? for example i was declared godmod:

 

GodModOn = trueisGodmod = false

 

Edited by Kucikuc24

Share this post


Link to post
Share on other sites
Kucikuc24

OMG it doest work !

 

void CustomFiberThread::setDefaultValues(){NeverWantedOn = true;}void CustomFiberThread::RunScript(){ if (NeverWantedOn == 1) {  LogInfo("Never Wanted enabled");  u32 playerIndex = ConvertIntToPlayerIndex(GetPlayerId());  if (IsWantedLevelGreater(playerIndex,0) ==1)     {   AlterWantedLevel(playerIndex,0);   ApplyWantedLevelChangeNow(playerIndex);     } }while(IsThreadAlive()){if ((GetAsyncKeyState(VK_F7) & 1) != 0)       { 	if (NeverWantedOn == 0) 	{   NeverWantedOn = 1;           }           else           {               NeverWantedOn=0;           }   	Wait(550);       }

 

Share this post


Link to post
Share on other sites
DisorderX

Download ScriptHookDotNet and look in scripts/For Developers folder, in CS files there is a file called TestScripts.cs

 

There is a "neverwanted" script in there and it looks like it has adjustment to wantedfactor which stops it happening totally I believe (though I havent tested it)

 

Its hazardX's make sure you ask him if you plan on using it.

Share this post


Link to post
Share on other sites
Kucikuc24

i cant find it...just help me with this...

Share this post


Link to post
Share on other sites
DisorderX

Bloody hell lazy bum, guess I have to do all the work for you.

 

From SHDN\scripts\for Developers\TestScriptCS\Scripts:

 

 

 // ### Press O to keep the wanted level at zero ###  public class PoliceScript : Script {     bool bNoPolice = false;     public PoliceScript() {        Interval = 250;        this.Tick += new EventHandler(this.PoliceScript_Tick);        this.KeyDown += new GTA.KeyEventHandler(this.PoliceScript_KeyDown);     }     private void PoliceScript_Tick(object sender, EventArgs e) {        if ((bNoPolice) && (Player.WantedLevel > 0))           Player.WantedLevel = 0;     }     private void PoliceScript_KeyDown(object sender, GTA.KeyEventArgs e) {        if (e.Key != Keys.O) return;        bNoPolice = !bNoPolice;        if (bNoPolice) {           Player.WantedLevel = 0;           Game.WantedMultiplier = 0.0F;           Game.DisplayText("Police will ignore you!");        } else {           Game.WantedMultiplier = 1.0F;           Game.DisplayText("Police will NOT ignore you!");        }     }  }

 

Share this post


Link to post
Share on other sites
Kucikuc24

OMG DisorderX !

I creat my own code by your code and it work !!!!!!

This is my code:

 

using namespace Scripting;bool NeverWanted = false;void CustomFiberThread::RunScript(){if ((NeverWanted) && (IsWantedLevelGreater(GetPlayer(),0)))   { AlterWantedLevel(GetPlayer(),0);  ApplyWantedLevelChangeNow(GetPlayer());   }while(IsThreadAlive()){if ((GetAsyncKeyState(VK_F7) & 1) != 0)       { 	NeverWanted = !NeverWanted; 	if (NeverWanted) 	{   AlterWantedLevel(GetPlayer(),0);          ApplyWantedLevelChangeNow(GetPlayer());   SetWantedMultiplier(0);   PrintStringWithLiteralStringNow("STRING","Never Wanted enabled",2000,1);           } 	else  	{   SetWantedMultiplier(1);   PrintStringWithLiteralStringNow("STRING","Never Wanted disabled",2000,1);           } }Wait(100);       }

 

Big THX and respect ++ smile.gif

Edited by Kucikuc24

Share this post


Link to post
Share on other sites
DisorderX

It was hazard's script so dont thank me hehe Shifty41s_beerhatsmilie2.gif

Share this post


Link to post
Share on other sites
Kucikuc24

but your idea for use it smile.gif THX smile.gif

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.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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