Jump to content

[SA] Multiple script but 1 purpose?


In45do

Recommended Posts

I'm learning fastman92 technique at first post. And I'm still testing. (I'm too slow to learn new things :bored: )

This time I'm using opcode 0AB3 and 0AB4. Is this script do exactly what I want? I'm sorry to bring this topic back up.

{$CLEO .cs}:Script1cs03A4: name_thread "Script1":Spawnwait 0 msif0256:   player $PLAYER_CHAR definedjf @Spawn023C: load_special_actor 'TENPEN' as 1 // models 290-299:Checkwait 0 ms

 

Noooooo!

 

 

if023D:   special_actor 1 loadedjf @Check009A: 0@ = create_actor_pedtype 8 model #SPECIAL01 at 213.493 374.339 26.2397  // random coords0223: set_actor 0@ health_to 25000006: 1@ = 0@0AB3: var 455 = 1@0A93: end_custom_thread

 

And I've never seen the help in CLEO vars... they're just as problematic as global vars, perhaps even more so. The more they're used, the more like global vars they will become. And like I said, because your script is in two separate files, other scripts may run in-between them, so that var has a reasonable chance of being totally changed by the next script...

 

 

{$CLEO .cs}:Script2cs03A4: name_thread "Script2":Put_Actorwait 0 ms0AB4: 1@ = var 455if056D:   actor 1@ defined

 

... in which case, it could crash here, as DOES_CHAR_EXIST is known to do a really unreliable check (one that only works when the handle is already valid).

 

 

Think of this like virus protection. If I was a CLEO virus creator (which is a pretty ridiculous concept, I know) I would take advantage of how Windows orders its file searches (CLEO uses the Windows API to load .cs files). Even though your script names, presumably "Script1.cs" and "Script2.cs", will actually load one after another (though not guaranteed to be executed in-order) - it is still possible, easy in fact, for me, a CLEO virus creator, to create a virus which causes 'Script2' to crash...

 

Compile a script named (no, not with 03A4 - which is pretty useless most of the time, but the file name itself) 'Script1-0.cs' containing the following code:

 

{$CLEO .cs}0000::viruzzzwait 00@ = -1    // this value will cause a crash when 056D tries to see if the character exists0AB3: var 455 = 0@    // at the very least (if 056D somehow succeeded or was patched) your script would simply stop workingjump @viruzzz
My virus, which is no more than an ordinary script which could have in fact been a decent mod, will cause your script to crash the game. If my script was installed after yours, the user would come to me and tell me there's a bug in my script. Or, if a user installed my script before yours, they'd be coming to you saying that your script has a bug, and you'll scratch your head for ages wondering why.

 

Scripts should be made as 'virus'-proof as possible to ensure that no matter what other scripts are running, your script isn't the one to blame for a crashing game. Using two scripts for something that one script should be enough for is a very bad idea.

 

What exactly is wrong with the method I described?

Edited by Deji
  • Like 2
Link to comment
Share on other sites

... in which case, it could crash here, as DOES_CHAR_EXIST is known to do a really unreliable check (one that only works when the handle is already valid).

 

Think of this like virus protection. If I was a CLEO virus creator (which is a pretty ridiculous concept, I know) I would take advantage of how Windows orders its file searches (CLEO uses the Windows API to load .cs files). Even though your script names, presumably "Script1.cs" and "Script2.cs", will actually load one after another (though not guaranteed to be executed in-order) - it is still possible, easy in fact, for me, a CLEO virus creator, to create a virus which causes 'Script2' to crash...

 

Compile a script named (no, not with 03A4 - which is pretty useless most of the time, but the file name itself) 'Script1-0.cs' containing the following code:

 

{$CLEO .cs}0000::viruzzzwait 00@ = -1    // this value will cause a crash when 056D tries to see if the character exists0AB3: var 455 = 0@    // at the very least (if 056D somehow succeeded or was patched) your script would simply stop workingjump @viruzzz
My virus, which is no more than an ordinary script which could have in fact been a decent mod, will cause your script to crash the game. If my script was installed after yours, the user would come to me and tell me there's a bug in my script. Or, if a user installed my script before yours, they'd be coming to you saying that your script has a bug, and you'll scratch your head for ages wondering why.

 

Scripts should be made as 'virus'-proof as possible to ensure that no matter what other scripts are running, your script isn't the one to blame for a crashing game. Using two scripts for something that one script should be enough for is a very bad idea.

 

What exactly is wrong with the method I described?

 

I've tested my previous codes and yes, it didn't work. And it's possible that someone will screw the vars if they know which vars I use. But for access checks, the vars is working properly. Thanks for the info. :^:

Link to comment
Share on other sites

I've tested my previous codes and yes, it didn't work. And it's possible that someone will screw the vars if they know which vars I use. But for access checks, the vars is working properly. Thanks for the info. :^:

No, what's the problem is: it's possible that someone will screw the vars if they don't know which vars you use.

 

People aren't trying to write scripts that cause crashes, just as you aren't, but without careful consideration of the worst kind of script which could try to run together with yours, you can prevent a lot of problems.

 

And still, the method is slower and will be more harder to manage with complex scripts, compared to the method I posted. I can't see why you'd go for something more vulnerable :p

Link to comment
Share on other sites

  • 3 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.