CLEO Help use 0AD4: in high level loop (while true) with SAMP.IsCommandTyped()?

CLEO related
Status
Not open for further replies.

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
high level loop is
while true

and i want to use command in it that has parameters (0AD4: 1@ = scan_string 0@ format "%s %f" 2@ 3@)

problem is when I try SAMP.IsCommandTyped(0@) in while true with no labe:l it does it for every command with parameters in every cleo script... when I activate another script with parameter %s or %s %f this one activates too... is there any way to check if this command in this script has been typed? or put a high level loop under label maybe?

SAMP.IsCommandTyped doesn't work with strings...

i dont know what to do... or how to fix this... i know how to do it with jumps... but im trying to learn high-level... thanks :)
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
:face_palm: :face_palm: :face_palm:
i said that already, i said it doesn't work, but i want to bypass
it needs to be looped
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
so I cant use something like while true in a label?
or get 2 opcodes to work out label?

someone?
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,493
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
IDK what you want, buy you can take a look at this:

Code:
{$CLEO .cs}
0000:


REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY
0B34: register_cmd "LOL" @LOL
31@ = FALSE

WHILE TRUE
    WAIT 0
    IF
    31@ == TRUE // HAS COMMAND BEEN TYPED?
    THEN
        31@ = FALSE // IF YES, SET IT TO FALSE 
        IF
        0AD4: 32@ = scan_string 1@ format "%d" 2@
        THEN
            IF
            0B23:  samp is_player_connected 1@
            then
                0AF8: samp add_message_to_chat "ayy ID %d is connected" color -1 1@
            end
        END
    END
END


:LOL
0B35: samp 1@ = get_last_command_params 
31@ = TRUE
0B43: samp cmd_ret
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
Opcode.eXe link said:
Tell me what you want to make. (the final script)?
Just wanted to make one command activate both a loop and a label.
In high-level.
Which usually works but not with scan string and command check.

I'll try your way, Opcode, I think I already have, but I'll try again. Thanks alot. :)
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
[member=60]Opcode.eXe[/member]
The script... works. But WHILE TRUE is not a loop because of 31@ = FALSE
Now, if I remove it then it is what I already tried.
[glow=red,2,300]But that is not the problem.[/glow]

[glow=red,2,300]The problem:[/glow]
problem is when I try SAMP.IsCommandTyped(0@) in while true with no labe:l it does it for every command with parameters in every cleo script... when I activate another script with parameter %s or %s %f this one activates too...

I get the script to work, but the script turns on evry time I type another script.
That is my problem, Opcode... it turns on with every script that has param [%d]...

Example:

Code:
{$CLEO .cs}

0000: NOP

0B34: "bitchslap"      @bitchslapper    // command for the label - SAMP.IsCommandTyped() and 0AD4 work
31@ = FALSE


WHILE TRUE
WAIT 0
IF
31@ == TRUE
THEN 
    IF
    0AD4: 1@ = scan_string 0@ format "%d" 2@ // so every command that has params /command [%d] will activate dis too
    THEN
        IF
        SAMP.IsPlayerConnected(2@)
        THEN
            3@ = SAMP.GetActorHandleByPlayerID(2@)
            0591: bitchslap 3@    // loops bitchslap until /bitchslap typd with no ID
        END
    END
END
END

:bitchslapper
wait 0
31@ = TRUE
SAMP.IsCommandTyped(0@) // works bcoz its under label  set by command
IF
Player.Defined($PLAYER_ACTOR)
THEN
    IF
    0AD4: 1@ = scan_string 0@ format "%d" 2@ // works bcoz its under label set by command
    THEN
        IF
        SAMP.IsPlayerConnected(2@)
        THEN
            3@ = SAMP.GetActorHandleByPlayerID(2@)
            4@ = SAMP.GetPlayerNickname(2@)
            chatmsg "bitchslappppppening %s [%d]" 6440587 4@ 2@   
        ELSE
            chatmsg "bitch u lookin not here" 6440587
    ELSE
        chatmsg "not bitchslapening" 6440587
        chatmsg "/bitchslap [ID]" 6440587         
        END
    END
