Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

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

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    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. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. 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. Red Dead Redemption 2

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

    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
    1. Announcements

    2. Forum Support

    3. Suggestions

Police weapons


gtamoder1234
 Share

Recommended Posts

Hello every one im making a script that upgrades police weapons with wanted level 

 

my question is what em i missing

 

here is y code

 

 

 

{$CLEO}
{$USE ini}

wait 500

if and
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "1_Star" 
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "1_Star_gun"
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "2 Star" 
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "2_Star_gun"
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "3_Star" 
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "3_Star gun"
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "4_Star" 
0AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "4_Star gun"
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "5_Star" 
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "5_Star gun"
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "6_Star" 
8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "6_Star gun"
then
    0ACD: show_text_highpriority "Fail to read 'Change Police Weapons.ini'" time 10000
    0A93: end_custom_thread
end
 repeat
   wait 0  
    if
     010F:   player 0 wanted_level > 0
    then
       0247: load_model [email protected]       
       038B: load_requested_models
       0A8C: 0x5DDCCD 1 [email protected] 1
       0A8C: 0x68BBB7 1 [email protected] 1
    end
    if
     010F:   player 0 wanted_level > 1
    then   
       0247: load_model [email protected]       
       038B: load_requested_models
       0A8C: 0x5DDCCD 1 [email protected] 1
       0A8C: 0x68BBB7 1 [email protected] 1
    end
    if
     010F:   player 0 wanted_level > 2
    then   
       0247: load_model [email protected]       
       038B: load_requested_models
       0A8C: 0x5DDCCD 1 [email protected] 1
       0A8C: 0x68BBB7 1 [email protected] 1
    end
   if
    010F:   player 0 wanted_level > 3
   then
       0247: load_model [email protected]       
       038B: load_requested_models
       0A8C: 0x5DDCCD 1 [email protected] 1
       0A8C: 0x68BBB7 1 [email protected] 1
    end
    if
     010F:   player 0 wanted_level > 4
    then   
       0247: load_model [email protected]       
       038B: load_requested_models
       0A8C: 0x5DDCCD 1 [email protected] 1
       0A8C: 0x68BBB7 1 [email protected] 1
    end
    if
     010F:   player 0 wanted_level > 5
    then
       0247: load_model [email protected]       
       038B: load_requested_models
       0A8C: 0x5DDCCD 1 [email protected] 1
       0A8C: 0x68BBB7 1 [email protected] 1
    end

0A93: end_custom_thread
  

forgot to mention i used Junior_Djjr's Change_police_weapons script as a start point

 

Link to comment
Share on other sites

The error that stands out is too many conditions for IF AND, which I believe is limited to 8. You'll need to break this block up a little.

Link to comment
Share on other sites

how 

15 hours ago, OrionSR said:

The error that stands out is too many conditions for IF AND, which I believe is limited to 8. You'll need to break this block up a little.

how about that 

// This file was decompiled using SASCM.ini published on 2021-07-05
{$CLEO .cs}
{$USE ini}


// INI file script part

WAIT 1000 
IF and
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "1_STAR"   // Weapon number
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "1_STAR_GUN"  //Weapon Model ID
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "2 STAR"   // Weapon number
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "2_STAR_GUN"  //Weapon Model ID
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "3_STAR"   // Weapon number
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "3_STAR GUN"  //Weapon Model ID
GOTO_IF_FALSE @NONAME_389 
PRINT_STRING_NOW "FAIL TO READ 'CHANGE POLICE WEAPONS.INI'" time 10000 
TERMINATE_THIS_CUSTOM_SCRIPT 
GOTO @NONAME_767 

:NONAME_389
IF and
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "4_STAR"   // Weapon number
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "4_STAR GUN"  //Weapon Model ID
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "5_STAR"   // Weapon number
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "5_STAR GUN"  //Weapon Model ID
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "6_STAR"   // Weapon number
  not READ_INT_FROM_INI_FILE [email protected] section "CLEO\CHANGE POLICE WEAPONS.INI" key "FOOT" store_to "6_STAR GUN"  //Weapon Model ID
GOTO_IF_FALSE @NONAME_767 
PRINT_STRING_NOW "FAIL TO READ 'CHANGE POLICE WEAPONS.INI'" time 10000 
TERMINATE_THIS_CUSTOM_SCRIPT 



