CLEO Help DynamicVars not working.

CLEO related
Status
Not open for further replies.

Zin

Expert
Joined
Aug 1, 2013
Messages
1,690
Reaction score
103
Hello, I want to implement the DynamicVars plugin from http://ugbase.eu/index.php?threads/cleo-plugin-dynamic-vars.8502/#post-55587 into some of my scripts but It causes the game to crash on start of connecting to server screen whenever I use a script with DynamicVars in it such as this test one for example which just makes a timer tick up to 1000 upon CMD.

Code:
{$CLEO .cs}

THREAD 'DYNTEST'

REPEAT
    WAIT 0
UNTIL SAMP.Available()
0B34: samp register_client_command "SPAM" to_label @SPAM

0FA3: VAR "TOG" BOOL_value FALSE

WHILE TRUE
    WAIT 0
    0FA4: 0@ = BOOL_FROM_VAR "TOG"
    IF
        0@ == TRUE
    THEN
        31@ = 0
        WHILE 31@ < 1000
            WAIT 0
            0AD1: "%d" 1 31@
            018C: play_sound 1052 at 0.0 0.0 0.0
            31@ += 1
        END
        0FA3: VAR "TOG" BOOL_value FALSE
    END
END



:SPAM
0FA4: 0@ = BOOL_FROM_VAR "TOG"
IF
    0@ == FALSE
THEN
    0FA3: VAR "TOG" BOOL_value TRUE
ELSE
    31@ = 1000
END
Samp.CmdRet()

This is so awesome :urtheman:
Now we dont need 0@ - 32@ Variables anymore :dont_care:

Here's are the new opcodes that you can enter into opcodes.txt:
Code:
0FA0: DELETE_VAR "VARIABLE"
0FA1: VAR "Variable1" SET_INT_VALUE 1337
0FA2: 0@ = INT_FROM_VAR "Variable1"
0FA3: VAR "Variable2" BOOL_value TRUE
0FA4: 0@ = BOOL_FROM_VAR "Variable2"
0FA5: VAR "Credits" SET_STRING "Made by; 0x688, UGBASE.eu"
0FA6: 0@ = STRING_FROM_VAR "Credits"
0FA7: VAR "Variable3" SET_FLOAT 1337.0
0FA8: 0@ = FLOAT_FROM_VAR "Variable3"
0FA0: DELETE_VAR "VARIABLE"
"VARIABLE" is now -1

0FA1: VAR "Variable1" SET_INT_VALUE 1337
0FA2: 0@ = INT_FROM_VAR "Variable1"
0@ is now 1337

0FA3: VAR "Variable2" value TRUE
0FA4: 0@ = BOOL_FROM_VAR "Variable2"
0@ is now TRUE

0FA5: VAR "Credits" SET_STRING "Made by; 0x688, UGBASE.eu"
0FA6: 0@ = STRING_FROM_VAR "Credits"
0@ is now "Made by; 0x688, UGBASE.eu"


0FA7: VAR "Variable3" SET_FLOAT 1337.0
0FA8: 0@ = FLOAT_FROM_VAR "Variable3"
0@ is now 1337.0
And here's my sascm format:
Code:
0FA0: DELETE_VAR %1s%
0FA1: VAR %1s% SET_INT_VALUE %2d%
0FA2: %2d% = INT_FROM_VAR %1s%
0FA3: VAR %1s% BOOL_VALUE %2d%
0FA4: %2d% = BOOL_FROM_VAR %1s%
0FA5: VAR %1s% SET_STRING %2s%
0FA6: %2d% = STRING_FROM_VAR %1s%
0FA7: VAR %1s% SET_FLOAT %2d%
0FA8: %2d% = FLOAT_FROM_VAR %1s%

I added those lines to opcodes.txd and SASCM.ini and put the DynamicVars.cleo in my CLEO folder, also using CLEO 4.1 with all the neccessary sampfuncs blah blah.
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
881
Location
Lithuania
BETTER USE 32@ OR 33@ FOR TIMER

Example
PHP:
{$CLEO .cs}

0000: NOP

wait 10000

while true
wait 0

if
0AB0: 90 // Z
then
    repeat
    wait 0
    until 8AB0: 90 // not press z
    if
    0@ == false
    then
        0@ = true
        32@ = 0 // set timer to 0 and make sure he start count when you activate code
    else
        0@ = false
    end
end

if
0@ == true
then
    if
    32@ > 1000 /// 1sec passed
    then
        /// do stuff
        32@ = 0 // reset timer
    end
end

end
 
Last edited:

Zin

Expert
Joined
Aug 1, 2013
Messages
1,690
Reaction score
103
Basically I'm working on a multihack and there's alot of different toggles using variables of 0@ = true/false so I want to use DynamicVars plugin to make the code easier to follow. This is just an example script to test the DynamicVars plugin, simply just ticks to 1000 and then stops if I put in the CMD /spam while it's ticking it will just instantly stop it. I want to recreate it with the DynamicVars plugin so I can use 0@ elsewhere but whenever I use DynamicVars opcodes like in the top post it just crashes the game and it works fine when it's done normally like below.
Code:
{$CLEO .cs}

THREAD 'DYNTEST'

REPEAT
    WAIT 0
UNTIL SAMP.Available()
0B34: samp register_client_command "SPAM" to_label @SPAM

0@ = FALSE // TOGGLE

WHILE TRUE
    WAIT 0
    IF
        0@ == TRUE
    THEN
        31@ = 0
        WHILE 31@ < 1000
            WAIT 0
            0AD1: "%d" 1 31@
            018C: play_sound 1052 at 0.0 0.0 0.0
            31@ += 1
        END
        0@ = FALSE
    END
END



:SPAM
IF
    0@ == FALSE
THEN
    0@ = TRUE
ELSE
    31@ = 1000 // TO STOP TIMER
END
Samp.CmdRet()
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,690
Reaction score
103
UPDATE: Fixed the issue by using the SASCM lines contained in the DynamicVars archive and not using the ones Opcode provided, no idea why that happened but ok.
 
Last edited:

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
0FA3: VAR "TOG" BOOL_value FALSE

Messed up interpretation maybe.. this BOOL_value makes no sense to me
 
Status
Not open for further replies.
Top