Quantcast

Jump to content

» «
Photo

All Vehicles Pay'n'Spray

20 replies to this topic
Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#1

Posted 04 July 2010 - 09:32 PM

All Vehicles Pay'n'Spray


A very simple CLEO Script allowing you to take any vehicle to the Pay'n'Spray.


Download
Source

So simple I forget why I bothered uploading the source. You can get the same by decompile.


I would like to thank Seemann for showing the method of doing it via .exe edit and the way to enable radio for police vehicles, too. Information that I wanted loads at the time and what gave me the idea to create this.


P.S: My seemingly dumb topic description is due to the input limit... And my recent mental disorder. Cya!

Gramps
  • Gramps

    ★★★★★

  • Feroci
  • Joined: 23 May 2008
  • New-Zealand

#2

Posted 04 July 2010 - 11:54 PM

Ahhh good morning to wake up to a new CLEO.

I'm guessin' this would finally allow me to repair the police car wink.gif

Is it possible to be able to choose your colour at the pay'n'spray ?

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#3

Posted 05 July 2010 - 02:59 AM

Not easily. Would require disabling/reenabling the Pay'n'Spray and then trying to force it to pick the right colour, which I think is the harder part. Need more knowledge of ASM.

NTAuthority
  • NTAuthority

    hell, no, tunnel, no

  • Feroci
  • Joined: 09 Sep 2008
  • European-Union
  • Most Knowledgeable [Technology] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Contribution Award [Modding]

#4

Posted 05 July 2010 - 06:23 AM

QUOTE (Deji @ Jul 5 2010, 04:59)
Would require disabling/reenabling the Pay'n'Spray and then trying to force it to pick the right colour, which I think is the harder part. Need more knowledge of ASM.

Temporarily edit memory color entries, though storing old ones may be hard from script. Possibly you could just call the function that reloads it afterwards?

(also, great mini-sentences! smile.gif )

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#5

Posted 05 July 2010 - 10:49 AM

Deji, you like to optimize your scripts, so why did you place 0000: at the beginning of the script? Your thread doesn't jump anywhere, so "Jump to zero offset" bug doesn't exists, means that is only 2 bytes of waste ;D

Ontopic:
When I've downloaded the source I throught that will have memory write to each car (like enabling radio for all vehicles), but it has only one NOP, nice happy.gif

NTAuthority
  • NTAuthority

    hell, no, tunnel, no

  • Feroci
  • Joined: 09 Sep 2008
  • European-Union
  • Most Knowledgeable [Technology] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Contribution Award [Modding]

#6

Posted 05 July 2010 - 11:18 AM

QUOTE (SilentPL @ Jul 5 2010, 12:49)
Deji, you like to optimize your scripts, so why did you place 0000: at the beginning of the script? Your thread doesn't jump anywhere, so "Jump to zero offset" bug doesn't exists, means that is only 2 bytes of waste ;D

It's good practice to always use SCRIPT_NAME, though I don't get why Deji likes using the non-registered 0000 command. confused.gif

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#7

Posted 05 July 2010 - 11:51 AM

QUOTE (NTAuthority @ Jul 5 2010, 13:18)
QUOTE (SilentPL @ Jul 5 2010, 12:49)
Deji, you like to optimize your scripts, so why did you place 0000: at the beginning of the script? Your thread doesn't jump anywhere, so "Jump to zero offset" bug doesn't exists, means that is only 2 bytes of waste ;D

It's good practice to always use SCRIPT_NAME, though I don't get why Deji likes using the non-registered 0000 command. confused.gif

Thread name in script like that is a bit useless, isn't it? tounge.gif
This thread probably shuts down even before full game load, so I think that name is useless.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#8

Posted 05 July 2010 - 07:31 PM Edited by Deji, 05 July 2010 - 07:33 PM.

I always start a script by doing the same first steps. The script doesn't even run for a millesecond and I think 2 bytes won't hurt that much.. It's just my way of declaring the script as opposed to 03AF. I've always imagined thread names might end up conflicting with CLEO mods tounge.gif

CODE
0000: AVPNS


Still, if it helps...

*Updated*

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#9

Posted 05 July 2010 - 08:22 PM

CODE
size 5

wtf? I throught that 0A8C accepts only 1, 2, 4, 8, 16 (and so on) bytes, even you were saying that on your forum.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#10

Posted 05 July 2010 - 08:33 PM

Yes, I thought that maybe CLEO 4 had another one of it's nice perks. Which is why I was preparing to have to replace the file for moaning CLEO 3 users tounge.gif

How it works is unconfirmed for me at this moment... Maybe it's the fact I simply NOP'd a function.

