CLEO Help SMS

CLEO related
Status
Not open for further replies.

Parazitas

God
Joined
Jan 2, 2017
Messages
3,121
Solutions
5
Reaction score
882
Location
Lithuania
Why samp freeze?

PHP:
{$CLEO .cs}

0000: NOP

REPEAT
  WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "sms" @Command

alloc 4@ 200

WHILE TRUE
  WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if
0AD4: 31@ = scan_string 0@ format "%d %s" 1@ 4@ //IF and SET
then
2@ = SAMP.GetActorHandleByPlayerID(1@)
0B36: samp 3@ = get_player_nickname 2@
0AF8: "You say: /sms %s %s"  -1 3@ 4@
end

0B43:
@Monday
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
get player nickname expects player id (1@), not actor handle, maybe that's the reason
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,121
Solutions
5
Reaction score
882
Location
Lithuania
supahdupahnubah said:
Perhaps 3@ is not allocated also

Still same samp freeze...


I trying get player name when i write player id and send msg...

PHP:
{$CLEO .cs}

0000: NOP

REPEAT
  WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "sms" @Command

alloc 4@ 200
alloc 3@ 200

WHILE TRUE
  WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if 
0AD4: 31@ = scan_string 0@ format "%d %s" 1@ 4@ //IF and SET  
then
2@ = SAMP.GetActorHandleByPlayerID(1@)
0B36: samp 3@ = get_player_nickname 2@
0AF8: "You say: /sms %s %s"  -1 3@ 4@
end

0B43: 


monday said:
get player nickname expects player id (1@), not actor handle, maybe that's the reason

Still same , samp freeze...

PHP:
{$CLEO .cs}

0000: NOP

REPEAT
  WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "sms" @Command

alloc 4@ 200

WHILE TRUE
  WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if 
0AD4: 31@ = scan_string 0@ format "%d %s" 1@ 4@ //IF and SET  
then
0B36: samp 2@ = get_player_nickname 1@
0AF8: "You say: /sms %s %s"  -1 2@ 4@
end

0B43: 
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
just add debug lines, recreate freeze, check chatlog and you'll know at which point the code caused problem

Edit: If it's 0AF8 I would try to use "0C15: strcat" opcode instead
https://translate.google.co.uk/translate?hl=en&sl=ru&tl=en&u=https%3A%2F%2Fblast.hk%2Fwiki%2Fopcodes%3A0c15
 

noob213

Active member
Joined
Sep 15, 2017
Messages
88
Reaction score
6
the operation code 0AD4: you can not extract a chain from the chain

use the 16-byte variable 4@v

Code:
REPEAT
 WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "sms" @Command

WHILE TRUE
 WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if
0AD4: 30@ = scan_string 0@ format "%d %s" 1@ 4@v //IF and SET
then
0B36: samp 2@ = get_player_nickname 1@
0AF8: "You say: /sms %s %s"  -1 2@ 4@v
end
0B43: samp cmd_ret


or use the function scanf directly by legend2360

Code:
REPEAT
  WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "sms" @cmd

WHILE TRUE
  WAIT 0
END

:cmd
0B35: samp 0@ = get_last_command_params
    alloc 2@ 128
    0AA5: call 0x8220AD num_params 4 pop 4 params 2@ 1@v "%d %s" 0@ 3@
    0B36: samp 5@ = get_player_nickname 1@
    0AF8: "You say: /sms %s %s"  -1 5@ 2@  
    free 2@     
0B43: samp cmd_ret
https://blast.hk/threads/7486/
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,121
Solutions
5
Reaction score
882
Location
Lithuania
noob213 said:
the operation code 0AD4: you can not extract a chain from the chain

use the 16-byte variable 4@v

Code:
REPEAT
 WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "sms" @Command

WHILE TRUE
 WAIT 0
END

:Command
0B35: 0@ = get_last_command_params
if
0AD4: 30@ = scan_string 0@ format "%d %s" 1@ 4@v //IF and SET
then
0B36: samp 2@ = get_player_nickname 1@
0AF8: "You say: /sms %s %s"  -1 2@ 4@v
end
0B43: samp cmd_ret


or use the function scanf directly by legend2360

Code:
REPEAT
  WAIT 0
UNTIL 0AFA:  SAMP_IS_READY 

0B34: "sms" @cmd

WHILE TRUE
  WAIT 0
END

:cmd
0B35: samp 0@ = get_last_command_params
    alloc 2@ 128
    0AA5: call 0x8220AD num_params 4 pop 4 params 2@ 1@v "%d %s" 0@ 3@
    0B36: samp 5@ = get_player_nickname 1@
    0AF8: "You say: /sms %s %s"  -1 5@ 2@  
    free 2@     
0B43: samp cmd_ret
https://blast.hk/threads/7486/

Create snippet with this or something like that , maybe somebody  else need this.

P.S.
work only ' function scanf directly by legend2360 '
Thanks all.

@noob213
@supahdupahnubah
@monday
 
Joined
Dec 31, 2015
Messages
712
Reaction score
27
Parazitas said:
Create snippet with this or something like that , maybe somebody  else need this.

P.S.
work only ' function scanf directly by legend2360 '
Thanks all.

@noob213
@supahdupahnubah
@monday

The first works for me tho
Maybe it doesnt work for you quite right because you input more than 16 chars
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,121
Solutions
5
Reaction score
882
Location
Lithuania
supahdupahnubah said:
Parazitas said:
Create snippet with this or something like that , maybe somebody  else need this.

P.S.
work only ' function scanf directly by legend2360 '
Thanks all.

@noob213
@supahdupahnubah
@monday

The first works for me tho
Maybe it doesnt work for you quite right because you input more than 16 chars
 
You saying true, thanks for inform.
 
Status
Not open for further replies.
Top