#1 23-12-2009 16:54

robertom2002
Registered: 17-12-2009
Posts: 22

Write_memory read_memory

what does write memory do?virtual protect etc. read memory ? How do i use it ?Any example for it ?
And what does this do ?
0@ get value of 1.parameter
1@ get value of 2.parameter
2@ get value of 3.parameter
3@ get value of 4.parameter
4@ get value of 5.paramete
examples ?

I asked a friend to correct my infinite ammo script wich is this
{$CLEO .cs}
:infiniteammo_0
0001: wait 0 ms
:infiniteammo_10
0001: wait 0 ms

:infiniteammo_20
0001: wait 0 ms
00D6: if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @infiniteammo_10
00D6: if
0AB0: key_pressed 145
004D: jump_if_false @infiniteammo_20
017B: set_actor $PLAYER_ACTOR weapon 1 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 2 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 3 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 4 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 5 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 6 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 7 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 8 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 9 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 10 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 11 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 12 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 13 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 14 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 15 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 16 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 17 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 18 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 19 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 20 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 21 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 22 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 23 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 24 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 25 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 26 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 27 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 28 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 29 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 30 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 31 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 32 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 33 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 34 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 35 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 36 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 37 ammo_to 9999
017B: set_actor $PLAYER_ACTOR weapon 38 ammo_to 9999

:infiniteammo_30
0001: wait 1000 ms
00D6: if
0AB0: key_pressed 145
017B: set_actor $PLAYER_ACTOR weapon 1 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 2 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 3 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 4 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 5 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 6 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 7 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 8 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 9 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 10 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 11 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 12 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 13 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 14 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 15 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 16 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 17 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 18 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 19 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 20 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 21 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 22 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 23 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 24 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 25 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 26 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 27 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 28 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 29 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 30 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 31 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 32 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 33 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 34 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 35 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 36 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 37 ammo_to 0
017B: set_actor $PLAYER_ACTOR weapon 38 ammo_to 0
0002: jump @infiniteammo_20

and he corected me to this:

{$CLEO .cs}
wait 0

:infiniteammo
wait 0
if
0256:   player 0 defined     
jf @infiniteammo             // jf == jump_if_false     
if
0AB0: 145 // scroll lock btn
jf @infiniteammo2
0A8C: write_memory 7600773 size 1 value 144 virtual_protect 1     
0A8C: write_memory 7600815 size 1 value 144 virtual_protect 1     
0A8C: write_memory 7600816 size 2 value 37008 virtual_protect 1     
0A8C: write_memory 7612591 size 1 value 144 virtual_protect 1     
0A8C: write_memory 7612646 size 1 value 144 virtual_protect 1     
0A8C: write_memory 7612647 size 2 value 37008 virtual_protect 1

:infiniteammo2
wait 1000
if
0AB0: 145
jf @infiniteammo2
0A8C: write_memory 7600773 size 1 value 72 virtual_protect 1     
0A8C: write_memory 7600815 size 1 value 255 virtual_protect 1     
0A8C: write_memory 7600816 size 2 value 3150 virtual_protect 1     
0A8C: write_memory 7612591 size 1 value 72 virtual_protect 1     
0A8C: write_memory 7612646 size 1 value 255 virtual_protect 1     
0A8C: write_memory 7612647 size 2 value 3150 virtual_protect 1
jump @infiniteammo



Feel free to help me with something more ,could you explain this better with more examples please?

write_memory means a change of a memory location. In this case, there are given infinite ammo. I'm sorry, but with such issues is best addressed by an official forum sanny builder. I will answer only to some
Quote
3.What's a integer ?How do you use it ?Example ?

00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
0172: 1@ = actor $PLAYER_ACTOR Z_angle
1@ 2@ 3@ = integer
Quote
4.What does FLOAT do ?Example ?

010B: 4@ = player $PLAYER_CHAR money
0470: 4@ = actor $PLAYER_ACTOR current_weapon
077E: get_active_interior_to 4@
4@ = float
//
In SA some values are integers, some - floats.
Quote
5.What is OFFSET ? How do i use it ?Example ?

Offset is a variable of the actor, object, transport...

046C: 1@ = car 2@ driver
01B9: set_actor 2@ armed_weapon_to 4@
1@, 2@, 4@ = offsets.

example, create a pedestrian in front of the player. Its Offset is 2@. Then give him a weapon.
First create offset coordinates. The first variable is the position of X, second Y, third Z of the player.
Instead of the offset can write any position and remove 04C4, then it will create not before the player, but at a given point on the map.

04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 3.0 1.0
009A: 2@ = create_actor_pedtype 4 model #MALE01 at 1@ 2@ 3@
01B2: give_actor 2@ weapon 31 ammo 60
You must first download the model weapons by command 0247: load_model #M4, but these weapons do not necessarily, it is loaded with the start of the game.





------------------------
Please help me with this ,keep in mind that im not a scripter and i don't know even the basics of cleo good .
Desperate for help

Offline

#2 23-12-2009 17:48

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: Write_memory read_memory

I asked a friend to correct my infinite ammo script wich is this

