CLEO Help [HELP] can someone make on/off buttons for my cleo please

CLEO related
Status
Not open for further replies.

Fokiss

Member
Joined
Mar 14, 2013
Messages
17
Reaction score
0
hi basically i am new to cleo scripting and have made myself a cleo script that replicates quick swapping (swapping to a different weapon and back again to avoid reload time) i was wondering if someone could help me add a button to toggle it on and a button to disable it into the script

Note the script is only coded for shotguns and pistols at the moment

heres the cleo code

Code:
// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
thread 'GIVE_WEAPON' 
jump @GIVE_WEAPON_26 

:GIVE_WEAPON_26
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
else_jump @GIVE_WEAPON_26 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_53
wait 0 
if 
02D8:   actor $PLAYER_ACTOR current_weapon == 22 
02D8:   actor $PLAYER_ACTOR current_weapon == 23 
02D8:   actor $PLAYER_ACTOR current_weapon == 24 
else_jump @GIVE_WEAPON_310 
wait 0 
if 
02E0:   actor $PLAYER_ACTOR aggressive 
else_jump @GIVE_WEAPON_53 
jump @GIVE_WEAPON_116 

:GIVE_WEAPON_116
wait 0 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 4 weapon 1@ ammo 2@ model 3@ 
wait 10 
if 
  2@ > 0 
else_jump @GIVE_WEAPON_256 
wait 1800 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
wait 10 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 3 weapon 1@ ammo 2@ model 3@ 
wait 600 
0812: AS_actor $PLAYER_ACTOR perform_animation "BUDDY_RELOAD" IFP_file "BUDDY" 10.0 loopA 0 lockX 0 lockY 0 lockF 0 time 1 // versionB 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_256
wait 1800 
01B2: give_actor $PLAYER_ACTOR weapon 0 ammo 0 // Load the weapon model before using this 
wait 600 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 3 weapon 1@ ammo 2@ model 3@ 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_310
wait 0 
if 
02D8:   actor $PLAYER_ACTOR current_weapon == 25 
02D8:   actor $PLAYER_ACTOR current_weapon == 26 
02D8:   actor $PLAYER_ACTOR current_weapon == 27 
else_jump @GIVE_WEAPON_53 
wait 0 
if 
02E0:   actor $PLAYER_ACTOR aggressive 
else_jump @GIVE_WEAPON_310 
jump @GIVE_WEAPON_373 

:GIVE_WEAPON_373
wait 0 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 5 weapon 1@ ammo 2@ model 3@ 
wait 10 
if 
  2@ > 0 
else_jump @GIVE_WEAPON_509 
wait 800 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
wait 10 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 4 weapon 1@ ammo 2@ model 3@ 
wait 500 
0812: AS_actor $PLAYER_ACTOR perform_animation "UZI_RELOAD" IFP_file "UZI" 10.0 loopA 0 lockX 0 lockY 0 lockF 0 time 1 // versionB 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_509
wait 0 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 3 weapon 1@ ammo 2@ model 3@ 
wait 10 
if 
  2@ > 0 
else_jump @GIVE_WEAPON_651 
wait 800 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
wait 10 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 4 weapon 1@ ammo 2@ model 3@ 
wait 600 
0812: AS_actor $PLAYER_ACTOR perform_animation "COLT45_RELOAD" IFP_file "COLT45" 10.0 loopA 0 lockX 0 lockY 0 lockF 0 time 1 // versionB 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_651
wait 800 
01B2: give_actor $PLAYER_ACTOR weapon 0 ammo 0 // Load the weapon model before using this 
wait 400 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 4 weapon 1@ ammo 2@ model 3@ 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53

any help would be much appreciated, thanks
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Re: [HELP] can someone make on/off buttons for my cleo pleas

