CLEO Help Help with script

CLEO related
Status
Not open for further replies.

Zin

Expert
Joined
Aug 1, 2013
Messages
1,723
Solutions
1
Reaction score
112
Ok so again fucked up my script

Code:
{$CLEO .cs}
THREAD 'Protection'
:Protect0
wait 0
if
0ADC:   test_cheat "ProtMe"
else_jump @Protect0

Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0107: $2706 = create_object #AD_FLATDOOR at 1@, 2@, 3@

Im Trying to make something like sprunkguard so its creating an object infront of me.
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,723
Solutions
1
Reaction score
112
Dis
Code:
    {$CLEO .cs}
    THREAD 'Protection'
    :Protect0
    wait 0
    if
    0ADC:   test_cheat "ProtMe"
    0247: load_model
    else_jump @Protect0
    Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
    0107: $2706 = create_object #AD_FLATDOOR at 1@, 2@, 3@

im newbie at scripting

Not enough paramaters expected params 1
 

Z0DY

Well-known member
Joined
Feb 20, 2013
Messages
225
Reaction score
0
Dis
Code:
    {$CLEO .cs}
    THREAD 'Protection'
    :Protect0
    wait 0
    if
    0ADC:   test_cheat "ProtMe"
    0247: load_model
    else_jump @Protect0
    Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
    0107: $2706 = create_object #AD_FLATDOOR at 1@, 2@, 3@

im newbie at scripting

Not enough paramaters expected params 1

delete the , after 1@ and 2@ ^^
Code:
0107: $2706 = create_object #AD_FLATDOOR at 1@ 2@ 3@
this works
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,723
Solutions
1
Reaction score
112
And?
Code:
        {$CLEO .cs}
        THREAD 'Protection'
        :Protect0
        wait 0
        if
        0ADC:   test_cheat "SpawnC"
        0247: load_model
        else_jump @Protect0
        Actor.StorePos($PLAYER_ACTOR, 1@ 2@ 3@)
        0107: $2706 = create_object #AD_FLATDOOR at 1@ 2@ 3@

Do i need to load the model AD_FLATDOOR
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,723
Solutions
1
Reaction score
112
Yeah if sprunkguard wasnt crypted i could see how to spawn objects with cleo
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
If i don't remember false, i didn't crypt the Sprunk Guard v1.0, you might use those codes if they aren't.

But yes, unfortunately i crypted them for fear that a noob will steal & abuse my script work, will try to race with my mod, then will sell "his" version with his cheap copy. No Offense.

So, how to create an object... Like here :

First, we use "0247: request_model >>modelid<<", like this :
0247: request_model 7600
or if you know it's name
0247: request_model #INFERNUS // or anything like that flatdoor you wrote

You can easily see the model ids from Mta Map Editor or SAMP Map Editor.

Once you requested your model, you need to check if that model is loaded or not. How ? By using this condition after "if" :
0248: model >>modelid<< available
like
0248: model 7600 available

After the condition, you can create the object anywhere you want. Like, in blueberry farm :
0107: $object = create_object 7600 at 0.0 0.0 0.0
or anywhere that you already defined before,
0107: $object = create_object 7600 at 1@ 2@ 3@

To put it onto yourself, you store your coordinates to 1@ 2@ 3@ with the related opcode, then you create the object to 1@ 2@ 3@
You can choose any number you want, like 16@ 17@ 18@ or even names, like $playerposx $playerposy $playerposz. But if you put comma or dot between the coordinates, it will not function well.

Also remember to put "0249: release_model 7600" after you create the object, or the script will crash.

EDIT 2 : If you want to make it invisible, search "link object interior" in opcode search, and use that opcode.

Good luck.
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,723
Solutions
1
Reaction score
112
Ok might have missed something
Code:
        {$CLEO .cs}
        THREAD 'Protection'
        :Protect0
        wait 0
        if
        0ADC:   test_cheat "SPC"
        018C: play_sound 1052 at 0.0 0.0 0.0
        00BC: show_text_highpriority "Cover Spawned"
        0247: request_model #AD_FLATDOOR
        if
        0248: model AD_FLATDOOR available
        0107: $object = create_object #AD_FLATDOOR at 1@ 2@ 3@
        0249: release_model #AD_FLATDOOR
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
you forgot else_jump after each if condition.
Also put the "request_model" thingy before if.
Before i forget, you also forgot to put time for the highpriority-text. It should be like :
00BC: show_text_highpriority "Cover Spawned" time 1500
By the way for the high priority text i prefer 0ACD opcode. I don't know how this opcode which you chose is but anyway.

Also after releasing the model, you must make the object stick to the character, if i don't remember false it was something like this :
070A: AS_actor $PLAYER_ACTOR attach_to_object $object offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1
or, this perhaps :
069B: attach_object $object to_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0

Should be either the first one or the second one.
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
Ok might have missed something
Code:
        {$CLEO .cs}
        THREAD 'Protection'
        :Protect0
        wait 0
        if
        0ADC:   test_cheat "SPC"
        018C: play_sound 1052 at 0.0 0.0 0.0
        00BC: show_text_highpriority "Cover Spawned"
        0247: request_model #AD_FLATDOOR
        if
        0248: model AD_FLATDOOR available
        0107: $object = create_object #AD_FLATDOOR at 1@ 2@ 3@
        0249: release_model #AD_FLATDOOR

You forgot to defined 1@ 2@ 3@, and use 0ADC instead of 00BC, and at the end of the script jump @Protect0.

Code:
{$CLEO .cs}
        THREAD 'Protection'
        
        :Protect0
        wait 0 ms 
        00D6: if and
        0256:   player $PLAYER_ACTOR defined 
        0ADC:   test_cheat "SPC"
        jf @Protect0
        018C: play_sound 1052 at 0.0 0.0 0.0
        0ACD: show_text_highpriority "Cover Spawned" 1000
        0247: load_model 19302
        if
        0248: model 19302 available
        Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
        0107: $object = create_object 19302 at 1@ 2@ 3@
        069B: attach_object $object to_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.0 rotation 0.0 0.0 0.0 
        0249: release_model 19302
        wait 0 ms
        jump @Protect0

This will spawn a prison door attached to you, like 2 meters in front of you.
 

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,123
Reaction score
174
It spawns in the air how to make on the ground
change
Code:
069B: attach_object $object to_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.0 rotation 0.0 0.0 0.0

to

069B: attach_object $object to_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.0 rotation 0.0 0.0 0.0

this red marked to 0.0 or -1.0 like you want.
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,723
Solutions
1
Reaction score
112
I got rid of that so it spawns it but dont follow me so i can hide behind it than peek out and shoot and i can set up a little defence system is there something to be added to 1@ 2@ 3@
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
272
Remove "069B: attach_object $object to_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.0 rotation 0.0 0.0 0.0 " and it will spawn the door at your coords and it will stay there. It will not 'follow' you around.
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,723
Solutions
1
Reaction score
112
Ok i guess no much can be done to make it spawn on the ground il make a little demonstration of it :D :D:D so people know how to use it ur the best 0x688,springfeild,xzytro and zody
 
Status
Not open for further replies.
Top