//Weapon Change Script Part


:NONAME_767
WAIT 200 
IF 
STORE_WANTED_LEVEL $PLAYER_CHAR store_to [email protected] 
IF 
  not [email protected] == 1 
GOTO_IF_FALSE @NONAME_957 
IF 
  not [email protected] == 2 
GOTO_IF_FALSE @NONAME_1004 
IF 
  not [email protected] == 3 
GOTO_IF_FALSE @NONAME_1051 
IF 
  not [email protected] == 4 
GOTO_IF_FALSE @NONAME_1098 
IF 
  not [email protected] == 5 
GOTO_IF_FALSE @NONAME_1145 
IF 
  not [email protected] == 6 
GOTO_IF_FALSE @NONAME_1192 
IF 
  [email protected] == 0 
GOTO_IF_FALSE @NONAME_910 

:NONAME_910
REQUEST_MODEL [email protected] 
LOAD_ALL_MODELS_NOW 
WRITE_MEMORY 6151373 size 1 value [email protected] vp 1 
WRITE_MEMORY 6863799 size 1 value [email protected] vp 1 
WAIT 1000 
GOTO @NONAME_767 

:NONAME_957
REQUEST_MODEL [email protected] 
LOAD_ALL_MODELS_NOW 
WRITE_MEMORY 6151373 size 1 value [email protected] vp 1 
WRITE_MEMORY 6863799 size 1 value [email protected] vp 1 
WAIT 1000 
GOTO @NONAME_767 

:NONAME_1004
REQUEST_MODEL [email protected] 
LOAD_ALL_MODELS_NOW 
WRITE_MEMORY 6151373 size 1 value [email protected] vp 1 
WRITE_MEMORY 6863799 size 1 value [email protected] vp 1 
WAIT 1000 
GOTO @NONAME_767 

:NONAME_1051
REQUEST_MODEL [email protected] 
LOAD_ALL_MODELS_NOW 
WRITE_MEMORY 6151373 size 1 value [email protected] vp 1 
WRITE_MEMORY 6863799 size 1 value [email protected] vp 1 
WAIT 1000 
GOTO @NONAME_767 

:NONAME_1098
REQUEST_MODEL [email protected] 
LOAD_ALL_MODELS_NOW 
WRITE_MEMORY 6151373 size 1 value [email protected] vp 1 
WRITE_MEMORY 6863799 size 1 value [email protected] vp 1 
WAIT 1000 
GOTO @NONAME_767 

:NONAME_1145
REQUEST_MODEL [email protected] 
LOAD_ALL_MODELS_NOW 
WRITE_MEMORY 6151373 size 1 value [email protected] vp 1 
WRITE_MEMORY 6863799 size 1 value [email protected] vp 1 
WAIT 1000 
GOTO @NONAME_767 

:NONAME_1192
REQUEST_MODEL [email protected] 
LOAD_ALL_MODELS_NOW 
WRITE_MEMORY 6151373 size 1 value [email protected] vp 1 
WRITE_MEMORY 6863799 size 1 value [email protected] vp 1 
WAIT 1000 
GOTO @NONAME_767 

 

 

 

Edited by gtamoder1234
Link to comment
Share on other sites

29 minutes ago, gtamoder1234 said:

my goal is to make script like...

I'm not evaluating what the script is doing, just the logic error with the IF AND statement. I was expecting something more like this:

if and
    8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "1_Star" 
    8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "1_Star_gun"
    8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "2 Star" 
    8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "2_Star_gun"
    8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "3_Star" 
    8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "3_Star gun"
then
    0ACD: show_text_highpriority "Fail to read 'Change Police Weapons.ini'" time 10000
    0A93: end_custom_thread
else
    if and
        8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "4_Star" 
        0AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "4_Star gun"
        8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "5_Star" 
        8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "5_Star gun"
        8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "6_Star" 
        8AF0: [email protected] = get_int_from_ini_file "cleo\Change Police Weapons.ini" section "Foot" key "6_Star gun"
    then
        0ACD: show_text_highpriority "Fail to read 'Change Police Weapons.ini'" time 10000
        0A93: end_custom_thread
    end
end

Note the use of code tags (<> in the edit menu).