Dunno i just added on/off. I dont know if it works because i didnt read all the script.
Code:
// This file was decompiled using sascm.ini published by Seemann 
(http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
thread 'GIVE_WEAPON' 

:ON
wait 0
if
KEY 121
jf @ON
018C: play_sound 1052 at 0.0 0.0 0.0 // enabled
wait 350

:GIVE_WEAPON_26
wait 0
if
key 121
jf @MAIN
018C: play_sound 1052 at 0.0 0.0 0.0 // enabled
wait 100
018C: play_sound 1052 at 0.0 0.0 0.0 // enabled
wait 350
jump @ON 

:MAIN
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
else_jump @GIVE_WEAPON_26 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_53
wait 0 
if 
02D8:   actor $PLAYER_ACTOR current_weapon == 22 
02D8:   actor $PLAYER_ACTOR current_weapon == 23 
02D8:   actor $PLAYER_ACTOR current_weapon == 24 
else_jump @GIVE_WEAPON_310 
wait 0 
if 
02E0:   actor $PLAYER_ACTOR aggressive 
else_jump @GIVE_WEAPON_53 
jump @GIVE_WEAPON_116 

:GIVE_WEAPON_116
wait 0 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 4 weapon 1@ ammo 2@ model 3@ 
wait 10 
if 
  2@ > 0 
else_jump @GIVE_WEAPON_256 
wait 1800 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
wait 10 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 3 weapon 1@ ammo 2@ model 3@ 
wait 600 
0812: AS_actor $PLAYER_ACTOR perform_animation "BUDDY_RELOAD" IFP_file "BUDDY" 10.0 loopA 0 lockX 0 lockY 0 lockF 0 time 1 // versionB 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_256
wait 1800 
01B2: give_actor $PLAYER_ACTOR weapon 0 ammo 0 // Load the weapon model before using this 
wait 600 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 3 weapon 1@ ammo 2@ model 3@ 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_310
wait 0 
if 
02D8:   actor $PLAYER_ACTOR current_weapon == 25 
02D8:   actor $PLAYER_ACTOR current_weapon == 26 
02D8:   actor $PLAYER_ACTOR current_weapon == 27 
else_jump @GIVE_WEAPON_53 
wait 0 
if 
02E0:   actor $PLAYER_ACTOR aggressive 
else_jump @GIVE_WEAPON_310 
jump @GIVE_WEAPON_373 

:GIVE_WEAPON_373
wait 0 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 5 weapon 1@ ammo 2@ model 3@ 
wait 10 
if 
  2@ > 0 
else_jump @GIVE_WEAPON_509 
wait 800 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
wait 10 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 4 weapon 1@ ammo 2@ model 3@ 
wait 500 
0812: AS_actor $PLAYER_ACTOR perform_animation "UZI_RELOAD" IFP_file "UZI" 10.0 loopA 0 lockX 0 lockY 0 lockF 0 time 1 // versionB 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_509
wait 0 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 3 weapon 1@ ammo 2@ model 3@ 
wait 10 
if 
  2@ > 0 
else_jump @GIVE_WEAPON_651 
wait 800 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
wait 10 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 4 weapon 1@ ammo 2@ model 3@ 
wait 600 
0812: AS_actor $PLAYER_ACTOR perform_animation "COLT45_RELOAD" IFP_file "COLT45" 10.0 loopA 0 lockX 0 lockY 0 lockF 0 time 1 // versionB 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53 

:GIVE_WEAPON_651
wait 800 
01B2: give_actor $PLAYER_ACTOR weapon 0 ammo 0 // Load the weapon model before using this 
wait 400 
04B8: get_weapon_data_from_actor $PLAYER_ACTOR weapon_group 4 weapon 1@ ammo 2@ model 3@ 
wait 10 
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 1@ 
jump @GIVE_WEAPON_53
 

Fokiss

Member
Joined
Mar 14, 2013
Messages
17
Reaction score
0
Re: [HELP] can someone make on/off buttons for my cleo pleas

Thanks, also if you happen to read this again, Is there a code to recogonise how much ammo a player has left in there clip? not overall ammo of the weapon, coz my cleo runs on timers but it would be better if there was something like

1@ = players current clip ammo
if 1@ < 2
Jump @blahblah

so it would switch weapons when the player has 1 or 2 bullets left in the clip
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Re: [HELP] can someone make on/off buttons for my cleo pleas

Im a noob in memory editing but...
Maybe this works:

Code:
{$CLEO .cs}
THREAD "MADE_BY_OPCODE"
0662: NOP "MADE BY OPCODEXE" 
0662: NOP "www.YOUTUBE.com/OpcodeXe"

:TEST
wait 0
0A96: 0@ = actor $PLAYER_ACTOR struct //cPED
0@ += 0x5E0 //Pistol ammo in clip (Deagle, Colt dunno)
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0
if
 1@ < 2 // If AmmoClip is smaller than 2 bullets
then
018C: play_sound 1052 at 0.0 0.0 0.0 // If the ammoclip is lower than 2 bullets its gonna beep
end
jump @TEST
 

Fokiss

Member
Joined
Mar 14, 2013
Messages
17
Reaction score
0
Re: [HELP] can someone make on/off buttons for my cleo pleas

Thanks man it beeps when theres less than 2 ammo in the clip which is a good sign.

Appreciate the help buddy
 

Fokiss

Member
Joined
Mar 14, 2013
Messages
17
Reaction score
0
Re: [HELP] can someone make on/off buttons for my cleo pleas

[quote author="Fokiss"]Thanks man it beeps when theres less than 2 ammo in the clip which is a good sign.

Appreciate the help buddy

Lol for me it crashes... xD[/quote]

it doesnt for me i've managed to make it so the deagle swaps when the ammo gets to 1 just working on the spas-12 now, should be done soon.. hopefully lol
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,492
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Re: [HELP] can someone make on/off buttons for my cleo pleas

[quote author="Opcode.eXe"]Lol for me it crashes... xD
Go download sampfuncs v2.4, noob.

Joe king by the way :lol: :lol::lol: [/quote]

Nigga im talking about my own write memory function xD

Code:
0A96: 0@ = actor $PLAYER_ACTOR struct //cPED
0@ += 0x5E0 //Pistol ammo in clip (Deagle, Colt dunno)
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0
if
 1@ < 2 // If AmmoClip is smaller than 2 bullets
then
018C: play_sound 1052 at 0.0 0.0 0.0 // If the ammoclip is lower than 2 bullets its gonna beep
end
 
Status
Not open for further replies.
Top