Quantcast

Jump to content

» «
Photo

Hi @ All, please, can you help me

3 replies to this topic
kiffz
  • kiffz

    Player Hater

  • Members
  • Joined: 14 Apr 2012

#1

Posted 27 April 2012 - 07:11 PM

Hey guy, my Problem is, i do not understand, how to define Variables correctly, so now i built a Car Damage Reducer, but the Compiler f*cks me up.
Can you Help me please?

CODE

// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
03A4: name_thread "DRED"



:DRED_1
0001: wait 0 ms
00D6: if
056D:   actor $PLAYER_ACTOR defined
004D: jump_if_false @DRED_1
:DRED_2
00D6: if and
0ADC:   test_cheat "DRED"
       Actor.Driving($PLAYER_ACTOR)
004D: jump_if_false @DRED_2
00BC: show_text_highpriority GXT 'CHEAT1' time 1000 flag 1  // Cheat activated
018C: play_sound 1058 at 0.0 0.0 0.0
:DRED_3
03C0: 0@ = actor $PLAYER_ACTOR car
if
not Car.Wrecked(0@)
jf @DRED_5
var
1@: Int
2@: Int
3@: Int
4@: Int
5@: Int
$s
 
   1@ = Car.Health(0@)
   wait 10 ms
   2@ = Car.Health(0@)
   wait 0
   if
       1@ < 2@
   jf @DRED_3
   3@ = 1@-2@
   wait 0
   4@ = 3@/2
   wait 0
   Car.Health(0@) = 2@+4@
   
:DRED_5
if or
   not Actor.Driving($PLAYER_ACTOR)
0ADC:   test_cheat "DRED"
   Actor.Dead($PLAYER_ACTOR)
  jf @DRED_3
  jump @DRED_2    
end
end_thread

ChopTheDog.
  • ChopTheDog.

    War. War never changes.

  • Members
  • Joined: 31 May 2010
  • None

#2

Posted 27 April 2012 - 08:05 PM Edited by Adler, 27 April 2012 - 11:55 PM.

Anything coding related goes: Here

Moved - Adler

Ashwin.Star
  • Ashwin.Star

    Back for Next ♪♫

  • Members
  • Joined: 14 Nov 2010
  • India

#3

Posted 28 April 2012 - 02:19 AM

@kiffz
it not as other Programming language as C or C++,
Read some tutorial man

Bad.boy!
  • Bad.boy!

    SA modder

  • Feroci Racing
  • Joined: 20 Jun 2010
  • None

#4

Posted 28 April 2012 - 09:02 AM

I don't know if you know a programming language already.Where you have to declare variables like this:
CODE
int CarHealth;
float Car_X_Coord;


You don't have to do that most of the time in Sanny Builder. Sanny Builder knows that this returns an int for example:
CODE
1@ = Car.Health(0@)


Also the right structure is:
CODE
var
   // Declare something
end //<-- important


This is impossible in scm coding.
CODE
Car.Health(0@) = 2@+4@

You'll need to do this.
CODE
2@ += 4@
Car.Health(0@) = 2@


And use low structures or high structures:
CODE
//Low
:MAIN4
wait 0
if
Player.Defined($PLAYER_CHAR)
jf @MAIN4
wait 100
Player.InfiniteRun($PLAYER_CHAR, true)
0A93: end_custom_thread

//High (1)
:MAIN3
wait 0
if
   Player.Defined($PLAYER_CHAR)
then
   Player.InfiniteRun($PLAYER_CHAR, true)
   0A93: end_custom_thread
else
   jump @MAIN3
end

//High (2)
:MAIN2
while true
   wait 0
   if
       Player.Defined($PLAYER_CHAR)
   then
       Player.InfiniteRun($PLAYER_CHAR, true)
       0A93: end_custom_thread
   end
end


And don't forget to use wait 0 in loops




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users