Next time, please post modding questions in the modding forum.

 

Added: Actually, that doesn't look right either; the logic seems backwards. I'm expecting the script to end if any value can't be read, so this seems backwards. However, I don't have time to investigate further. (Oh wait, not opcode used but not included in the statement, very confusing.)

 

Update: [email protected] doesn't have the NOT opcode.

Edited by OrionSR
Link to comment
Share on other sites

I think I made a major error with my suggestion. IF OR should be used in this case; if any line fails to read then throw the error and terminate. However, the logic still seems awkward. I might try again tomorrow if you don't work it out sooner.

 

I'm concerned about the single quotes corrupting your text string. Consider doing without until the script is working properly.

 

I much preferred the high-level format used in your original script. SCR mode is fine; consider adding a comment in the header. Ctrl+H (default hotkey) can be used to convert your addresses back to the preferred hex format.

 

The linked file you posted to the VC script in the other topic was rejected as dangerous.

 

The link here was good though, and it looks like you changed the addresses to SA. If you rewrite the script to avoid the ini data, does it work properly?

 

0AF0/8AF0 I'm pretty sure that this opcode is "// IF and SET" but the opcodes don't include these notes anymore. It would be wise to verify that this opcode actually works as expected in a simpler test script, or existing scripts if you've got them.

 

It's good practice to name any script that will loop in memory. The script name is the handle used to terminate or find the script's location, etc.

 

"cleo\Change Police Weapons.ini" I doubt this is a problem as used, but if you're still getting odd errors, try limiting this string to 15 characters and/or avoiding spaces.

 

Please post your ini file.

Link to comment
Share on other sites

gtamoder1234
3 hours ago, OrionSR said:

I think I made a major error with my suggestion. IF OR should be used in this case; if any line fails to read then throw the error and terminate. However, the logic still seems awkward. I might try again tomorrow if you don't work it out sooner.

 

I'm concerned about the single quotes corrupting your text string. Consider doing without until the script is working properly.

 

I much preferred the high-level format used in your original script. SCR mode is fine; consider adding a comment in the header. Ctrl+H (default hotkey) can be used to convert your addresses back to the preferred hex format.

 

The linked file you posted to the VC script in the other topic was rejected as dangerous.

 

The link here was good though, and it looks like you changed the addresses to SA. If you rewrite the script to avoid the ini data, does it work properly?

 

0AF0/8AF0 I'm pretty sure that this opcode is "// IF and SET" but the opcodes don't include these notes anymore. It would be wise to verify that this opcode actually works as expected in a simpler test script, or existing scripts if you've got them.

 

It's good practice to name any script that will loop in memory. The script name is the handle used to terminate or find the script's location, etc.

 

"cleo\Change Police Weapons.ini" I doubt this is a problem as used, but if you're still getting odd errors, try limiting this string to 15 characters and/or avoiding spaces.

 

Please post your ini file.

i got rid of INI prat and i works like a charm

Link to comment
Share on other sites

Any luck teasing out the problems with the ini segment? It seemed like you were really close.

 

0x68BBB7 Please describe this address or provide additional reference if possible. Best as I can tell, it has something to do with where the weapon for patrol car cops is set to pistol instead of shotgun. Is this required to set weapon 2 active instead of the nightstick (weapon 1)?

 

Maybe... CarCops?
0x68BBB7 colt45
0x68BBAC chromegun (untested)

 

I found some addition reference for similar addresses:

(See also: memory topic; includes accuracy addresses)

 

Cops: 
0x5DDCBF - weapon 1 (nitestick)
0x5DDCCD - weapon 2 (colt45)

FBI:  0x5DDDE1 and 0x5DDDEA - weapon (mp5; change both)
Army: 0x5DDE21 and 0x5DDE2A - weapon (m4; change both)
Swat: 0x5DDDA1 and 0x5DDDAA - weapon (mac10; change both)

 

Please post your INI file. I don't have enough data to complete a script.

 

20 hours ago, gtamoder1234 said:

i got rid of INI prat and i works like a charm

Please post the variable assignments segment. I want to use it when the INI file isn't found.

 

Would you prefer the standard Show Opcodes format or SA SCR?

 

Edited by OrionSR
Link to comment
Share on other sites