Player can have only one weapon of each type.

3.What's a integer ?How do you use it ?Example ?

Integer numbers: ... -3, -2, -1, 0, 1, 2, 3...
For example, values of health of actors and cars, money of player, time - are integer numbers.
Example: give 1000$ to player

{$CLEO}
wait 0
repeat
       wait 0
until Player.defined($player_char)
0109: player $PLAYER_CHAR money += 1000
0a93:

4.What does FLOAT do ?Example ?

Float numbers: ... -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0 ...
For example, coordinates, angles, speeds of movement - are float numbers.
Example: create car near garage in SF

{$CLEO}
model.Load(528) // You should load model before create something. 528 - ID number of model.
repeat
    wait 0
until model.Available(528) // You should wait untill model will be loaded to memory
00A5: 0@ = create_car 528 at -2027.4617 173.2341 28.8359 // create car
model.Destroy(528) // delete model from memory
0A93:

5.What is OFFSET ? How do i use it ?Example ?

Offset is difference between values (for example, coordinates).
Variable of the actor, object, transport is named "handle".
Example: do car (look previous example) invulnerable and create marker above car.

{$CLEO}
wait 0
model.Load(528)
repeat
    wait 0
until model.Available(528)
00A5: 0@ = create_car 528 at -2027.4617 173.2341 28.8359
model.Destroy(528)
02AC: set_car 0@ immunities BP 1 FP 1 EP 1 CP 1 MP 1 // 0 - immunity off, 1 - immunity on
0186: 1@ = create_marker_above_car 0@
0A93:

04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 3.0 1.0
009A: 2@ = create_actor_pedtype 4 model #MALE01 at 1@ 2@ 3@
01B2: give_actor 2@ weapon 31 ammo 60

You should load models (MALE01 and model of weapon) before use it. You should change handle of actor from 2@ to any another variable (for example 0@ or 4@). I advise to load all used models.

Last edited by Den_spb (23-12-2009 17:53)

Offline

#3 23-12-2009 20:12

robertom2002
Registered: 17-12-2009
Posts: 22

Re: Write_memory read_memory

Ok thanks allot for this il try and do some testing with what you wrote if il understand ,(I hope it's in cleo ,cs)

Can you tell me what's wrong with this ?

{$CLEO .cs}

wait 0

:addmoney
       wait 0
if
0256:   player $PLAYER_CHAR defined
jf @addmoney

:addmoney_2
wait 0
if
0AB0:  key_pressed 114
0109: player $PLAYER_CHAR money += 1000
wait 1000
jump @addmoney

if player presses f3 then it gives + 1000 money then stop and possible to do again but this crashes what's wrong ?

And please tell me what do all imunities mean where can i get them ??
for player car :BP FP etc.

Also could you explain me how to use write_memory and what i wrote there?
Thanks

Offline

#4 23-12-2009 20:13

robertom2002
Registered: 17-12-2009
Posts: 22

Re: Write_memory read_memory

Can you also tell me why you used repeat?

Offline

#5 23-12-2009 21:26

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: Write_memory read_memory

{$CLEO .cs}
wait 0
:addmoney
       wait 0
if
0256:   player $PLAYER_CHAR defined 
jf @addmoney
:addmoney_2
wait 0
if
0AB0:  key_pressed 114
jf @addmoney_2 // you forgot this command
0109: player $PLAYER_CHAR money += 1000
wait 1000
jump @addmoney

And please tell me what do all imunities mean where can i get them ??

1. bullet protection 2.fire protection 3. explosion protection 4. infighting weapons protection 5. colliding
protection

Can you also tell me why you used repeat?

repeat
    <commands>
until <condition>

is analogue of

:Label_1
<commands>
if
<condition>
jf @Label_1

Last edited by Den_spb (23-12-2009 21:26)

Offline

#6 23-12-2009 22:08

robertom2002
Registered: 17-12-2009
Posts: 22

Re: Write_memory read_memory

The add money still crashes ! i tryed changing the key to ; but it crashesm sad ...Why ?
I copied your script .

Offline

#7 23-12-2009 22:20

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: Write_memory read_memory

This code doesn't consist mistakes and my game doesn't crash with it.

Offline

#8 23-12-2009 22:49

robertom2002
Registered: 17-12-2009
Posts: 22

Re: Write_memory read_memory

Wow dammit ,i must be the luckyest guy on earth....i tryed again but no effect ,guess im stuck with this ah

Offline

#9 27-12-2009 20:49

robertom2002
Registered: 17-12-2009
Posts: 22

Re: Write_memory read_memory

So could you please tell me about the 0A8C: write_memory 7600773 size 1 value 72 virtual_protect 1     
and etc. ?
Please?

Offline

#10 28-12-2009 11:41

Den_spb
From: Ленинград
Registered: 23-11-2008
Posts: 941
Website

Re: Write_memory read_memory

I advice you to study standard methods of coding at first.
You can read about CLEO 3 opcodes (including 0A8C) in SB-help: CLEO 3 library -> Opcodes

Last edited by Den_spb (28-12-2009 11:42)

Offline

Board footer

Powered by FluxBB