Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (85,775 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    3. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Forum Support

    2. Site Suggestions

In45do

[SA] Multiple script but 1 purpose?

Recommended Posts

Deji

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: [email protected] = create_actor_pedtype 8 model #SPECIAL01 at 213.493 374.339 26.2397  // random coords0223: set_actor [email protected] health_to 25000006: [email protected] = [email protected]: var 455 = [email protected]: 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: [email protected] = var 455if056D:   actor [email protected] 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 [email protected] = -1    // this value will cause a crash when 056D tries to see if the character exists0AB3: var 455 = [email protected]    // 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

Share this post


Link to post
Share on other sites
In45do

... 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 [email protected] = -1    // this value will cause a crash when 056D tries to see if the character exists0AB3: var 455 = [email protected]    // 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. :^:

Share this post


Link to post
Share on other sites
Deji

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

Share this post


Link to post
Share on other sites
Midnightz

Bumping so I remember to come back around to this when I wish to tear into V's code.

Share this post


Link to post
Share on other sites

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

×

Important Information

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