gtamoder1234
1 hour ago, OrionSR said:

Any luck teasing out the problems with the ini segment? It seemed like you were really close.

 

0x68BBB7 Please describe this address or provide additional reference if possible. Best as I can tell, it has something to do with where the weapon for patrol car cops is set to pistol instead of shotgun. Is this required to set weapon 2 active instead of the nightstick (weapon 1)?

 

Maybe... CarCops?
0x68BBB7 colt45
0x68BBAC chromegun (untested)

 

I found some addition reference for similar addresses:

 

Cops: 
0x5DDCBF - weapon 1 (nitestick)
0x5DDCCD - weapon 2 (colt45)

FBI:  0x5DDDE1 and 0x5DDDEA - weapon (mp5; change both)
Army: 0x5DDE21 and 0x5DDE2A - weapon (m4; change both)
Swat: 0x5DDDA1 and 0x5DDDAA - weapon (mac10; change both)

 

Please post your INI file. I don't have enough data to complete a script.

 

Please post the variable assignments segment. I want to use it when the INI file isn't found.

 

Would you prefer the standard Show Opcodes format or SA SCR?

 

oh i didnt do that here is current script

[b]

// This file was decompiled using SASCM.ini published on 2021-07-05
{$CLEO .cs}

SCRIPT_NAME 'WANTED_GUNS' 

:WANTED_GUNS_19
WAIT 0 
IF 
STORE_WANTED_LEVEL $PLAYER_CHAR store_to [email protected] 
IF 
  not [email protected] == 1 
GOTO_IF_FALSE @WANTED_GUNS_198 
IF 
  not [email protected] == 2 
GOTO_IF_FALSE @WANTED_GUNS_235 
IF 
  not [email protected] == 3 
GOTO_IF_FALSE @WANTED_GUNS_272 
IF 
  not [email protected] == 4 
GOTO_IF_FALSE @WANTED_GUNS_309 
IF 
  not [email protected] == 5 
GOTO_IF_FALSE @WANTED_GUNS_346 
IF 
  not [email protected] == 6 
GOTO_IF_FALSE @WANTED_GUNS_383 
IF 
  [email protected] == 0 
GOTO_IF_FALSE @WANTED_GUNS_161 

:WANTED_GUNS_161                  //Wanted level 0
WRITE_MEMORY 6151373 size 1 value 22 vp 1 
WRITE_MEMORY 6863799 size 1 value 22 vp 1 
WAIT 10 
GOTO @WANTED_GUNS_19 

:WANTED_GUNS_198                  //Wanted level 1
WRITE_MEMORY 6151373 size 1 value 22 vp 1 
WRITE_MEMORY 6863799 size 1 value 22 vp 1 
WAIT 10 
GOTO @WANTED_GUNS_19 

:WANTED_GUNS_235                  //Wanted level 2
WRITE_MEMORY 6151373 size 1 value 22 vp 1 
WRITE_MEMORY 6863799 size 1 value 22 vp 1 
WAIT 10 
GOTO @WANTED_GUNS_19 

:WANTED_GUNS_272                  //Wanted level 3
WRITE_MEMORY 6151373 size 1 value 27 vp 1 
WRITE_MEMORY 6863799 size 1 value 27 vp 1 
WAIT 0 
GOTO @WANTED_GUNS_19 

:WANTED_GUNS_309                  //Wanted level 4
WRITE_MEMORY 6151373 size 1 value 29 vp 1 
WRITE_MEMORY 6863799 size 1 value 29 vp 1 
WAIT 0 
GOTO @WANTED_GUNS_19 

:WANTED_GUNS_346                  //Wanted level 5
WRITE_MEMORY 6151373 size 1 value 33 vp 1 
WRITE_MEMORY 6863799 size 1 value 33 vp 1 
WAIT 0 
GOTO @WANTED_GUNS_19 

:WANTED_GUNS_383                  //Wanted level 6
WRITE_MEMORY 6151373 size 1 value 31 vp 1 
WRITE_MEMORY 6863799 size 1 value 31 vp 1 
WAIT 0 
GOTO @WANTED_GUNS_19 


[/b]

 

Edited by gtamoder1234
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
 Share

  • 2 Users Currently Viewing
    0 members, 1 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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