In fact, it crashed when I wrote 4 bytes, then 1... But that was probably just the fact I had virtual protect off. I thought the reason for the crashes might had been the fact I NOP'd 4 bytes (essentially leaving invalid base code) and then 1. I doubt it though.

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#11

Posted 05 July 2010 - 08:48 PM

I'm not sure, but shouldn't it look like that?
CODE
0A8C: write_memory 0x44AC75 size 5 value 0x9090909090 virtual_protect 1// 0x90 five times

Now you're writing only 0x90, so I think that only 0x44AC75 will be NOP'ed.

Maybe it should be like that, REALLY I'm not sure wink.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#12

Posted 05 July 2010 - 09:30 PM

Nah, the whole 5 bytes is NOP'd. I made sure of that before I tested it. But again, I don't know why it doesn't conform with the usual way of doing things.

Pretty optimized, really tounge.gif Saved about 16 bytes.

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#13

Posted 06 July 2010 - 10:26 AM Edited by Wesser, 06 July 2010 - 10:29 AM.

Actually, GTA doesn't support more than 4 bytes per param so that script line should look like:
CODE
0A8C: write_memory 0x44AC75 size 4 value 0x90909090 virtual_protect 1 // default is 0xFFCD26E8
0A8C: write_memory 0x44AC79 size 1 value 0x90 virtual_protect 1 // default is 0xFF

Deji, you have to modify your script as explained above because yours it's wrong, really.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#14

Posted 06 July 2010 - 11:35 AM

Check it over the memory, that code just does the exact same thing as my one line. I'm not gonna argue that it doesn't seem like the logical way to do it, but it consistantly works via a better method. I'm not going to replace something that works with something else that does exactly the same thing, but with extra, unnecessary code.

If this mod ever causes a crash, fair enough. But if it does I also want to know about it, which can't happen if I just change it. It's a confusing thing that can be figured out by simply using it.

Your 4 bytes max claim is irrelevant. I didn't write 5 bytes, CLEO did.

This works just as well.
CODE
0A8C: write_memory 0x44AC75 size 5 value 0x9090909090 virtual_protect 1


I don't agree with the code either, it was just part of the random values I threw at it in order to figure out what was going wrong in the first place, but the game agrees with the code, so that's fine with me smile.gif

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#15

Posted 06 July 2010 - 11:53 AM

user posted image

Looks like fifth byte isn't affected by script. Only first byte is NOP'd, the rest is null-terminated, so maybe that will work right. MAYBE.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#16

Posted 06 July 2010 - 12:12 PM Edited by Deji, 06 July 2010 - 12:21 PM.

Interesting. I wasn't viewing it as memory, I viewed it as functions.

Try right clicking the starting address and clicking "Browse in memory view", then click a part in the top half of the window (the one with ASM in) and hit Ctrl+G. Enter the address and go to it.

What I saw from the code is 3 previously working functions NOP'd with 0x90 (call, test and jfe, if I remember right).


I'm going to fiddle around more tounge.gif

EDIT

That 0xFF indicates the last byte is not being written. Confusing as only 4 bytes crashes the game.

Anyway, I'm changing the script to conform with my original code:
CODE
0A8C: write_memory 0x44AC7D size 4 value 0x90909090 virtual_protect 1


Overwriting the test..jne functions and not the call function. In my head the last code should've crashed because NOP'd only part of a function confused.gif

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#17

Posted 06 July 2010 - 12:17 PM Edited by SilentPL, 06 July 2010 - 12:30 PM.

By viewing in that 0x44AC79 is FF too, and rest is null-terminated.

btw. download Cheat Engine 5.6, because using that version I don't have "Browse in memory view" option, only "Browse this memory region" tounge.gif

Edit: CE 5.6.1 came aut some days ago cookie.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#18

Posted 06 July 2010 - 12:27 PM

I do have 5.6 tounge.gif My memory of options on a program is not that strong, lol.

Updated the script (mainly for the purpose of CLEO 3) as Alien explained that CLEO 4 was causing the original success. Can't wait for CLEO 5 tounge.gif

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#19

Posted 06 July 2010 - 01:43 PM

The function has 5 bytes and it hasn't ever happend to me that noping 4 bytes ONLY it doesn't crash. Anyway, I'd rather you followed my advice to be more accurately. wink.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#20

Posted 06 July 2010 - 02:00 PM

You should probably read these posts as an explanation.

It is as I thought originally, a helpful CLEO 4 feature. In most cases I'd write scripts like the original code as long as I was sure the mod could not be made to support CLEO 3, but in this case where CLEO 3 compatibility is possible, I changed it for the wider support.

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci
  • Joined: 19 Aug 2006
  • Unknown

#21

Posted 06 July 2010 - 02:11 PM

Ok, so it's just a trick implemented by CLEO4.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users