END
SAMP.CmdRet() 

so use dis and type any cmd that has %d in it: this one will activate too. cuz its not under label - it doesnt know which command to scan
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
my problem is:

How to use 0AD4: in WHILE TRUE loop without it being activated by every param cmd?

Tried:
Code:
0AD4: 1@ = scan_string 0@ format "%d" 2@

Code:
0AD4: 1@ = scan_string 'test' format "%d" 2@

Code:
0AD4: 1@ = scan_string "test" format "%d" 2@

Code:
0B34: 0@ = "test123423523523" @test123423523523
0AD4: 1@ = scan_string 0@ format "%d" 2@

Code:
0B34: 0@ = "test" @test1352356236235235
06D2: 0@v = "test1352356236235235" // @v = string
0AD4: 1@ = scan_string 0@v format "%d" 2@
dont work
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
I don't understand anything really..

You don't need to use 0AD4 in the main loop, every time you type the 'bitchslap' command the @bitchslapper label is called.
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
springfield link said:
I don't understand anything really..

You don't need to use 0AD4 in the main loop, every time you type the 'bitchslap' command the @bitchslapper label is called.

Code:
{$CLEO .cs}

wait 0
0B34: "Illuminati"      @Illuminati
wait 0

WHILE TRUE
wait 0
SAMP.IsCommandTyped(0@)   // the problem is that this and 0AD4: apply to all commands with parameters in every script
IF
0AD4: 1@ = scan_string 0@ format "%d" 2@       // the problem is that this and SAMP.IsCommandTyped(0@) apply to all commands with parameters in every script
THEN
    IF
    SAMP.IsPlayerConnected(2@)
    THEN
        4@ = SAMP.GetPlayerNickname(2@)
        chatmsg "Player %s is illuminati" -1 4@   // it will loop this when parameter is put until parameter is untrue or til player is no longer on the server
        wait 3000
    END
END    
END

:Illuminati
wait 0
SAMP.IsCommandTyped(0@)   // this will only apply to the command that applies to this label because these are local
IF
Player.Defined($PLAYER_ACTOR)
THEN
    IF
    0AD4: 1@ = scan_string 0@ format "%d" 2@   // same what i say for above
    THEN
        IF
        SAMP.IsPlayerConnected(2@)
        THEN
            4@ = SAMP.GetPlayerNickname(2@)
            chatmsg "Player %s is being illuminated" 4@  // It will type this in chat when parameter is put - only once
        END
    END
END
SAMP.CmdRet()

example.
fix ur website
it went offline and i lost all text i wanted to put
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
springfield link said:
Don't use it there, 0B35 is to be used in the command body only.

So how do I do a loop?

So how do I make it loop %d or %s or %f or %c?
it doesnt matter what I use
0AD4 is applied globally...
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
You don't loop 0B35. 0AD4 is applied locally, 0B35 = pointer to commands callback. So that's why it will use params from all commands.
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
springfield link said:
You don't loop 0B35. 0AD4 is applied locally, 0B35 = pointer to commands callback. So that's why it will use params from all commands.
But even if I use just 0AD4 it is applied globally it seems.
Like... can you make a script like my 'illuminatying' one but properly?
also thanks for helping :)
 

Wreko

Active member
Joined
Dec 13, 2014
Messages
40
Reaction score
0
springfield link said:
There's nothing to fix, 0@ = POINTER, so DON'T USE 0B35 in the main loop. What's so hard to understand?
R u that thick? I don't. And it still applies to all scripts.
Try to make a code yourself that uses param check and has loop.
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
Like this?

Code:
{$CLEO}
0000:

REPEAT
    WAIT 69
UNTIL SAMp.Available()
0B34: "testcmd" @cmd


while true
wait 0
    if 1@ > 0
    then 0AD1: "%d" 100 1@
    end
end


:cmd
0B35: 0@
0AD4: 2@ = 0@ "%d" 1@
if 2@ <> 1
then 1@ = 0
end
0B43:

It has both a params check and a loop..
 
Status
Not open for further replies.
Top