just a script that I made long time ago so I thought about sharing

basically what this script do is pick a random ped near you and make them use cellphone
and there is a random timer wich means they could use cellphone for long or shortly.
and as I noticed, it doesn't work with gangs or dealers but it does with others
let me know if any of you find glitches or problems about it.
here is the script:
| CODE |
{$CLEO .cs} thread 'PDPHN'
:PDPHN_11 wait 0 if Player.Defined($PLAYER_CHAR) jf @PDPHN_11 0209: 13@ = random_int_in_ranges 1000 60000 wait 13@ if Player.Defined($PLAYER_CHAR) jf @PDPHN_11 if and $ACTIVE_INTERIOR == 0 $ONMISSION == 0 jf @PDPHN_11 0209: 1@ = random_int_in_ranges 0 4 if 1@ == 2 jf @PDPHN_11
:PDPHN_117 wait 10 04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 0A3E: unknown_get_actor_in_sphere 7@ 8@ 9@ radius 20.0 20.0 20.0 handle_as 11@ wait 10 if Actor.Defined(11@) jf @PDPHN_11 if and not Actor.Dead(11@) 044B: actor 11@ on_foot not Actor.Driving(11@) 8818: not actor 11@ in_air 84AD: not actor 11@ in_water 82E0: not actor 11@ firing_weapon jf @PDPHN_117 Model.Load(#CELLPHONE)
:PDPHN_245 wait 0 if Model.Available(#CELLPHONE) jf @PDPHN_245 0729: AS_actor 11@ hold_cellphone 1 0209: 12@ = random_int_in_ranges 2000 40000 33@ = 0
:PDPHN_290 wait 0 if Actor.Defined(11@) jf @PDPHN_393 if 00F2: actor 11@ near_actor $PLAYER_ACTOR radius 120.0 120.0 0 jf @PDPHN_393 if 001D: 33@ > 12@ // (int) jf @PDPHN_290 0729: AS_actor 11@ hold_cellphone 0 wait 2100 if Actor.Defined(11@) jf @PDPHN_393 05DE: AS_actor 11@ walk_around_ped_path
:PDPHN_393 Model.Destroy(#CELLPHONE) wait 12@ jump @PDPHN_11 |
the reason that I didn't add the actor.removereferences is because there is no need to do it in this opcode, I tried it on main.scm and it seems that it would forget the actor if you move far away from them instead of keeping them in memory. but I'm not sure about the cleo version so test it this way and see by yourselves

mediafire:
peds with cellphone This post has been edited by nabnabnabn on Friday, Jul 20 2012, 13:56