CLEO Help [HELP] Weapon hack crashing the game

CLEO related
Status
Not open for further replies.

DuFF

Member
Joined
Apr 5, 2014
Messages
20
Reaction score
0
Hello ugbase!
I'm newbie on this forum and my english skills aren't very good, so first I want to say sorry for my bad english and I hope you understand me.
I tried to do weapon hack.. I have already read a lot of themes about it, I tried everything, but when I type /sawn the game is still crashing, here is my code:

{$CLEO .cs}

THREAD 'sawnoff'

0B34: samp register_client_command "sawn" to_label @SAWN1

while true
wait 0
if 31@ = 1
then
    Actor.StorePos($PLAYER_ACTOR, 5@, 6@, 7@)
    032B: $SAWN = create_weapon_pickup #SAWNOFF type 3 ammo 3@ at 5@ 6@ 7@
    repeat
    wait 0
    until 0214: pickup $SAWN picked_up
    0AF9: samp say_msg "/giveammo %d %d" 4@ 3@
    0215: destroy_pickup $SAWN
    31@ = 0
end
end

:SAWN1
wait 0
if
0AD4: 1@ = scan_string 0@ format "%d%d" 4@ 3@
then
    if SAMP.IsPlayerConnected(4@)
    then
    31@ = 1
    else jump @NOT_CONNECTED
    end
else jump @USAGE
end
SAMP.CmdRet

:USAGE
wait 0
0AF8: samp add_message_to_chat "Usage: /sawn <playerID> <ammo>"
SAMP.CmdRet

:NOT_CONNECTED
wait 0
0AF8: samp add_message_to_chat "Player with ID %d not found." 4@
SAMP.CmdRet

PS: I want to create pickup, pick-up pickup and to send picked-up weapon to another player with command /giveammo (because of anticheat). I hope you understand what I want to do and I also hope you help me soon :)
PSS: I use CLEO 4.3, sampfuncs v3.2 and samp 0.3z R1
 

m1zg4rd_PL

Well-known member
Joined
Jul 19, 2013
Messages
222
Reaction score
0
Code:
{$CLEO .cs}

thread 'sawnoff'

:Load
wait 300 
if
  SAMP.Available
else_jump @Load
0B34: samp register_client_command "sawn" to_label @SAWN1
31@ = 0

while true
wait 0
if 31@ = 1
then
    Actor.StorePos($PLAYER_ACTOR, 5@, 6@, 7@)
    032B: $SAWN = create_weapon_pickup #SAWNOFF type 3 ammo 3@ at 5@ 6@ 7@
    repeat
    wait 0
    until 0214: pickup $SAWN picked_up
    0AF9: samp say_msg "/giveammo %d %d" 4@ 3@
    0215: destroy_pickup $SAWN
    31@ = 0
end
end

:SAWN1
0B35: samp 0@ = get_last_command_params
if
0AD4: 1@ = scan_string 0@ format "%d %d" 4@ 3@
then
    if
      SAMP.IsPlayerConnected(4@)
    then
      31@ = 1
    else
      jump @NOT_CONNECTED
    end
else
  jump @USAGE
end
SAMP.CmdRet

:USAGE
0AF8: samp add_message_to_chat "Usage: /sawn <playerID> <ammo>"
SAMP.CmdRet

:NOT_CONNECTED
alloc 30@ 64
format 30@ "Player with ID %d not found." 4@
0AF8: samp add_message_to_chat 30@ -1
free 30@
SAMP.CmdRet
 

DuFF

Member
Joined
Apr 5, 2014
Messages
20
Reaction score
0
Code:
Actor.StorePos($PLAYER_ACTOR, 5@, 6@, 7@)
 032B: $SAWN = create_weapon_pickup #SAWNOFF type 3 ammo 3@ at 5@ 6@ 7@
 repeat
 wait 0
 until 0214: pickup $SAWN picked_up
 0AF9: samp say_msg "/giveammo %d %d" 4@ 3@
 0215: destroy_pickup $SAWN
 31@ = 0

This is unreachable code.. Because 31@ is always 0

EDIT:
Everything fixed, thanks for help :)
The main problem was "if 31@ = 1" instead of "if 31@ == 1"

Code:
{$CLEO .cs}

thread 'WEAPS'

:Load
wait 300 
if
  SAMP.Available
else_jump @Load
0B34: samp register_client_command "zbran" to_label @SAWN1

while true
wait 0
if 31@ == 1
then
    Actor.StorePos($PLAYER_ACTOR, 5@, 6@, 7@)
    if
    2@ == 35
    then
    032B: $PICKUP = create_weapon_pickup #ROCKETLA type 3 ammo 3@ at 5@ 6@ 7@
    end
    if
    2@ == 34
    then
    032B: $PICKUP = create_weapon_pickup #SNIPER type 3 ammo 3@ at 5@ 6@ 7@
    end
    if
    2@ == 30
    then
    032B: $PICKUP = create_weapon_pickup #AK47 type 3 ammo 3@ at 5@ 6@ 7@
    end
    if
    2@ == 28
    then
    032B: $PICKUP = create_weapon_pickup #MICRO_UZI type 3 ammo 3@ at 5@ 6@ 7@
    end
    if
    2@ == 26
    then
    032B: $PICKUP = create_weapon_pickup #SAWNOFF type 3 ammo 3@ at 5@ 6@ 7@
    end
    if
    2@ == 24
    then
    032B: $PICKUP = create_weapon_pickup #DESERT_EAGLE type 3 ammo 3@ at 5@ 6@ 7@
    end
    if
    2@ == 18
    then
    032B: $PICKUP = create_weapon_pickup #MOLOTOV type 3 ammo 3@ at 5@ 6@ 7@
    end 
    wait 500
    0AF9: samp say_msg "/giveammo %d %d" 4@ 3@ 
    0215: destroy_pickup $PICKUP
    31@ = 0
end
end

:SAWN1
0B35: samp 0@ = get_last_command_params
if
0AD4: 1@ = scan_string 0@ format "%d %d %d" 4@ 2@ 3@ 
then
    if
      SAMP.IsPlayerConnected(4@)
    then
        31@ = 1
    else
        jump @NOT_CONNECTED
    end
else
    jump @USAGE
end
SAMP.CmdRet

:USAGE
alloc 29@ 64
format 29@ "Použitie: /zbran <playerID> <ID zbrane> <ammo>"
0AF8: samp add_message_to_chat 29@ -1
free 29@
SAMP.CmdRet

:NOT_CONNECTED
alloc 30@ 64
format 30@ "Hráč ID %d nebol nájdený." 4@
0AF8: samp add_message_to_chat 30@ -1
free 30@
SAMP.CmdRet

LOCK please :)
 
Status
Not open for further replies.
Top