#51 Re: Вопросы по скриптингу » Подствольный гранатомёт » 09-01-2011 04:41

Вот мой вариант этого скрипта:

thread 'grenade'

{$CLEO}
{$I stdconsts.txt}

const
  GrenadeObjs=16@
  GSpeed=10@
  GType=11@
  GModel=12@
  TempActor=13@
  TrashVar=14@
  CleoGlobalOffset=300
  TempIndex=15@
  {CamPosX=4@
  CamPosY=5@
  CamPosZ=6@
  CamPointX=7@
  CamPointY=8@
  CamPointZ=9@}  
end
var
  $Player_Actor: Actor
  $Player_Char: Player
  0@: Integer
  1@: Float
  2@: Float
  3@: Float
  4@: Float
  5@: Float
  6@: Float
  7@: Float
  8@: Float
  9@: Float
  GSpeed: Float
  GType: Integer
  GModel: Integer
  TempActor: Actor
  TempIndex: Integer
  TrashVar: Integer
  GrenadeObjs: Array 15 of Object
  33@: Integer
end
//$Player_Actor.SetImmunities(0,0,0,1,1)
//$Player_Actor.PutAt(1531.1718, -1357.6180, 329.4535)
//0555: remove_weapon 46 from_actor $Player_Actor
$Player_Actor.StorePos(1@,2@,3@)
032B: TrashVar = create_weapon_pickup #TEARGAS type 15 ammo 9999 at 1@ 2@ 3@

while true
  if 32@>=200
  then
    if 0AB0: key_pressed VK_0
    then
      GSpeed=0.0
      for 0@ = 0 to 14
        if 03CA: object GrenadeObjs[0@] exists
        then
          Object.StorePos(GrenadeObjs[0@],1@,2@,3@)
          0984: GModel = object GrenadeObjs[0@] model
          0871: init_jump_table GModel total_jumps 4 default_jump 0 @endD jumps #GRENADE @grenadeD #TEARGAS @tearD #MOLOTOV @molotovD #SATCHEL @satchelD -1 @endD -1 @endD -1 @endD
          :grenadeD
          020C: create_explosion_with_type 0 at 1@ 2@ 3@
          Object.Destroy(GrenadeObjs[0@])
          jump @endD
          :tearD
          Object.Destroy(GrenadeObjs[0@])
          jump @endD
          :molotovD
          020C: create_explosion_with_type 1 at 1@ 2@ 3@
          Object.Destroy(GrenadeObjs[0@])
          jump @endD
          :satchelD
          020C: create_explosion_with_type 6 at 1@ 2@ 3@
          Object.Destroy(GrenadeObjs[0@])
          :endD
        end 
      end
    end
    if 0AB0: key_pressed VK_1
    then
      GSpeed=25.0
    end  
    if 0AB0: key_pressed VK_2
    then
      GSpeed=50.0
    end  
    if 0AB0: key_pressed VK_3
    then
      GSpeed=75.0
    end
    if 0AB0: key_pressed VK_4
    then
      GSpeed=100.0
    end    
    if or
      0AB0: key_pressed VK_0
      0AB0: key_pressed VK_1
      0AB0: key_pressed VK_2
      0AB0: key_pressed VK_3
      0AB0: key_pressed VK_4
    then
      32@=0
    end
  end
  
  gosub @GetG

  if and 
    0AB0: key_pressed VK_E
    00E1: pressed_on_pad 0 key 6
    GSpeed>0.0
    32@>=200
    09E7: player $PLAYER_CHAR not_frozen
    not $Player_Actor.Driving 
  then
    if or
      02D8: actor $PLAYER_ACTOR current_weapon == 30
      02D8: actor $PLAYER_ACTOR current_weapon == 31
    then
      018C: play_sound 1135 at 0.0 0.0 0.0       
      $Player_Actor.StorePos(1@,2@,3@)
      3@+=0.0
      for 0@ = 0 to 14
        if 03CA:object GrenadeObjs[0@] exists
        jf @0
      end
      0@=-1
      :0
      if 0@<>-1
      jf @end
      068D: get_camera_position_to 4@ 5@ 6@
      068E: get_camera_target_point_to 7@ 8@ 9@  
      7@ -= 4@
      8@ -= 5@
      9@ -= 6@    
      7@*=4.0
      8@*=4.0
      9@*=4.0
      4@+=7@
      5@+=8@
      6@+=9@
       
      GrenadeObjs[0@]=Object.Create(GModel,4@,5@,6@)
      Marker.CreateAboveObject(TrashVar,GrenadeObjs[0@])
      0168: set_marker TrashVar size 1 
      
      
      //070A: AS_actor $Player_Actor attach_to_object GrenadeObjs[0@] offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time 1
      //070B: set_actor $Player_Actor onbone_attached_object_operation 0
      
      
      
      04D9: object GrenadeObjs[0@] set_scripted_collision_check 1
      //Object.Angle(GrenadeObjs[0@])=-90.0
      068D: get_camera_position_to 4@ 5@ 6@
      068E: get_camera_target_point_to 7@ 8@ 9@  
      7@ -= 4@
      8@ -= 5@
      9@ -= 6@    
      7@*=GSpeed
      8@*=GSpeed
      9@*=GSpeed
      083D: get_actor $Player_Actor velocity_in_direction_XYZ 4@ 5@ 6@
      7@ += 4@
      8@ += 5@
      9@ += 6@       
      
       
      Object.ToggleInMovingList(GrenadeObjs[0@],True)
      Object.Throw(GrenadeObjs[0@],7@, 8@, 9@)
      Object.CollisionDetection(GrenadeObjs[0@], true)
      //05A7: set_object GrenadeObjs[0@] velocity_in_direction_XYZ 7@ 8@ 9@
      32@=0
    end
  end  
  :end
  //03f0: enable_text_draw 1
  //0AB1: @DrawFloat 3 pars fnumber 7@ coords 10.0 10.0
  //0AB1: @DrawFloat 3 pars fnumber 8@ coords 10.0 20.0
  //0AB1: @DrawFloat 3 pars fnumber 9@ coords 10.0 30.0
  for 0@ = 0 to 14
    TempIndex=CleoGlobalOffset
    TempIndex+=0@
    
    if 03CA: object GrenadeObjs[0@] exists
    then  
      Object.StorePos(GrenadeObjs[0@],1@,2@,3@)
      if or 
        04DA: has_object GrenadeObjs[0@] collided
        04E7: object GrenadeObjs[0@] in_water
        3@<=-100.0
        05A3: object GrenadeObjs[0@] stopped 
      then      
        0AB4: TrashVar = var TempIndex
        TrashVar+=33@
        
        if 04DA: has_object GrenadeObjs[0@] collided
        then
          0AB3: var TempIndex = TrashVar
        else
          0AB3: var TempIndex = 0
        end
        0984: GModel = object GrenadeObjs[0@] model
        if and
          04E7: object GrenadeObjs[0@] in_water
          GModel<>#TEARGAS
        then
          020C: create_explosion_with_type 12 at 1@ 2@ 3@
          Object.Destroy(GrenadeObjs[0@])    
          jump @endif
        end
        0871: init_jump_table GModel total_jumps 4 default_jump 0 @endif jumps #GRENADE @grenade #TEARGAS @tear #MOLOTOV @molotov #SATCHEL @satchel -1 @endif -1 @endif -1 @endif
        
        :grenade
        020C: create_explosion_with_type 0 at 1@ 2@ 3@
        Object.Destroy(GrenadeObjs[0@])
        jump @endif
        
        :tear
        if or 
          TrashVar>=60000
          3@<=-100.0
        then
          Object.Destroy(GrenadeObjs[0@])
        end
        0209: TrashVar = random_int_in_ranges 0 6
        if TrashVar==1
        then
          095C: create_smoke_at 1@ 2@ 3@ velocity 0.0 0.0 -0.01 RGBA 0.0 1.0 0.0 1.0 size 6.5 last_factor 1.0
        end
        08E5: get_actor_in_sphere 1@ 2@ 3@ radius 5.0 handle_as TempActor
        if TempActor>0
        then
          //0762: AS_actor TempActor dies 
          //05BE: AS_kill_actor TempActor
          if Actor.Driving(TempActor) 
          then
            03C0: TrashVar = actor TempActor car
            02D4: car TrashVar turn_off_engine
            Car.RemoveReferences(TrashVar) 
          end
          0321: kill_actor TempActor
          Actor.RemoveReferences(TempActor)
        {
        else
          if 00FE: actor $Player_Actor sphere 0 in_sphere 1@ 2@ 3@ radius 5.0 5.0 5.0
          then
            0851: set_actor $Player_Actor decrease_health_by 1 flag 1
            0947: unknown_actor $Player_Actor play_audio_event 344 store_to TrashVar
          end
        }
        end
        jump @endif        
        
        :molotov
        //if TrashVar>=2000
        //then
        //  020C: create_explosion_with_type 12 at 1@ 2@ 3@
        //  Object.Destroy(GrenadeObjs[0@])
        //end
        020C: create_explosion_with_type 1 at 1@ 2@ 3@
        Object.Destroy(GrenadeObjs[0@])
        jump @endif        
        
        :satchel
        0AB4: TrashVar = var TempIndex
        {if and
          TrashVar>=4000
          TrashVar<=4040
        then
          020C: create_explosion_with_type 12 at 1@ 2@ 3@
        end
        if and
          TrashVar>=4400
          TrashVar<=4440
        then
          020C: create_explosion_with_type 0 at 1@ 2@ 3@
        end}        
        if and
          TrashVar>=4000
          TrashVar<=4040
        then        
          020C: create_explosion_with_type 10 at 1@ 2@ 3@
        end
        
        if or 
          TrashVar>=6000
          3@<-100.0
        then
          020C: create_explosion_with_type 6 at 1@ 2@ 3@
          {4@=1@
          5@=2@
          6@=3@
          4@+=5.0
          5@+=5.0
          6@+=7.5
          020C: create_explosion_with_type 6 at 4@ 5@ 6@
          4@=1@
          5@=2@
          6@=3@
          4@+=5.0
          5@+=5.0
          6@-=0.0
          020C: create_explosion_with_type 6 at 4@ 5@ 6@
          4@=1@
          5@=2@
          6@=3@
          4@+=5.0
          5@-=5.0
          6@+=7.5
          020C: create_explosion_with_type 6 at 4@ 5@ 6@
          4@=1@
          5@=2@
          6@=3@
          4@+=5.0
          5@-=5.0
          6@-=0.0
          020C: create_explosion_with_type 6 at 4@ 5@ 6@
          4@=1@
          5@=2@
          6@=3@
          4@-=5.0
          5@+=5.0
          6@+=7.5
          020C: create_explosion_with_type 6 at 4@ 5@ 6@
          4@=1@
          5@=2@
          6@=3@
          4@-=5.0
          5@+=5.0
          6@-=0.0
          020C: create_explosion_with_type 6 at 4@ 5@ 6@
          4@=1@
          5@=2@
          6@=3@
          4@-=5.0
          5@-=5.0
          6@+=7.5
          020C: create_explosion_with_type 6 at 4@ 5@ 6@
          4@=1@
          5@=2@
          6@=3@
          4@-=5.0
          5@-=5.0
          6@-=0.0
          020C: create_explosion_with_type 6 at 4@ 5@ 6@}        
        
          

          Object.Destroy(GrenadeObjs[0@])
        end
        :endif       
      end
    else
      0AB3: var TempIndex = 0
    end 
  end
  33@=0
  wait 0
end

:GetG
04B8: get_weapon_data_from_actor $Player_Actor weapon_group 9 weapon GType ammo TrashVar model GModel 
if //or 
  //GModel==#satchel
  GModel<=0
then
  GModel=#GRENADE
end
if GType<=0
then
  GType=16
end 
return

:TextDrawTextSettings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
0340: set_text_draw_color_RGB_mask_to 0x12 0xFF 0 200
0343: set_text_draw_linewidth 640.0
return

:TextDrawText2Settings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
0340: set_text_draw_color_RGB_mask_to 0xFC 0xFF 0 200
0343: set_text_draw_linewidth 640.0 
return

:DrawFloat
008C: 4@ = float_to_integer 0@
008C: 5@ = float_to_integer 0@
5@ *= 1000
0@ *= 1000.0
008C: 0@ = float_to_integer 0@      
0062: 0@ -= 5@
if or
  8029: 0@ < 0
  8029: 4@ < 0
then
  0095: abs( 0@ )
  0095: abs( 4@ )
  gosub @TextDrawText2Settings   
  045B: text_draw_2numbers 1@ 2@ '_NUM_-F' 4@ 0@
else
  0095: abs( 0@ )
  0095: abs( 4@ )
  gosub @TextDrawText2Settings   
  045B: text_draw_2numbers 1@ 2@ '_NUM_F' 4@ 0@
end
0AB2: ret 0

Но только нужен ещё файл stdconsts.txt в папке с сохранённым скриптом или в папке SB:

// INCLUDE FILE
// Скопируйте этот файл
// в папку "Sanny Builder 3\data\sa" 
// или в корневую папку SB3
// а в своём скрипте в начале 
// напишите директиву {$I stdconsts.txt} или {$INCLUDE stdconsts.txt}
const
// game control keys codes
  KEY_FOOT_LEFT_RIGHT = 0
  KEY_FOOT_FORWARD_BACKWARD = 1
  KEY_FOOT_SPECIAL_CTRL_LEFT_RIGHT = 2
  KEY_FOOT_SPECIAL_CTRL_UP_DOWN = 3
  KEY_FOOT_ACTION = 4
  KEY_FOOT_SECONDARY_FIRE = 4
  KEY_FOOT_PREVIOUS_WEAPON = 5
  KEY_FOOT_ZOOM_IN = 5
  KEY_FOOT_AIM = 6
  KEY_FOOT_NEXT_WEAPON = 7
  KEY_FOOT_ZOOM_OUT = 7
  KEY_FOOT_GROUP_FORWARD = 8
  KEY_FOOT_GROUP_BACK = 9
  KEY_NO = 10
  KEY_YES = 11
  KEY_FOOT_NO = 10
  KEY_FOOT_YES = 11
  KEY_FOOT_CHANGE_CAMERA = 13
  KEY_FOOT_JUMP = 14
  KEY_FOOT_ENTER_VEHICLE = 15
  KEY_FOOT_SPRINT = 16
  KEY_FOOT_FIRE = 17
  KEY_FOOT_CROUCH = 18
  KEY_FOOT_LOOK_BEHIND = 19
  KEY_VEHICLE_LEFT_RIGHT = 0
  KEY_VEHICLE_STEER_BACK_UP = 1
  KEY_VEHICLE_BACK_UP = 1
  KEY_VEHICLE_SPECIAL_CTRL_LEFT_RIGHT = 2
  KEY_VEHICLE_SPECIAL_CTRL_UP_DOWN = 3
  KEY_VEHICLE_SECONDARY_FIRE = 4
  KEY_VEHICLE_LOOK_LEFT = 5
  KEY_VEHICLE_HAND_BRAKE = 6
  KEY_VEHICLE_LOOK_RIGHT = 7
  KEY_VEHICLE_NEXT_RADIO_STATION = 8
  KEY_VEHICLE_PREVIOUS_RADIO_STATION = 9
  KEY_VEHICLE_NO = 10
  KEY_VEHICLE_YES = 11
  KEY_VEHICLE_TRIP_SKIP = 11
  KEY_VEHICLE_CAMERA = 13
  KEY_VEHICLE_BRAKE_RESERVE = 14
  KEY_VEHICLE_ENTER_EXIT = 15
  KEY_VEHICLE_ENTER = 15
  KEY_VEHICLE_EXIT = 15
  KEY_VEHICLE_ACCELERATE = 16
  KEY_VEHICLE_FIRE = 17
  KEY_VEHICLE_HORN = 18
  KEY_VEHICLE_SUBMISSION = 19

//virtual key codes
{}
  VK_LBUTTON = 0x1 // Left mouse button
  VK_RBUTTON = 0x2 // Right mouse button 
  VK_CANCEL = 0x3  //Control-break processing 
  VK_MBUTTON = 0x4 { NOT contiguous with L & RBUTTON } //Middle mouse button (three-button mouse)
  VK_BACK = 0x8    //BACKSPACE key
  VK_TAB = 0x9     //TAB key
  VK_CLEAR = 0xC   //CLEAR key
  VK_RETURN = 0xD  //ENTER key 
  VK_SHIFT = 0x10  //SHIFT key (Both)
  VK_CONTROL = 0x11//CTRL key (Both)
  VK_MENU = 0x12   //ALT key (Both)
  VK_PAUSE = 0x13  //PAUSE key 
  VK_CAPITAL = 0x14//CAPS LOCK key
  VK_ESCAPE = 0x1B //ESC key 
  VK_SPACE = 0x20  //SPACEBAR 
  VK_PRIOR = 0x21  //PAGE UP key 
  VK_NEXT = 0x22   //PAGE DOWN key 
  VK_END = 0x23    //END key 
  VK_HOME = 0x24   //HOME key 
  VK_LEFT = 0x25   //LEFT ARROW key 
  VK_UP = 0x26     //UP ARROW key 
  VK_RIGHT = 0x27  //RIGHT ARROW key 
  VK_DOWN = 0x28   //DOWN ARROW key 
  VK_SELECT = 0x29 //SELECT key 
  VK_PRINT = 0x2A  //Original equipment manufacturer (OEM) specific 
  VK_EXECUTE = 0x2B//EXECUTE key 
  VK_SNAPSHOT = 0x2C//PRINT SCREEN key for Windows 3.0 and later 
  VK_INSERT = 0x2D //INS key 
  VK_DELETE = 0x2E //DEL key 
  VK_HELP = 0x2F   //HELP key 
{ VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) }
  VK_0 = 0x30 //0 key 
  VK_1 = 0x31 //1 key 
  VK_2 = 0x32 //2 key 
  VK_3 = 0x33 //3 key
  VK_4 = 0x34 //4 key
  VK_5 = 0x35 //5 key
  VK_6 = 0x36 //6 key
  VK_7 = 0x37 //7 key
  VK_8 = 0x38 //8 key
  VK_9 = 0x39 //9 key
{ VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) }
  VK_A = 0x41 //A key 
  VK_B = 0x42 //B key 
  VK_C = 0x43 //C key 
  VK_D = 0x44 //D key 
  VK_E = 0x45 //E key 
  VK_F = 0x46 //F key 
  VK_G = 0x47 //G key 
  VK_H = 0x48 //H key 
  VK_I = 0x49 //I key 
  VK_J = 0x4A //J key 
  VK_K = 0x4B //K key 
  VK_L = 0x4C //L key 
  VK_M = 0x4D //M key 
  VK_N = 0x4E //N key 
  VK_O = 0x4F //O key 
  VK_P = 0x50 //P key 
  VK_Q = 0x51 //Q key 
  VK_R = 0x52 //R key 
  VK_S = 0x53 //S key 
  VK_T = 0x54 //T key 
  VK_U = 0x55 //U key 
  VK_V = 0x56 //V key 
  VK_W = 0x57 //W key 
  VK_X = 0x58 //X key 
  VK_Y = 0x59 //Y key 
  VK_Z = 0x5A //Z key   
  VK_LWIN = 0x5B //Left Windows key (Microsoft Natural Keyboard) 
  VK_RWIN = 0x5C //Right Windows key (Microsoft Natural Keyboard) 
  VK_APPS = 0x5D //Applications key (Microsoft Natural Keyboard)
  VK_SLEEP = 0x5F//Computer Sleep key 

  VK_NUMPAD0 = 0x60 //Numeric keypad 0 key 
  VK_NUMPAD1 = 0x61 //Numeric keypad 1 key 
  VK_NUMPAD2 = 0x62 //Numeric keypad 2 key
  VK_NUMPAD3 = 0x63 //Numeric keypad 3 key
  VK_NUMPAD4 = 0x64 //Numeric keypad 4 key
  VK_NUMPAD5 = 0x65 //Numeric keypad 5 key
  VK_NUMPAD6 = 0x66 //Numeric keypad 6 key
  VK_NUMPAD7 = 0x67 //Numeric keypad 7 key
  VK_NUMPAD8 = 0x68 //Numeric keypad 8 key
  VK_NUMPAD9 = 0x69 //Numeric keypad 9 key
  VK_MULTIPLY = 0x6A//Multiply key 
  VK_ADD = 0x6B     //Add key 
  VK_SEPARATOR = 0x6C//Separator key
  VK_SUBTRACT = 0x6D//Subtract key 
  VK_DECIMAL = 0x6E //Decimal key 
  VK_DIVIDE = 0x6F  //Divide key 
  VK_F1 = 0x70      //F1 key
  VK_F2 = 0x71      //F2 key
  VK_F3 = 0x72      //F3 key
  VK_F4 = 0x73      //F4 key
  VK_F5 = 0x74      //F5 key
  VK_F6 = 0x75      //F6 key
  VK_F7 = 0x76      //F7 key
  VK_F8 = 0x77      //F8 key
  VK_F9 = 0x78      //F9 key
  VK_F10 = 0x79     //F10 key
  VK_F11 = 0x7A     //F11 key
  VK_F12 = 0x7B     //F12 key
  VK_F13 = 0x7C     //F13 key
  VK_F14 = 0x7D     //F14 key
  VK_F15 = 0x7E     //F15 key
  VK_F16 = 0x7F     //F16 key
  VK_F17 = 0x80     //F17 key
  VK_F18 = 0x81     //F18 key
  VK_F19 = 0x82     //F19 key
  VK_F20 = 0x83     //F20 key
  VK_F21 = 0x84     //F21 key
  VK_F22 = 0x85     //F22 key
  VK_F23 = 0x86     //F23 key
  VK_F24 = 0x87     //F24 key
  VK_NUMLOCK = 0x90 //NUM LOCK key 
  VK_SCROLL = 0x91  //SCROLL LOCK key
{ VK_L & VK_R - left and right Alt, Ctrl and Shift virtual keys.
  Used only as parameters to GetAsyncKeyState() and GetKeyState().
  No other API or message will distinguish left and right keys in this way. }
  VK_LSHIFT = 0xA0
  VK_RSHIFT = 0xA1
  VK_LCONTROL = 0xA2
  VK_RCONTROL = 0xA3
  VK_LMENU = 0xA4
  VK_RMENU = 0xA5
  VK_BROWSER_BACK = 0xA6      //Windows 2000/XP: Browser Back key
  VK_BROWSER_FORWARD = 0xA7   //Windows 2000/XP: Browser Forward key
  VK_BROWSER_REFRESH = 0xA8   //Windows 2000/XP: Browser Refresh key
  VK_BROWSER_STOP = 0xA9      //Windows 2000/XP: Browser Stop key
  VK_BROWSER_SEARCH = 0xAA    //Windows 2000/XP: Browser Search key 
  VK_BROWSER_FAVORITES = 0xAB //Windows 2000/XP: Browser Favorites key
  VK_BROWSER_HOME = 0xAC      //Windows 2000/XP: Browser Start and Home key
  VK_VOLUME_MUTE = 0xAD       //Windows 2000/XP: Volume Mute key
  VK_VOLUME_DOWN = 0xAE       //Windows 2000/XP: Volume Down key
  VK_VOLUME_UP = 0xAF         //Windows 2000/XP: Volume Up key
  VK_MEDIA_NEXT_TRACK = 0xB0  //Windows 2000/XP: Next Track key
  VK_MEDIA_PREV_TRACK = 0xB1  //Windows 2000/XP: Previous Track key
  VK_MEDIA_STOP = 0xB2        //Windows 2000/XP: Stop Media key
  VK_MEDIA_PLAY_PAUSE = 0xB3  //Windows 2000/XP: Play/Pause Media key
  VK_LAUNCH_MAIL = 0xB4       //Windows 2000/XP: Start Mail key
  VK_LAUNCH_MEDIA_SELECT = 0xB5//Windows 2000/XP: Select Media key
  VK_LAUNCH_APP1 = 0xB6       //Windows 2000/XP: Start Application 1 key
  VK_LAUNCH_APP2 = 0xB7       //Windows 2000/XP: Start Application 2 key
  // - (B8-B9)
  // Reserved
  VK_OEM_1 = 0xBA      //Used for miscellaneous characters; it can vary by keyboard.
                       //Windows 2000/XP: For the US standard keyboard, the ';:' key 
  VK_OEM_PLUS = 0xBB   //Windows 2000/XP: For any country/region, the '+' key
  VK_OEM_COMMA = 0xBC  //Windows 2000/XP: For any country/region, the ',' key
  VK_OEM_MINUS = 0xBD  //Windows 2000/XP: For any country/region, the '-' key
  VK_OEM_PERIOD = 0xBE //Windows 2000/XP: For any country/region, the '.' key
  VK_OEM_2 = 0xBF      //Used for miscellaneous characters; it can vary by keyboard.
                       //Windows 2000/XP: For the US standard keyboard, the '/?' key 
  VK_OEM_3 = 0xC0      //Used for miscellaneous characters; it can vary by keyboard.
                       //Windows 2000/XP: For the US standard keyboard, the '`~' key 
  // - (C1-D7)
  // Reserved
  // - (D8-DA)
  // Unassigned
  VK_OEM_4 = 0xDB //Used for miscellaneous characters; it can vary by keyboard. 
                  //Windows 2000/XP: For the US standard keyboard, the '[{' key
  VK_OEM_5 = 0xDC //Used for miscellaneous characters; it can vary by keyboard. 
                  //Windows 2000/XP: For the US standard keyboard, the '\|' key
  VK_OEM_6 = 0xDD //Used for miscellaneous characters; it can vary by keyboard. 
                  //Windows 2000/XP: For the US standard keyboard, the ']}' key
  VK_OEM_7 = 0xDE //Used for miscellaneous characters; it can vary by keyboard. 
                  //Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
  VK_OEM_8 = 0xDF //Used for miscellaneous characters; it can vary by keyboard.
  //- (E0)
  //Reserved
  // (E1)
  // OEM specific
  VK_OEM_102 = 0xE2 //Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
  // (E3-E4)
  // OEM specific
  VK_PROCESSKEY = 0xE5 //Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
  // (E6)
  // OEM specific
  VK_PACKET = 0xE7 //Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP
  // - (E8)
  // Unassigned
  // (E9-F5)
  // OEM specific
  VK_ATTN = 0xF6   //Attn key
  VK_CRSEL = 0xF7  //CrSel key
  VK_EXSEL = 0xF8  //ExSel key
  VK_EREOF = 0xF9  //Erase EOF key
  VK_PLAY = 0xFA   //Play key
  VK_ZOOM = 0xFB   //Zoom key
  VK_NONAME = 0xFC //Reserved 
  VK_PA1 = 0xFD    //PA1 key
  VK_OEM_CLEAR = 0xFE //Clear key

  //weapon numbers
  //melee (холодное оружие)
  WEAPON_UNARMED = 0            //Кулак
  WEAPON_BrassKnuckles = 1      //Кастет
  WEAPON_GOLFCLUB = 2           //Клюшка от гольфа
  WEAPON_NightStick = 3         //Полицейская дубинка
  WEAPON_KNIFE = 4              //Нож
  WEAPON_BaseballBat = 5        //Бейзбольная бита
  WEAPON_Shovel = 6             //Лопата
  WEAPON_PoolCue = 7            //Кий (от бильярда)
  WEAPON_Katana = 8             //Катана (самурайский клинок)
  WEAPON_Chainsaw = 9           //Бензопила
  //Gift (подарки)
  WEAPON_PurpleDildo = 10       //Розовый дилдо
  WEAPON_WhiteDildo = 11        //Белый дилдо
  WEAPON_LongVibe = 12          //Длинный вибратор
  WEAPON_Vibe = 13              //Вибратор
  WEAPON_Flowers = 14           //Цветы
  WEAPON_Cane = 15              //Трость (или клюка?)
  //projectiles (снаряды (Гранаты и тд))
  WEAPON_Grenades = 16          // Гранаты
  WEAPON_TearGas = 17           // Слезоточивые гранаты
  WEAPON_Molotovs = 18          // Коктейль Молотова
  //handguns (пислолеты)
  WEAPON_Pistol = 22            // Пистолет
  WEAPON_SilencedPistol = 23    // Пистолет с глушителем
  WEAPON_DesertEagle = 24       // "Пустынный орёл"
  //shotguns (дробовики)
  WEAPON_Shotgun = 25           // Охотничье ружьё
  WEAPON_SawnOffShotgun = 26    // Обрез
  WEAPON_CombatShotgun = 27     // Боевой дробовик
  //sub-machineguns (пистолеты-пулемёты)
  WEAPON_MicroUzi = 28          // Микро-узи
  WEAPON_MP5 = 29               // МП5
  WEAPON_Tec9 = 32              // Тек9
  //machineguns (автоматы)
  WEAPON_AK47 = 30              // Автомат Калашникова
  WEAPON_M4 = 31                // М4
  //rifles (винтовки)
  WEAPON_Rifle = 33             // Винтовка
  WEAPON_SniperRifle = 34       // Снайперская винтовка
  //specials (другие)
  WEAPON_RPG = 35               // Ракетница
  WEAPON_HeatSeekMissileLauncher = 36//RPG с тепловым самонаведением
  WEAPON_FlameThrower = 37      // Огнемёт
  WEAPON_Minigun = 38           // Миниган (шестистволка)
  WEAPON_SachetCharges = 39     // Радиоуправляемая взрывчатка
  WEAPON_Detonator = 40         // Пульт детонатора
  WEAPON_SprayPaint = 41        // Баллончик с зелёной краской
  WEAPON_FireExtinguisher = 42  // Огнетушитель
  WEAPON_Camera = 43            // Фотокамера (фотоаппарат)
  WEAPON_NightvisionGoggles = 44// Очки ночного видения
  WEAPON_ThermalGoggles = 45    // Очки теплового видения
  WEAPON_Parachute = 46         // Парашют

  // PedTypes                  // Комментарии из справки
  PEDTYPE_PLAYER1         = 0  // Игрок 1
  PEDTYPE_PLAYER2         = 1  // Игрок 2 
  PEDTYPE_PLAYER3         = 2  // Игрок 3 
  PEDTYPE_PLAYER_NETWORK  = 2
  PEDTYPE_PLAYER_UNUSED   = 3
  PEDTYPE_CIVMALE         = 4  // Мужчина - гражданин
  PEDTYPE_CIVMALE         = 5  // Женщина - гражданин
  PEDTYPE_COP             = 6  // Полицейский
  PEDTYPE_GANG1           = 7  // Ballas
  PEDTYPE_GANG_Ballas     = 7 
  PEDTYPE_GANG2           = 8  // Grove Street Families
  PEDTYPE_GANG_GROVE_STR_FAMILIES = 8
  PEDTYPE_GANG3           = 9  // Los Santos Vagos
  PEDTYPE_GANG_VAGOS      = 9
  PEDTYPE_GANG4           = 10 // San Fierro Rifa
  PEDTYPE_GANG_SFRIFA     = 10
  PEDTYPE_GANG5           = 11 // Da Nang Boys
  PEDTYPE_GANG_DANANGBOYS = 11
  PEDTYPE_GANG6           = 12 // Mafia
  PEDTYPE_GANG_MAFIA      = 12
  PEDTYPE_GANG7           = 13 // Mountain Cloud Triad
  PEDTYPE_GANG_Triad      = 13
  PEDTYPE_GANG8           = 14 // Varrio Los Aztecas
  PEDTYPE_GANG_LosAztecas = 14
  PEDTYPE_GANG9           = 15 //
  PEDTYPE_GANG10          = 16 //
  PEDTYPE_DEALER          = 17 // чувак, который продаёт наркоту 
  PEDTYPE_MEDIC           = 18 // врач 
  PEDTYPE_FIREMAN         = 19 // пожарник 
  PEDTYPE_CRIMINAL        = 20 // криминал 
  PEDTYPE_BUM             = 21 // бродяга
  PEDTYPE_PROSTITUTE      = 22 // проститутка 
  PEDTYPE_SPECIAL         = 23 // специальный, как Смоук, Свит, Райдер и другие, которые используются в миссиях. 
  PEDTYPE_MISSION1        = 24 // миссия 1
  PEDTYPE_MISSION2        = 25 // миссия 2
  PEDTYPE_MISSION3        = 26 // миссия 3
  PEDTYPE_MISSION4        = 27 // миссия 4
  PEDTYPE_MISSION5        = 28 // миссия 5
  PEDTYPE_MISSION6        = 29 // миссия 6
  PEDTYPE_MISSION7        = 30 // миссия 7
  PEDTYPE_MISSION8        = 31 // миссия 8
  
  //Погоды. Дополнительных погод (те, которые есть в игре и нет в файле) нет.
  WEATHER_LA_ExtraSunny      = 0   // Очень соднечно       (Лос Сантос)
  WEATHER_LA_SUNNY           = 1   // Солнечно             (Лос Сантос)
  WEATHER_LA_ExtraSunny_SMOG = 2   // Очень солнечно, смог (Лос Сантос)
  WEATHER_LA_SUNNY_SMOG      = 3   // Солнечно, смог       (Лос Сантос)
  WEATHER_LA_CLOUDY          = 4   // Неясная погода       (Лос Сантос)
  WEATHER_SF_SUNNY           = 5   // Солнечно             (Сан-Фиерро)
  WEATHER_SF_EXTRASUNNY      = 6   // Очень солнечно       (Сан-Фиерро)
  WEATHER_SF_CLOUDY          = 7   // Неясная погода       (Сан-Фиерро)
  WEATHER_SF_RAINY           = 8   // Дождливо             (Сан-Фиерро)
  WEATHER_SF_FOGGY           = 9   // Туманно              (Сан-Фиерро)
  WEATHER_LV_SUNNY           = 10  // Солнечно             (Лас Вентурас)
  WEATHER_LV_EXTRASUNNY      = 11  // Очень солнечно       (Лас Вентурас)
  WEATHER_LV_CLOUDY          = 12  // Неясная погода       (Лас Вентурас)
  WEATHER_COUNTRY_EXTRASUNNY = 13  // Очень солнечно       (Сельская местность)
  WEATHER_COUNTRY_SUNNY      = 14  // Солнечно             (Сельская местность)
  WEATHER_COUNTRY_CLOUDY     = 15  // Неясная погода       (Сельская местность)
  WEATHER_COUNTRY_RAINY      = 16  // Дождливо             (Сельская местность)
  WEATHER_DESERT_EXTRASUNNY  = 17  // Очень солнечно       (Пустыня)
  WEATHER_DESERT_SUNNY       = 18  // Солнечно             (Пустыня)
  WEATHER_DESERT_SANDSTORM   = 19  // Песчаная буря        (Пустыня)
  WEATHER_UNDERWATER         = 20  //                      (Под водой)
  WEATHER_INTERIOR_EXTRACOLOURS1=21// Контрастные цвета    (В интерьере)
  WEATHER_INTERIOR_EXTRACOLOURS2=22// Контрастные цвета    (В интерьере)
  
  BODYPART_Torso = 0 // торс 
  BODYPART_Head= 1 // голова 
  BODYPART_Legs = 2 // ноги 
  BODYPART_Shoes = 3 // ступня (обувь) 
  BODYPART_LowerLeftArm = 4 // верхняя часть левой руки 
  BODYPART_UpperLeftArm = 5 // нижняя часть левой руки 
  BODYPART_UpperRightArm = 6 // верхняя часть правой руки 
  BODYPART_LowerRightArm = 7 // нижняя часть правой руки 
  BODYPART_BackTop = 8 // спина 
  BODYPART_LeftChest = 9 // левая часть груди 
  BODYPART_RightChest = 10 // правая часть груди 
  BODYPART_Stomach = 11 // живот 
  BODYPART_LowerBack = 12 // поясница(низ спины) 
  BODYPART_Necklace = 13 // ожерелье 
  BODYPART_Bracelet = 14 // часы или браслет 
  BODYPART_Glasses = 15 // очки 
  BODYPART_Hats = 16 // головной убор      
  BODYPART_Special = 17 // специальная одежда (крупье...)
  
  // ped events
  // Часть событий взята из файла \data\Decision\PedEvent.txt,
  // Часть - от listener'а (названия оригинальные, от R*), 
  // часть найдены мной или Capushon'ом и Seemann'ом
  // ВНИМАНИЕ!!! Часть событий не проверены, и они могут быть нерабочими
  // ВНИМАНИЕ!!! Комментарии взяты из справки SB. Там есть неточности.
  // Если вы найдёте неточности, сообщите в форум SannyBuilder.
  // Часть событий срабатывает исключительно у игрока($PLAYER_ACTOR),
  // часть - исключительно у актёров.
  EVENT_VEHICLE_COLLISION = 1
  EVENT_PED_COLLISION_WITH_PED = 2
  EVENT_PED_COLLISION_WITH_PLAYER = 3
  EVENT_PLAYER_COLLISION_WITH_PED = 4 //Игрока касается другой актер (либо смотрит на него). Срабатывает, когда ОН касается игрока, а не игрок на него налетает.
// 5  
  EVENT_BUILDING_COLLISION = 6
  EVENT_DRAGGED_OUT_CAR = 7           //Выходит из машины или тяниться из неё
  EVENT_KNOCK_OFF_BIKE = 8            //Удар от велосипеда или от падения 
  EVENT_DAMAGE = 9                    //Повреждение актёра 
  EVENT_DEAD = 10                     //актер умер
  EVENT_DEAD_PED = 11                 //Актёр убил кого-либо
  EVENT_POTENTIAL_GET_RUN_OVER = 12   //Наступить не туда
  EVENT_POTENTIAL_WALK_INTO_PED = 13  //Есть вероятность наткнуться на прохожего
  
  EVENT_SHOT_FIRED = 15               //Актёр фотографирует
  EVENT_COP_CAR_BEING_STOLEN = 16 
  EVENT_PED_ENTERED_MY_VEHICLE = 17   //Актёр залез в трансп. средст. игрока
  EVENT_REVIVED = 18
  
  EVENT_SEXY_PED = 20                 //Видит сексуального прохожего
  
  
  
  
  EVENT_PED_TO_CHASE = 25 
  EVENT_PED_TO_FLEE = 26
  EVENT_ATTRACTOR = 27
  EVENT_VEHICLE_TO_STEAL = 28
  
  EVENT_VEHICLE_THREAT = 30           //Угроза столкновения с транспортным средством 
  EVENT_GUN_AIMED_AT = 31
  //EVENT_DRESS_JETPACK = 32          //Игрок одел реактивный ранец
  EVENT_SCRIPT_COMMAND = 32           //создается при назначении любого действия из скрипта
  EVENT_ACTOR_JUMPING = 33            //Актёр подпрыгивает
  
   
  EVENT_ACQUAINTANCE_PED_HATE = 36    //Актёр ненавидит кого-либо
  EVENT_ACQUAINTANCE_PED_DISLIKE = 37 //Актёр недолюбливает кого-либо
  EVENT_ACQUAINTANCE_PED_LIKE = 38    //Актеру нравится кого-либо
  EVENT_ACQUAINTANCE_PED_RESPECT = 39 //Актёр уважает кого-либо
  
  EVENT_VEHICLE_DAMAGE_WEAPON = 41    //Машина актёра повреждена оружием 
  EVENT_SPECIAL = 42                  //Специальный случай 
  EVENT_GOT_KNOCKED_OVER_BY_CAR = 43  //Актёра сбил автомобиль 
  EVENT_POTENTIAL_WALK_INTO_OBJECT = 44//Опасность наступить на объект
  EVENT_CAR_UNDRIVEABLE = 45
  EVENT_POTENTIAL_WALK_INTO_FIRE = 46 //Опасность войти в огонь
  
  EVENT_SCRIPTED_ATTRACTOR = 48
  EVENT_SHOT_FIRED_WHIZZED_BY = 49    //Мимо просвистела пуля
  EVENT_LOW_ANGER_AT_PLAYER = 50      //Неизвестно (низко) 
  EVENT_HIGH_ANGER_AT_PLAYER = 51     //Неизвестно (высоко)
  EVENT_HEALTH_REALLY_LOW = 52        //Здоровье актёра очень мало
  EVENT_HEALTH_LOW = 53               //Здоровье актёра мало
  EVENT_LEADER_ENTERED_CAR_AS_DRIVER = 54//Актёр сел в автомобиль,как водитель 
  EVENT_LEADER_EXITED_CAR_AS_DRIVER = 55//Актёр вылез из автомобиля с места водителя  
  EVENT_POTENTIAL_WALK_INTO_VEHICLE = 56//Актёр пот. идёт к авто
  
  EVENT_BURNING = 58                  //Актёр горит
  EVENT_FIRE_NEARBY = 59              //Актёр вблизи огня
   
  EVENT_SOUND_LOUD = 61               //Актёр слышит громкий звук 
  EVENT_SOUND_QUIET = 62              //Актёр слышит тихий звук 
  EVENT_ACQUAINTANCE_PED_HATE_BADLY_LIT = 63//Актёр в ярости от кого-то
  EVENT_COLLISION_WITH_WATER_SPURT = 64//Сбила струя воды от пожарной машины (название неоригинальное)
  EVENT_SEEN_PANICKED_PED = 65        //Актёр увидел паникующего прохожего
  EVENT_DIVING = 66                   //Актёр нырнул, или вынырнул
  
  
  
  
  EVENT_PLAYER_COMMAND_TO_GROUP = 71  //Актёр - лидер группы
  EVENT_SEEN_COP = 72                 //Актёр замечен полицейским 
  EVENT_VEHICLE_DAMAGE_COLLISION = 73 //Машина актёра столкнулась с другой машиной
  
  EVENT_DANGER = 75                   //Актёру что-то угрожает 
  EVENT_PLAYER_COMMAND_TO_GROUP_GATHER = 76//Актёру дана команда присоединиться у группе
  
  EVENT_PLAYER_LOCK_ON_TARGET = 78  
  EVENT_VEHICLE_ON_FIRE = 79          //Актёр убегает из транспортного средства, когда то загорается
  
  
   
  EVENT_PED_ON_CAR_ROOF = 83
  
  
  
  
  
  
  
  
  
  EVENT_STUCK_IN_AIR = 93             //Актёр заходит в кабину самолёта

end

Чтобы метать гранату, выберите AK-47 или M4, прицельтесь и нажмите E, чтобы менять силу выстрела, нажимать 0-4.
Если у вас гранаты, то стреляет гранатами
Если у вас коктейль Молотова, стреляет коктейлями молотова,
Если у вас бомбы, то стреляет бомбами (огромный взрыв)
Если у вас слезоточивые гранаты, то стреляет ядовитыми гранатами (от яда взрывается голова).
P.S. В связи со странным игровым багом, следует сначала метнуть гранату один раз самому, иначе граната будет проваливаться под землю

#52 Re: Работа с памятью, EXE » Вопрос по памяти » 07-01-2011 09:45

Как прицепить актёра игрока на машину (attach actor to car with offset...)
Через опкоды можно только поставить в turret - режим, но так режим от первого лица и невозможно менять оружие.

#53 Re: Sanny Builder и CLEO » CLEO 4 для GTA San Andreas » 05-01-2011 05:06

А можно сделать динамическою подгрузку и регистрацию объектов (В памяти objects.dat и ide) : txd+dff+col как в моде GTA4HUD от Alexander?
Можно ещё добавить действия с матрицами: умножение матриц, обратная матрица или добавить готовый опкод для нахождения локальных координат из глобальных (обратные опкодам 0400, 0407, 04C4, )

#54 Re: Вопросы по скриптингу » Один вопрос » 24-12-2010 03:23

Какой опкод ты используешь для поиска? Некоторые опкоды не изменяют значение флага Ref, и машина может в любой момент исчезнуть (например, после wait 1000), может, из-за этого?

#55 Re: Вопросы по скриптингу » Как в GTA 4 сделать автопереключение радио? » 24-11-2010 16:00

Есть такая функция
procedure ForceRadioTrack(RadioName, TrackName : PChar; UnkI1, UnkI2 : i32);
Попробуй

#56 Re: Модификации » Автоматическая туррель » 03-01-2010 06:08

Мобильная версия пушки: прицепляется к Patriot'у.

{$CLEO}

const
  MINIGUN_BASE = 2985
  ACTIVATION_KEY = 0x4D //VK_M
  DAMAGE_1BULLET = 100
  TIME_BETWEEN_SHOTS = 0
  Y_OFFSET = -2.0
end

var
  $PLAYER_ACTOR: Actor
  $PLAYER_CHAR: Player
  0@: Object
  1@: Float
  2@: Float
  3@: Float
  4@: Float
  5@: Float
  6@: Float
  7@: Float
  8@: Float
  9@: Float
  17@: Car
  18@: Float
  19@: Float
end
0000:
:loop

while true
  if $PLAYER_CHAR.Defined
  then
    if and
      0AB0: key_pressed ACTIVATION_KEY
      not $PLAYER_ACTOR.Driving
    then
      fade 0 500
      while fading
        wait 0
      end
      0AA5: call 0x0043A0B6 num_params 1 pop 1 #PATRIOT
      fade 1 500
      while fading
        wait 0
      end   
    end
  
    if and 
      0AB0: key_pressed ACTIVATION_KEY
      $PLAYER_ACTOR.Driving
      00DD: actor $PLAYER_ACTOR driving_car_with_model #PATRIOT
      $PLAYER_CHAR.Money > 499999
      $ONMISSION == 0
    then
      03C0: 17@ = actor $PLAYER_ACTOR car 
      $PLAYER_CHAR.Money += -500000
//      $PLAYER_CHAR.WantedLevel = 6
      04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 2.0 -1.0
//      02CE: 3@ = ground_z_at 1@ 2@ 3@
      3@-=1.5
      0@ = Object.Create(MINIGUN_BASE, 1@, 2@, 3@)
      0@.CollisionDetection=false
      7@ = $PLAYER_ACTOR.Angle
      7@ += 90.0
      0@.Angle = 7@
      0681: attach_object 0@ to_car 17@ with_offset 0.0 Y_OFFSET 0.2 rotation 0.0 0.0 -90.0
      {02F6: 18@ = sine 7@ // (float) 
      02F7: 19@ = cosine 7@ // (float)
      18@+=1@
      19@+=2@}
      7@ -= 90.0        
      3@+=1.5
      066E: create_particle "gunsmoke" attached_to_object 0@ with_offset 0.95 0.0 1.089 rotation 90.0 0.0 0.0 flag 0 handle_as 11@ 
//      066E: create_particle "prt_gunshell" attached_to_object 0@ with_offset 0.141034 -0.0554999 1.1 rotation 0.0 100.0 90.0 flag 0 handle_as 12@ 
      0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 1.2 0.0 1.087
      18@=1@
      19@=2@
      wait 200     
      while $PLAYER_ACTOR.InCar(17@)
        0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 0.95 0.0 1.087
        0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 100.2 0.0 1.087  
    
        0A8D: 12@ = read_memory 0x00C1C964 size 4 virtual_protect 0
        if
          12@ > 0
        then
          // ищем вертолет
          0A8D: 13@ = read_memory 0x00B74494 size 4 virtual_protect 0
          0AA8: call_function_method 0x00424160 struct 13@ num_params 1 pop 0 12@ 13@
          if 0185:   car 13@ health >= 250
          then
            Car.StorePos(13@, 4@, 5@, 6@)
            050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
            if and 
              14@ <= 75.0
              06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0 
            then
              jump @Shoot
            end
          end
        end
        0A8D: 12@ = read_memory 0x00C1C968 size 4 virtual_protect 0
        if
          12@ > 0
        then
          // ищем вертолет
          0A8D: 13@ = read_memory 0x00B74494 size 4 virtual_protect 0
          0AA8: call_function_method 0x00424160 struct 13@ num_params 1 pop 0 12@ 13@
          if 0185:   car 13@ health >= 250
          then
            Car.StorePos(13@, 4@, 5@, 6@)
            050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
            if and 
              14@ <= 75.0
              06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0
            then
              jump @Shoot
            end
          end
        end
        //08E5: get_actor_in_sphere 1@ 2@ 3@ radius 50.0 handle_as 10@
        
        
        //0AB1: call_scm_func @Func 1 0@
        
        
        if not Actor.Dead(10@)
        then
          Actor.StorePos(10@, 4@, 5@, 6@)
          050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
        end
        if or 
          Actor.Dead(10@)
          14@>60.0
          32@>=7000
        then
          32@=0
          0AB1: call_scm_func @FUNC_GETPOLICEACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
          if 10@<0
          then
            0AB1: call_scm_func @FUNC_GETBANDITACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
            if 10@<0
            then
              0AB1: call_scm_func @FUNC_GETACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
              
              if 10@<0
              then
                wait 500
              end
            end
          end
        end
  //      073F: get_actor_in_sphere 1@ 2@ 3@ radius 50.0 with_pedtype_civilian 1 gang 1 criminal/prostitute 1 handle_as 10@ 
  //      0A3E: unknown_get_actor_in_sphere 1@ 2@ 3@ radius 50.0 50.0 5.0 handle_as 10@ 
  //      0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 30@ closest_ped_to 10@
  
        if and 
          10@ > 0
          not Actor.Dead(10@)
          //86EE:   not actor 10@ in_group $PLAYER_GROUP 
        then
          Actor.StorePos(10@, 4@, 5@, 6@)
          //Actor.RemoveReferences(10@)          
          jump @Shoot
//          064C: make_particle 12@ visible 
        end    
        :checks 
        if or 
          0AB0:  key_pressed ACTIVATION_KEY
          not $PLAYER_CHAR.Defined
          $ONMISSION == 1
          89E7: not player $PLAYER_CHAR not_frozen 
        then
          Break
        end
        0@.StorePos(20@, 21@, 22@)
        0@.StorePos(23@, 24@, 25@)
        20@-=2.5
        21@-=2.5
        22@-=2.5
        23@+=2.5
        24@+=2.5
        25@+=2.5
        if 0356:   explosion_type -1 in_cube_cornerA 20@ 21@ 22@ cornerB 23@ 24@ 25@ 
        then
          jump @damage
        end
        wait TIME_BETWEEN_SHOTS
      end
      0@.Destroy
      0650: destroy_particle 11@
//      0650: destroy_particle 12@ 
    end
  end
  wait 0
end

{:Func
0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 1.2 0.5 0.587
0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 1.2 -0.5 1.587
03E6: remove_text_box 
if 05FC: actor $PLAYER_ACTOR in_cube_fll_corner_at 1@ 2@ 3@ fur_corner_at 4@ 5@ 6@ depth 50.0 flag 0
then
  0513: show_text_box_1number 'NUMBER' number 777
end
0AB2: ret 0}

:Shoot
  0AB1: call_scm_func @RotateObjectAtPoint 6 0@ 18@ 19@ 4@ 5@ 17@
  18@=4@
  19@=5@
  0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 0.95 0.0 1.087     
  7@ = Random(-0.5, 0.5)
  8@ = Random(-0.5, 0.5)
  9@ = Random(-0.5, 0.5)
  4@+=7@
  5@+=8@
  6@+=9@
  17@.SetImmunities(1,0,0,0,0)      
  06BC: create_M4_shoot_from 1@ 2@ 3@ target 4@ 5@ 6@ energy DAMAGE_1BULLET
  17@.SetImmunities(0,0,0,0,0)
  064C: make_particle 11@ visible
jump @checks


:damage
0@.StorePos(20@, 21@, 22@)
02CF: 26@ = create_fire_at 20@ 21@ 22@ propagation 0 size 2

0@.ToggleInMovingList = true
0@.CollisionDetection=true 
32@=0
while 32@<5000
  02D1: remove_fire 26@
  0@.StorePos(20@, 21@, 22@)
  02CF: 26@ = create_fire_at 20@ 21@ 22@ propagation 0 size 2
  wait 0
end
020C: create_explosion_with_radius 12 at 20@ 21@ 22@
0682: detach_object 0@ 0.0 0.0 0.0 collision_detection 1
06A2: get_car 17@ velocity_in_direction_XYZ 20@ 21@ 22@
22@+=15.0
0@.Throw(20@, 21@, 22@)
05A2: set_object 0@ rotation_velocity_about_an_axis 0.0 5.0 0.0 through_center_of_mass
wait 500
0@.StorePos(20@, 21@, 22@)
02D1: remove_fire 26@ 
020C: create_explosion_with_radius 0 at 20@ 21@ 22@ 
020C: create_explosion_with_radius 5 at 20@ 21@ 22@ 
0@.Destroy
0650: destroy_particle 11@
//0650: destroy_particle 12@ 
jump @loop

:DrawFloat
008C: 4@ = float_to_integer 0@
008C: 5@ = float_to_integer 0@
5@ *= 1000
0@ *= 1000.0
008C: 0@ = float_to_integer 0@      
0062: 0@ -= 5@
0095: abs( 0@ ) 
gosub @TextDrawText2Settings
045B: text_draw_2numbers 1@ 2@ '_NUM_F' 4@ 0@
0AB2: ret 0

:TextDrawTextSettings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
//081C: draw_text_outline 0 0 0 0 0
0340: set_text_draw_color_RGB_mask_to 0x12 0xFF 0 200
0343: set_text_draw_linewidth 640.0
return

:TextDrawText2Settings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
0340: set_text_draw_color_RGB_mask_to 0xFC 0xFF 0 200
0343: set_text_draw_linewidth 640.0 
return

:RotateObjectAtPoint{In_Object,In_XY_Float}
var
  0@:Object
  1@:Float//OldX
  2@:Float//OldY
  3@:Float//NewX
  4@:Float//NewY
  5@:Car//CarHandle
  17@:Float
  16@:Float
  6@:Float
  7@:Float
  8@:Float
  9@:Float
  10@:Float
  11@:Float
  12@:Float
  
  13@:Float
  14@:Float
  30@: Float
end
17@=5@.Angle
Object.StorePos(0@, 13@, 14@, 15@)
1@-=13@
2@-=14@
3@-=13@
4@-=14@
{0509: 16@ = distance_between_XY 0.0 0.0 and_XY 1@ 2@
1@/=16@
2@/=16@
0509: 16@ = distance_between_XY 0.0 0.0 and_XY 3@ 4@
3@/=16@
4@/=16@

6@=3@
7@=4@
6@-=1@
7@-=2@
0509: 16@ = distance_between_XY 0.0 0.0 and_XY 6@ 7@
6@/=16@
7@/=16@
6@*=0.05
7@*=0.05
while true
  1@+=6@
  2@+=7@
  8@=1@
  9@=2@
  8@-=3@
  9@-=4@
  0097: make 8@ absolute_float
  0097: make 9@ absolute_float 
  if and
    8@<=0.06
    9@<=0.06
  then
    Break
  end
  0604: Arctan2( 1@ , 2@ ) store_to 30@
  30@+=90.0
  30@-=17@
  if 0685: object 0@ attached
  then 
    0682: detach_object 0@ 0.0 0.0 0.0 collision_detection 0 
  end
  0681: attach_object 0@ to_car 5@ with_offset 0.0 Y_OFFSET 0.0 rotation 0.0 0.0 30@
  wait 0
end}
0604: Arctan2( 3@ , 4@ ) store_to 30@
30@+=90.0
30@-=17@
if 0685: object 0@ attached
then 
  0682: detach_object 0@ 0.0 0.0 0.0 collision_detection 0 
end
0681: attach_object 0@ to_car 5@ with_offset 0.0 Y_OFFSET 0.2 rotation 0.0 0.0 30@
0AB2: ret 0

:debug
03F0: enable_text_draw 1
0AB1: @DrawFloat 3 pars fnumber 10@ coords 69.0 200.0
0AB1: @DrawFloat 3 pars fnumber 11@ coords 69.0 210.0
return

{
    The Interceptor 1.1
       
    by PLPynton and Seemann    

    Parameters:
    0@ - input coord X
    1@ - input coord Y
    2@ - input coord Z
    3@ - search radius

    variables 4@..16@ in use
    
    9@ = Result (returns -1 if not found)
           
}
jump @Interceptor_end

:FUNC_GETACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETACTOR
0AB2: ret 1 9@

:FUNC_GETPOLICEACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETPOLICEACTOR
0AB2: ret 1 9@

:FUNC_GETBANDITACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETBANDITACTOR
0AB2: ret 1 9@

:FUNC_GETVEHICLE
gosub @AIC_GETVEHICLE
0AB2: ret 1 9@

:FUNC_GETOBJECT
gosub @AIC_GETOBJECT
0AB2: ret 1 9@

:AIC_GETPOLICEACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTPOLICEACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH

:AIC_GETBANDITACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTBANDITACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH 

:AIC_GETACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH 

:AIC_GETVEHICLE
0006: 16@ = 305869
0006: 5@ = @AIC_TESTVEHICLEHANDLE
0006: 6@ = 2584
0006: 8@ = -1
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @AIC_STARTSEARCH 
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false @AIC_STARTSEARCH
03C0: 8@ = actor $PLAYER_ACTOR car
0002: jump @AIC_STARTSEARCH

:AIC_GETOBJECT
0006: 16@ = 305871
0006: 5@ = @AIC_TESTOBJECTHANDLE
0006: 6@ = 412

:AIC_STARTSEARCH
008B: 16@ = &0(16@,1i) // CPool*
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 8 )^ = 7@  // CPool.Size
0A8D: 11@ = read_memory 16@ size 4 virtual_protect 0        // CPool.pUnits
0006: 9@ = -1 
0006: 10@ = 0

:AIC_SEARCHLOOPMAIN
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 11@ + 20 )^ = 4@  // xyz*
8039:   not  4@ == 0 
004D: jump_if_false @AIC_SEARCHLOOPNEXT 
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 48 )^ = 12@  // x
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 52 )^ = 13@  // y
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 56 )^ = 14@  // z
050A: 15@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 12@ 13@ 14@ 
0025:   3@ > 15@ // (float) 
004D: jump_if_false @AIC_SEARCHLOOPNEXT 
0085: 9@ = 10@ // (int) // counter
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 4 )^ = 4@ // CPool.flags
005A: 4@ += 9@ // (int) 
0A8D: 4@ = read_memory 4@ size 1 virtual_protect 0 
0012: 9@ *= 256 
005A: 9@ += 4@ // (int)
0002: jump 5@

:AIC_TESTVEHICLEHANDLE
056E:   is 9@ valid_vehicle_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003B:   8@ == 9@ // (int) 
0119:   car 9@ wrecked 
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE

:AIC_TESTACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE 
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
02F2:   actor 9@ model == #FAM1
02F2:   actor 9@ model == #FAM2
02F2:   actor 9@ model == #FAM3
06EE:   actor 9@ in_group $PLAYER_GROUP 
      then
0002:   jump @AIC_NOHANDLE
      end
00D6: if or
003C:   $PLAYER_ACTOR == 9@ // (int) 
0118:   actor 9@ dead
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE

:AIC_TESTBANDITACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
803C:   not $PLAYER_ACTOR == 9@ // (int)
004D: jump_if_false @AIC_NOHANDLE
8118:   not actor 9@ dead
004D: jump_if_false @AIC_NOHANDLE
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
02F2:   actor 9@ model == #BALLAS1
004D: jump_if_false @001
0002: jump @AIC_NEWSEARCHRADIUS
:001
02F2:   actor 9@ model == #BALLAS2
004D: jump_if_false @002
0002: jump @AIC_NEWSEARCHRADIUS
:002
02F2:   actor 9@ model == #BALLAS3
004D: jump_if_false @003
0002: jump @AIC_NEWSEARCHRADIUS
:003
02F2:   actor 9@ model == #LSV1
004D: jump_if_false @004
0002: jump @AIC_NEWSEARCHRADIUS
:004
02F2:   actor 9@ model == #LSV2
004D: jump_if_false @005
0002: jump @AIC_NEWSEARCHRADIUS
:005
02F2:   actor 9@ model == #LSV3
004D: jump_if_false @006
0002: jump @AIC_NEWSEARCHRADIUS
:006
02F2:   actor 9@ model == #VLA1
004D: jump_if_false @007
0002: jump @AIC_NEWSEARCHRADIUS
:007
02F2:   actor 9@ model == #VLA2
004D: jump_if_false @008
0002: jump @AIC_NEWSEARCHRADIUS
:008
02F2:   actor 9@ model == #VLA3
004D: jump_if_false @AIC_NOHANDLE
0002: jump @AIC_NEWSEARCHRADIUS

:AIC_TESTPOLICEACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
803C:   not $PLAYER_ACTOR == 9@ // (int)
004D: jump_if_false @AIC_NOHANDLE
8118:   not actor 9@ dead
004D: jump_if_false @AIC_NOHANDLE
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
02F2:   actor 9@ model == #LAPD1
004D: jump_if_false @01
0002: jump @AIC_NEWSEARCHRADIUS
:01
02F2:   actor 9@ model == #SFPD1
004D: jump_if_false @02
0002: jump @AIC_NEWSEARCHRADIUS
:02
02F2:   actor 9@ model == #LVPD1
004D: jump_if_false @03
0002: jump @AIC_NEWSEARCHRADIUS
:03
02F2:   actor 9@ model == #CSHER
004D: jump_if_false @04
0002: jump @AIC_NEWSEARCHRADIUS
:04
02F2:   actor 9@ model == #DSHER
004D: jump_if_false @05
0002: jump @AIC_NEWSEARCHRADIUS
:05
02F2:   actor 9@ model == #LAPDM1
004D: jump_if_false @06
0002: jump @AIC_NEWSEARCHRADIUS
:06
02F2:   actor 9@ model == #SWAT
004D: jump_if_false @07
0002: jump @AIC_NEWSEARCHRADIUS
:07
02F2:   actor 9@ model == #FBI
004D: jump_if_false @08
0002: jump @AIC_NEWSEARCHRADIUS
:08
02F2:   actor 9@ model == #ARMY
004D: jump_if_false @AIC_NOHANDLE
0002: jump @AIC_NEWSEARCHRADIUS

:AIC_TESTOBJECTHANDLE
83CA:   not object 9@ exists 
004D: jump_if_false @AIC_NEWSEARCHRADIUS

:AIC_NOHANDLE
0006: 9@ = -1 
0002: jump @AIC_SEARCHLOOPNEXT 

:AIC_NEWSEARCHRADIUS
{  
   use 0051: return to break the loop
   immediately when found at least one actor/car/object, 
   does not matter if he's nearest one. 
}

// v EXTRA SEARCH CRITERIA GOES HERE v

{
  21@ contains the handle of an actor/car/object 
  that should be excluded from the search result 
  (for example a handle found previously). 
}
//803B:   21@ <> 9@
//004D: jump_if_false @AIC_NOHANDLE 

0051: return     
0085: 3@ = 15@


:AIC_SEARCHLOOPNEXT 
005A: 11@ += 6@ // (int) 
000A: 10@ += 1 
002D:   10@ >= 7@ // (int)
004D: jump_if_false @AIC_SEARCHLOOPMAIN
0051: return 

:AIC_READMEMOFFSET
0A8E: 0@ = 0@ + 1@ // int
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AB2: ret 1 0@

:Interceptor_end

#57 Беседка » С новым 2010 годом! » 31-12-2009 09:49

VcSaJen
Replies: 5

Всех скриптеров, моддеров и игроков поздравляю с новым 2010 годом! smile

#58 Re: Вопросы по скриптингу » Массивы и актёры » 31-12-2009 04:52

@reute70 -

И ещё такой давний маленький вопрос: сколько бы ни было строчек кода в исходнике - скрипт меньше 18 кБ не бывает? Может чё-то в настройках накрутить?

В настройках надо убрать галку "Добавлять доп. информацию в SCM".

#59 Re: Вопросы по скриптингу » Один вопрос » 24-12-2009 07:26

Если ты перемещаешь объект не параллельно оси X, Y или Z, то код получится сложнее:

//3@ - объект
//4@ 5@ 6@ - координаты, куда перемещаешь
//0.7 - скорость
0AB1: @GetMoveSpeeds 5 obj 3@ moveto 4@ 5@ 6@ speed 0.7 result 11@ 12@ 13@
while 834E: not move_object 3@ to 4@ 5@ 6@ speed 11@ 12@ 13@ stop_if_collide 0
  0AB1: @GetMoveSpeeds 5 obj 3@ moveto 4@ 5@ 6@ speed 0.7 result 11@ 12@ 13@
  wait 0
end

{...Это помещаешь в самом конце скрипта:}

:GetMoveSpeeds{in_Obj:HObj,in_X,_Y,_Z,_Speed:Float,out_X,Y,Z:Float}
//             0@             1@ 2@ 3@ 4@
Object.StorePos(0@,5@,6@,7@)
050A: 8@ = distance_between_XYZ 5@ 6@ 7@ and_XYZ 1@ 2@ 3@
0063: 5@ -= 1@
0063: 6@ -= 2@
0063: 7@ -= 3@
0073: 5@ /= 8@
0073: 6@ /= 8@
0073: 7@ /= 8@
006B: 5@ *= 4@
006B: 6@ *= 4@
006B: 7@ *= 4@
0096: make 5@ absolute_float
0096: make 6@ absolute_float
0096: make 7@ absolute_float 
0AB2: ret 3 5@ 6@ 7@

Если же ты перемещаешь параллельно одной из осей координат, то лучше пользоваться постом 3Doomer'a.

#60 Модификации » Автоматическая туррель » 24-12-2009 07:03

VcSaJen
Replies: 5

Скрипт минигана, который стреляет сам по полицейским (в первую очередь) и по машинам, вертолётам, пешеходам. Поставить автоминиган - клавиша M.
Миниган разворачивается плавно.
Недостаток - подтормаживание, если прохожих нет поблизости.
На всякий случай скажу, что этот скрипт был написан мной 31 октября 2008 г., 16:11:18.

{$CLEO}

const
  MINIGUN_BASE = 2985
  ACTIVATION_KEY = 0x4D //VK_M
  DAMAGE_1BULLET = 100
  TIME_BETWEEN_SHOTS = 0
end

var
  $PLAYER_ACTOR: Actor
  $PLAYER_CHAR: Player
  0@: Object
  1@: Float
  2@: Float
  3@: Float
  4@: Float
  5@: Float
  6@: Float
  7@: Float
  8@: Float
  9@: Float
  18@: Float
  19@: Float
end
0000:
:loop

while true
  if $PLAYER_CHAR.Defined
  then
    if and 
      0AB0:  key_pressed ACTIVATION_KEY
      $PLAYER_CHAR.Controllable
      not $PLAYER_ACTOR.Driving
      $PLAYER_CHAR.Money > 499999
      $ONMISSION == 0
    then
      $PLAYER_CHAR.Money += -500000
//      $PLAYER_CHAR.WantedLevel = 6
      04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 0.0 2.0 -1.0
//      02CE: 3@ = ground_z_at 1@ 2@ 3@
      3@-=1.5
      0@ = Object.Create(MINIGUN_BASE, 1@, 2@, 3@)
      7@ = $PLAYER_ACTOR.Angle
      7@ += 90.0
      0@.Angle = 7@
      {02F6: 18@ = sine 7@ // (float) 
      02F7: 19@ = cosine 7@ // (float)
      18@+=1@
      19@+=2@}
      7@ -= 90.0        
      3@+=1.5
      066E: create_particle "gunsmoke" attached_to_object 0@ with_offset 0.95 0.0 1.089 rotation 90.0 0.0 0.0 flag 0 handle_as 11@ 
//      066E: create_particle "prt_gunshell" attached_to_object 0@ with_offset 0.141034 -0.0554999 1.1 rotation 0.0 100.0 90.0 flag 0 handle_as 12@ 
      
      Camera.SetBehindPlayer
      $PLAYER_CHAR.CanMove = false
      04EB: AS_actor $PLAYER_ACTOR crouch 1 
      while 834E:   not move_object 0@ to 1@ 2@ 3@ speed 0.0 0.0 0.05 flag 0 
        wait 0
      end
      04EB: AS_actor $PLAYER_ACTOR crouch 0
      $PLAYER_CHAR.CanMove = true
      0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 1.2 0.0 1.087
      18@=1@
      19@=2@     
      while true
        0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 100.2 0.0 1.087  
    
        0A8D: 12@ = read_memory 0x00C1C964 size 4 virtual_protect 0
        if
          12@ > 0
        then
          // ищем вертолет
          0A8D: 13@ = read_memory 0x00B74494 size 4 virtual_protect 0
          0AA8: call_function_method 0x00424160 struct 13@ num_params 1 pop 0 12@ 13@
          if 0185:   car 13@ health >= 250
          then
            Car.StorePos(13@, 4@, 5@, 6@)
            050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
            if and 
              14@ <= 75.0
              06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0 
            then
              jump @Shoot
            end
          end
        end
        0A8D: 12@ = read_memory 0x00C1C968 size 4 virtual_protect 0
        if
          12@ > 0
        then
          // ищем вертолет
          0A8D: 13@ = read_memory 0x00B74494 size 4 virtual_protect 0
          0AA8: call_function_method 0x00424160 struct 13@ num_params 1 pop 0 12@ 13@
          if 0185:   car 13@ health >= 250
          then
            Car.StorePos(13@, 4@, 5@, 6@)
            050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
            if and 
              14@ <= 75.0
              06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0
            then
              jump @Shoot
            end
          end
        end
        //08E5: get_actor_in_sphere 1@ 2@ 3@ radius 50.0 handle_as 10@
        
        
        //0AB1: call_scm_func @Func 1 0@
        
        
        if not Actor.Dead(10@)
        then
          Actor.StorePos(10@, 4@, 5@, 6@)
          050A: 14@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@ 
        end
        if or 
          Actor.Dead(10@)
          14@>60.0
          32@>=7000
        then
          32@=0
          0AB1: call_scm_func @FUNC_GETPOLICEACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
          if 10@<0
          then
            0AB1: call_scm_func @FUNC_GETBANDITACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
            if 10@<0
            then
              0AB1: call_scm_func @FUNC_GETACTOR 7 1@ 2@ 3@ 60.0 1@ 2@ 3@  10@
              
              if 10@<0
              then
                wait 500
              end
            end
          end
        end
  //      073F: get_actor_in_sphere 1@ 2@ 3@ radius 50.0 with_pedtype_civilian 1 gang 1 criminal/prostitute 1 handle_as 10@ 
  //      0A3E: unknown_get_actor_in_sphere 1@ 2@ 3@ radius 50.0 50.0 5.0 handle_as 10@ 
  //      0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 30@ closest_ped_to 10@
  
        if and 
          10@ > 0
          not Actor.Dead(10@)
          //86EE:   not actor 10@ in_group $PLAYER_GROUP 
        then
          Actor.StorePos(10@, 4@, 5@, 6@)
          //Actor.RemoveReferences(10@)          
          jump @Shoot
//          064C: make_particle 12@ visible 
        end    
        :checks 
        if or 
          0AB0:  key_pressed ACTIVATION_KEY
          not $PLAYER_CHAR.Defined
          $ONMISSION == 1
          89E7: not player $PLAYER_CHAR not_frozen 
        then
          Break
        end
        0@.StorePos(20@, 21@, 22@)
        0@.StorePos(23@, 24@, 25@)
        20@-=2.5
        21@-=2.5
        22@-=2.5
        23@+=2.5
        24@+=2.5
        25@+=2.5
        if 0356:   explosion_type -1 in_cube_cornerA 20@ 21@ 22@ cornerB 23@ 24@ 25@ 
        then
          jump @damage
        end
        wait TIME_BETWEEN_SHOTS
      end
      0@.Destroy
      0650: destroy_particle 11@
//      0650: destroy_particle 12@ 
    end
  end
  wait 0
end

{:Func
0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 1.2 0.5 0.587
0400: store_coords_to 4@ 5@ 6@ from_object 0@ with_offset 1.2 -0.5 1.587
03E6: remove_text_box 
if 05FC: actor $PLAYER_ACTOR in_cube_fll_corner_at 1@ 2@ 3@ fur_corner_at 4@ 5@ 6@ depth 50.0 flag 0
then
  0513: show_text_box_1number 'NUMBER' number 777
end
0AB2: ret 0}

:Shoot
  0AB1: call_scm_func @RotateObjectAtPoint 5 0@ 18@ 19@ 4@ 5@
  18@=4@
  19@=5@
  0400: store_coords_to 1@ 2@ 3@ from_object 0@ with_offset 0.95 0.0 1.087     
  7@ = Random(-0.5, 0.5)
  8@ = Random(-0.5, 0.5)
  9@ = Random(-0.5, 0.5)
  4@+=7@
  5@+=8@
  6@+=9@
  //$PLAYER_ACTOR.SetImmunities(1,0,0,0,0)      
  06BC: create_M4_shoot_from 1@ 2@ 3@ target 4@ 5@ 6@ energy DAMAGE_1BULLET
  //$PLAYER_ACTOR.SetImmunities(0,0,0,0,0)
  064C: make_particle 11@ visible
jump @checks


:damage
0@.StorePos(20@, 21@, 22@)
02CF: 26@ = create_fire_at 20@ 21@ 22@ propagation 0 size 2
0@.ToggleInMovingList = true 
wait 5000
020C: create_explosion_with_radius 12 at 20@ 21@ 22@
0@.Throw(0.0, 0.0, 10.0)
05A2: set_object 0@ rotation_velocity_about_an_axis 0.0 5.0 0.0 through_center_of_mass
wait 500
0@.StorePos(20@, 21@, 22@)
02D1: remove_fire 26@ 
020C: create_explosion_with_radius 0 at 20@ 21@ 22@ 
020C: create_explosion_with_radius 5 at 20@ 21@ 22@ 
0@.Destroy
0650: destroy_particle 11@
//0650: destroy_particle 12@ 
jump @loop

:DrawFloat
008C: 4@ = float_to_integer 0@
008C: 5@ = float_to_integer 0@
5@ *= 1000
0@ *= 1000.0
008C: 0@ = float_to_integer 0@      
0062: 0@ -= 5@
0095: abs( 0@ ) 
gosub @TextDrawText2Settings
045B: text_draw_2numbers 1@ 2@ '_NUM_F' 4@ 0@
0AB2: ret 0

:TextDrawTextSettings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
//081C: draw_text_outline 0 0 0 0 0
0340: set_text_draw_color_RGB_mask_to 0x12 0xFF 0 200
0343: set_text_draw_linewidth 640.0
return

:TextDrawText2Settings
0348: set_text_draw_proportional 1 
033F: set_text_draw_letter_width_to 0.3 height_to 1.0 
0349: set_text_draw_style_to 1 
081C: draw_text_outline 1 0 0 0 255
0340: set_text_draw_color_RGB_mask_to 0xFC 0xFF 0 200
0343: set_text_draw_linewidth 640.0 
return

:RotateObjectAtPoint{In_Object,In_XY_Float}
var
  0@:Object
  1@:Float//OldX
  2@:Float//OldY
  3@:Float//NewX
  4@:Float//NewY
  5@:Float
  6@:Float
  7@:Float
  8@:Float
  9@:Float
  10@:Float
  11@:Float
  12@:Float
  
  13@:Float
  14@:Float
end
Object.StorePos(0@, 13@, 14@, 15@)
1@-=13@
2@-=14@
3@-=13@
4@-=14@
0509: 5@ = distance_between_XY 0.0 0.0 and_XY 1@ 2@
1@/=5@
2@/=5@
0509: 5@ = distance_between_XY 0.0 0.0 and_XY 3@ 4@
3@/=5@
4@/=5@

6@=3@
7@=4@
6@-=1@
7@-=2@
0509: 5@ = distance_between_XY 0.0 0.0 and_XY 6@ 7@
6@/=5@
7@/=5@
6@*=0.05
7@*=0.05
while true
  1@+=6@
  2@+=7@
  8@=1@
  9@=2@
  8@-=3@
  9@-=4@
  0097: make 8@ absolute_float
  0097: make 9@ absolute_float 
  if and
    8@<=0.06
    9@<=0.06
  then
    Break
  end
  0604: Arctan2( 1@ , 2@ ) store_to 30@
  30@+=90.0
  Object.Angle(0@) = 30@
  wait 0
end
0604: Arctan2( 3@ , 4@ ) store_to 30@
30@+=90.0
Object.Angle(0@) = 30@
0AB2: ret 0




:debug
03F0: enable_text_draw 1
0AB1: @DrawFloat 3 pars fnumber 10@ coords 69.0 200.0
0AB1: @DrawFloat 3 pars fnumber 11@ coords 69.0 210.0
return

{
    The Interceptor 1.1
       
    by PLPynton and Seemann    

    Parameters:
    0@ - input coord X
    1@ - input coord Y
    2@ - input coord Z
    3@ - search radius

    variables 4@..16@ in use
    
    9@ = Result (returns -1 if not found)
           
}
jump @Interceptor_end

:FUNC_GETACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETACTOR
0AB2: ret 1 9@

:FUNC_GETPOLICEACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETPOLICEACTOR
0AB2: ret 1 9@

:FUNC_GETBANDITACTOR
0087: 17@ = 4@ // (float)
0087: 18@ = 5@ // (float)
0087: 19@ = 6@ // (float)
gosub @AIC_GETBANDITACTOR
0AB2: ret 1 9@

:FUNC_GETVEHICLE
gosub @AIC_GETVEHICLE
0AB2: ret 1 9@

:FUNC_GETOBJECT
gosub @AIC_GETOBJECT
0AB2: ret 1 9@

:AIC_GETPOLICEACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTPOLICEACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH

:AIC_GETBANDITACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTBANDITACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH 

:AIC_GETACTOR
0006: 16@ = 305868
0006: 5@ = @AIC_TESTACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH 

:AIC_GETVEHICLE
0006: 16@ = 305869
0006: 5@ = @AIC_TESTVEHICLEHANDLE
0006: 6@ = 2584
0006: 8@ = -1
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @AIC_STARTSEARCH 
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false @AIC_STARTSEARCH
03C0: 8@ = actor $PLAYER_ACTOR car
0002: jump @AIC_STARTSEARCH

:AIC_GETOBJECT
0006: 16@ = 305871
0006: 5@ = @AIC_TESTOBJECTHANDLE
0006: 6@ = 412

:AIC_STARTSEARCH
008B: 16@ = &0(16@,1i) // CPool*
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 8 )^ = 7@  // CPool.Size
0A8D: 11@ = read_memory 16@ size 4 virtual_protect 0        // CPool.pUnits
0006: 9@ = -1 
0006: 10@ = 0

:AIC_SEARCHLOOPMAIN
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 11@ + 20 )^ = 4@  // xyz*
8039:   not  4@ == 0 
004D: jump_if_false @AIC_SEARCHLOOPNEXT 
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 48 )^ = 12@  // x
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 52 )^ = 13@  // y
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 56 )^ = 14@  // z
050A: 15@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 12@ 13@ 14@ 
0025:   3@ > 15@ // (float) 
004D: jump_if_false @AIC_SEARCHLOOPNEXT 
0085: 9@ = 10@ // (int) // counter
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 4 )^ = 4@ // CPool.flags
005A: 4@ += 9@ // (int) 
0A8D: 4@ = read_memory 4@ size 1 virtual_protect 0 
0012: 9@ *= 256 
005A: 9@ += 4@ // (int)
0002: jump 5@

:AIC_TESTVEHICLEHANDLE
056E:   is 9@ valid_vehicle_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003B:   8@ == 9@ // (int) 
0119:   car 9@ wrecked 
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE

:AIC_TESTACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE 
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
02F2:   actor 9@ model == #FAM1
02F2:   actor 9@ model == #FAM2
02F2:   actor 9@ model == #FAM3
06EE:   actor 9@ in_group $PLAYER_GROUP 
      then
0002:   jump @AIC_NOHANDLE
      end
00D6: if or
003C:   $PLAYER_ACTOR == 9@ // (int) 
0118:   actor 9@ dead
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE

:AIC_TESTBANDITACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
803C:   not $PLAYER_ACTOR == 9@ // (int)
004D: jump_if_false @AIC_NOHANDLE
8118:   not actor 9@ dead
004D: jump_if_false @AIC_NOHANDLE
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
02F2:   actor 9@ model == #BALLAS1
004D: jump_if_false @001
0002: jump @AIC_NEWSEARCHRADIUS
:001
02F2:   actor 9@ model == #BALLAS2
004D: jump_if_false @002
0002: jump @AIC_NEWSEARCHRADIUS
:002
02F2:   actor 9@ model == #BALLAS3
004D: jump_if_false @003
0002: jump @AIC_NEWSEARCHRADIUS
:003
02F2:   actor 9@ model == #LSV1
004D: jump_if_false @004
0002: jump @AIC_NEWSEARCHRADIUS
:004
02F2:   actor 9@ model == #LSV2
004D: jump_if_false @005
0002: jump @AIC_NEWSEARCHRADIUS
:005
02F2:   actor 9@ model == #LSV3
004D: jump_if_false @006
0002: jump @AIC_NEWSEARCHRADIUS
:006
02F2:   actor 9@ model == #VLA1
004D: jump_if_false @007
0002: jump @AIC_NEWSEARCHRADIUS
:007
02F2:   actor 9@ model == #VLA2
004D: jump_if_false @008
0002: jump @AIC_NEWSEARCHRADIUS
:008
02F2:   actor 9@ model == #VLA3
004D: jump_if_false @AIC_NOHANDLE
0002: jump @AIC_NEWSEARCHRADIUS

:AIC_TESTPOLICEACTORHANDLE
056D:   is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
803C:   not $PLAYER_ACTOR == 9@ // (int)
004D: jump_if_false @AIC_NOHANDLE
8118:   not actor 9@ dead
004D: jump_if_false @AIC_NOHANDLE
00A0: store_actor 9@ position_to 22@ 23@ 24@
06BD:   no_obstacles_between 17@ 18@ 19@ and 22@ 23@ 24@ solid 1 car 0 actor 0 object 0 particle 0 
004D: jump_if_false @AIC_NOHANDLE
02F2:   actor 9@ model == #LAPD1
004D: jump_if_false @01
0002: jump @AIC_NEWSEARCHRADIUS
:01
02F2:   actor 9@ model == #SFPD1
004D: jump_if_false @02
0002: jump @AIC_NEWSEARCHRADIUS
:02
02F2:   actor 9@ model == #LVPD1
004D: jump_if_false @03
0002: jump @AIC_NEWSEARCHRADIUS
:03
02F2:   actor 9@ model == #CSHER
004D: jump_if_false @04
0002: jump @AIC_NEWSEARCHRADIUS
:04
02F2:   actor 9@ model == #DSHER
004D: jump_if_false @05
0002: jump @AIC_NEWSEARCHRADIUS
:05
02F2:   actor 9@ model == #LAPDM1
004D: jump_if_false @06
0002: jump @AIC_NEWSEARCHRADIUS
:06
02F2:   actor 9@ model == #SWAT
004D: jump_if_false @07
0002: jump @AIC_NEWSEARCHRADIUS
:07
02F2:   actor 9@ model == #FBI
004D: jump_if_false @08
0002: jump @AIC_NEWSEARCHRADIUS
:08
02F2:   actor 9@ model == #ARMY
004D: jump_if_false @AIC_NOHANDLE
0002: jump @AIC_NEWSEARCHRADIUS

:AIC_TESTOBJECTHANDLE
83CA:   not object 9@ exists 
004D: jump_if_false @AIC_NEWSEARCHRADIUS

:AIC_NOHANDLE
0006: 9@ = -1 
0002: jump @AIC_SEARCHLOOPNEXT 

:AIC_NEWSEARCHRADIUS
{  
   use 0051: return to break the loop
   immediately when found at least one actor/car/object, 
   does not matter if he's nearest one. 
}

// v EXTRA SEARCH CRITERIA GOES HERE v

{
  21@ contains the handle of an actor/car/object 
  that should be excluded from the search result 
  (for example a handle found previously). 
}
//803B:   21@ <> 9@
//004D: jump_if_false @AIC_NOHANDLE 

0051: return     
0085: 3@ = 15@


:AIC_SEARCHLOOPNEXT 
005A: 11@ += 6@ // (int) 
000A: 10@ += 1 
002D:   10@ >= 7@ // (int)
004D: jump_if_false @AIC_SEARCHLOOPMAIN
0051: return 

:AIC_READMEMOFFSET
0A8E: 0@ = 0@ + 1@ // int
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AB2: ret 1 0@

:Interceptor_end

#61 Re: Вопросы по скриптингу » Тюнинг, не заезжая в гараж » 04-12-2009 04:54

Через память всё-таки можно, вот скрипт:

thread 'AnyTrasfender'

{$CLEO}
{$I stdconsts.txt}

var
  $Player_Char: Player
  $Player_Actor: Actor
  $419: Integer
end
wait 1000
$419=0
0@s='MAIN'
0AB1: call_scm_func @InjectJumpOpcode 4 0@ 1@ 60194 @MainIfInject
0AB1: call_scm_func @SetIfNumber 4 thread_name 0@ 1@ offset 60190 number 25
0@s='CARMOD'

while true
  if $Player_Char.Defined
  then
    if and
      0AB0: key_pressed VK_CONTROL
      0AB0: key_pressed VK_T
      $Player_Actor.Driving
      09E7:   player $PLAYER_CHAR not_frozen 
    then
      0926: $Script_Status = external_script_status 66 (CARMOD1) 
      if 
        $Script_Status == 0 
      then
        32@=0
        $419=1
        while 88AB: not external_script 66 (CARMOD1) loaded
          08A9: load_external_script 66 (CARMOD1)
          wait 0
        end
        0913: run_external_script 66 (CARMOD1)
        32@=0
        wait 0
        0AAA: 5@ = pointer_to_thread 'CARMOD' 
        if 5@==0
        then
          0513: show_text_box_1number 'NUMBER' number 666 // ~1~
        end
        0AB1: call_scm_func @SetIfNumber 4 thread_name 0@ 1@ offset 1584 number 23
        0AB1: call_scm_func @InjectJumpOpcode 4 0@ 1@ 1588 @CarmodInject1
        0AB1: call_scm_func @InjectJumpOpcode 4 0@ 1@ 3972 @CarmodInject3
        0AB1: call_scm_func @InjectJumpOpcode 4 0@ 1@ 9765 @CarmodInjectLoadPos
        0AB1: call_scm_func @ReplaceLabelInOpcode 4 0@ 1@ 2148 @CarmodInjectStorePos
        0AB1: call_scm_func @ReplaceLabelInOpcode 4 0@ 1@ 1803 @CarmodInject4
      else
        end_thread_named 'CARMOD'
        090F: end_external_script 66 (CARMOD1) 
      end
      wait 200
    end  
  end
  wait 0
end

:MainIfInject
03B0:   garage 'BODLAWN' door_open 
03B0:   garage 'MODLAST' door_open 
03B0:   garage 'MDSSFSE' door_open 
03B0:   garage 'MDS1SFS' door_open 
03B0:   garage 'VECMOD' door_open 
        $419 == 1
jump 60249

:CarmodInjectEF
00D6: if 0   
0256:   player $2  defined 
004D: jump_if_false -13936
if and
  $419==1
  33@>5000
  09E7: player $PLAYER_CHAR not_frozen 
jf -1426
01EB: set_traffic_density_multiplier_to 1.0
end_thread

:CarmodInject4
if
  $419==1
jf -2356
jump -1810

:CarmodInject3
if
  $419<>1
jf -7392
00D6: if 0   
096F:   car $10431  street_racing_car 
004D: jump_if_false -5615   
jump -3988

:CarmodInjectStorePos
00aa: store_car $CARMOD_Car position_to $10428 $10429 $10430
0A97: 0@ = car $CARMOD_Car struct
0@+=0x14
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0

0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0 //right.x
0@+=4
0A8D: 2@ = read_memory 0@ size 4 virtual_protect 0 //right.y
0@+=4
0A8D: 3@ = read_memory 0@ size 4 virtual_protect 0 //right.z
0@+=8

0A8D: 4@ = read_memory 0@ size 4 virtual_protect 0 //top.x
0@+=4
0A8D: 5@ = read_memory 0@ size 4 virtual_protect 0 //top.y
0@+=4
0A8D: 6@ = read_memory 0@ size 4 virtual_protect 0 //top.z
0@+=8

0A8D: 7@ = read_memory 0@ size 4 virtual_protect 0 //at.x
0@+=4
0A8D: 8@ = read_memory 0@ size 4 virtual_protect 0 //at.y
0@+=4
0A8D: 9@ = read_memory 0@ size 4 virtual_protect 0 //at.z
jump -2185

:CarmodInjectLoadPos
04E4: unknown_refresh_game_renderer_at $10428  $10429   
03CB: set_rendering_origin_at $10428  $10429  $10430  
00AB: put_car $10431  at $10428  $10429  $10430   

if $419<>0
jf -9779
$419=0

0A97: 0@ = car $10431 struct
0@+=0x14
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0

0A8C: write_memory 0@ size 4 value 1@ virtual_protect 0 //right.x
0@+=4
0A8C: write_memory 0@ size 4 value 2@ virtual_protect 0 //right.y
0@+=4
0A8C: write_memory 0@ size 4 value 3@ virtual_protect 0 //right.z
0@+=8

0A8C: write_memory 0@ size 4 value 4@ virtual_protect 0 //top.x
0@+=4
0A8C: write_memory 0@ size 4 value 5@ virtual_protect 0 //top.y
0@+=4
0A8C: write_memory 0@ size 4 value 6@ virtual_protect 0 //top.z
0@+=8

0A8C: write_memory 0@ size 4 value 7@ virtual_protect 0 //at.x
0@+=4
0A8C: write_memory 0@ size 4 value 8@ virtual_protect 0 //at.y
0@+=4
0A8C: write_memory 0@ size 4 value 9@ virtual_protect 0 //at.z
jump -9869

:CarmodInject1 
0103:   actor $3  in_sphere 1042.01294  -1019.92700  31.12700  radius 4.00000  4.00000  2.00000  sphere 1  stopped_in_car 
0103:   actor $3  in_sphere -1935.52795  247.02901  33.56100  radius 4.00000  4.00000  2.00000  sphere 1  stopped_in_car 
0103:   actor $3  in_sphere 2387.07495  1050.51099  9.81200  radius 4.00000  4.00000  2.00000  sphere 1  stopped_in_car 
        $419  == 1        //<<<  
jump -1699


:SetIfNumber{SetFirstByteConstOpcodeParam}
var
  //0@s - InNameThread
  2@: Integer //Offset
  3@: Integer //IfNumber
  
  6@: Integer //Pointer to thread
  4@: Integer
  5@: Integer
end
0AAA: 6@ = pointer_to_thread 0@s
if 6@ == 0
then
  0AB2: ret 0
end
6@+=16
0A8D: 6@ = read_memory 6@ size 4 virtual_protect 0
if 6@==0
then
  6@=0xA49960
end
4@=6@
4@+=2@
//0A8C: write_memory 4@ size 2 {word} value 0x00D6 {if opcode} virtual_protect 1
4@+=2
//0A8C: write_memory 4@ size 1 {byte} value 0x04 {signed byte type} virtual_protect 1
4@+=1

0A8C: write_memory 4@ size 1 {byte} value 3@ {IfNumber} virtual_protect 0
0AB2: ret 0


:ReplaceLabelInOpcode
var
  //0@s - InNameThread
  2@: Integer //Offset
  3@: Integer //InLabel
  
  6@: Integer //Pointer to thread
  4@: Integer
  5@: Integer
end
0AAA: 6@ = pointer_to_thread 0@s
if 6@ == 0
then
  0AB2: ret 0
end
6@+=16
0A8D: 6@ = read_memory 6@ size 4 virtual_protect 0
if 6@==0
then
  6@=0xA49960
end
4@=6@
4@+=2@
//0A8C: write_memory 4@ size 2 {word} value 0x0002 {jump opcode} virtual_protect 1
4@+=2
0A8C: write_memory 4@ size 1 {byte} value 0x01 {label type} virtual_protect 1
4@+=1

0A9F: 5@ = current_thread_pointer

5@+=16
0A8D: 5@ = read_memory 5@ size 4 virtual_protect 0

5@-=0xA49960
5@-=3@

0A8C: write_memory 4@ size 4 {dword} value 5@ {label} virtual_protect 0
0AB2: ret 0


:InjectJumpOpcode
var
  //0@s - InNameThread
  2@: Integer //Offset
  3@: Integer //InLabel
  
  6@: Integer //Pointer to thread
  4@: Integer
  5@: Integer
end
0AAA: 6@ = pointer_to_thread 0@s
if 6@ == 0
then
  0AB2: ret 0
end
6@+=16
0A8D: 6@ = read_memory 6@ size 4 virtual_protect 0
if 6@==0
then
  6@=0xA49960
end
4@=6@
4@+=2@
0A8C: write_memory 4@ size 2 {word} value 0x0002 {jump opcode} virtual_protect 1
4@+=2
0A8C: write_memory 4@ size 1 {byte} value 0x01 {label type} virtual_protect 1
4@+=1

0A9F: 5@ = current_thread_pointer

5@+=16
0A8D: 5@ = read_memory 5@ size 4 virtual_protect 0

5@-=0xA49960
5@-=3@

0A8C: write_memory 4@ size 4 {dword} value 5@ {label} virtual_protect 0
0AB2: ret 0

Используется run-time изменение оригинального скрипта трансфендера через редактирование памяти. Правда, иногда глючит, пропадает траффик.

#62 Re: Вопросы по скриптингу » Заблокировать внешнюю угрозу :) » 20-11-2009 10:46

Можно поменять заголовок окна:

{$CLEO}

0AB1: call_scm_func @__LabelToPointer 1 @Caption 1@
0AA5: call 0x00619420 num_params 1 pop 1 1@
0A93: end_custom_thread

:Caption
0900: "Сан Андреас 2.0"
0000:

:__LabelToPointer
if
    0@ == 0
then
    0AB2: ret 1 0
end
0A9F: 1@ = current_thread_pointer
1@ += 0x10 
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0 // baseIP
0062: 1@ -= 0@ // label address
1@ += 4
//1@ += 0xA49960
0AB2: ret 1 1@

Большинство трейнеров после этого начинают думать, что SA не запущен. По крайней мере я проверял на San Andreas Teleport, MapTeleporter и GTASA Control Center.
ReVOLVeR Dox *+4TRAiNER* и Metroid +11 Trainer перестаёт работать, если переименовать gta_sa.exe.
Для того что-бы отключить SACamHack, нужно ещё поменять класс окна. Но я не знаю, как это сделать через Cleo.
Но ArtMoney такими трюками уже не обманешь smile.

#63 Re: Модификации » Езда по земле, горам, стенам, потолкам и др. » 19-11-2009 10:13

Не по теме smile . Прочитай внимательнее мой пост :

P.S. С указанием автора мои скрипты выкладывать можно всегда.

Не надо флудить sad.

#64 Программы для GTA » Тема: CleoOptimizer » 19-11-2009 09:59

VcSaJen
Replies: 3

Наверное уже давно поздно опубликовывать эту мою старую программу, но оказывается есть ещё люди, играющие в SA, поэтому всё-таки опубликую.
CleoOptimizer - это программа для преобразования старых миссий, написанных для мейна в Cleo-миссии. Программа заменяет глобальные переменные на локальные.
Программа учитывает такие факторы, как:
+ Не преобразовывает в локальные предопределённые в CustomVariables.ini глобальные переменные, такие как $ONMISSION и $Player_Actor.
+ Учитывает, что 32@ и 33@ - таймеры и их нельзя использовать для хранения.
+ Учитывает, что переменные могут занимать по несколько "слотов" (например, 0@v занимает 0@,1@,2@,3@)
+ Учитывает, что некоторые локальные "слоты" могут быть заняты использованными в миссии локальными переменными
+ Учитывает размеры глобальных и локальных массивов
+ Не преобразовывает закомментированные переменные и внутри строк
+ Учитывает, что в опкодах статус-текстов и таймеров требуются глобальные переменные
+ Автоматически определяет тип потока (обычный или миссия)
+ Преобразовывает опкоды end_thread, create_thread, create_thread_wb, start_mission.
+ Учитывает, что SannyBuilder не умеет работать с именованными константами - массивами.
+ Дополнительныя опция - дефрагментация локальных переменных - используется, если не хватает места.

Инструкция по преобразовыванию пакета миссий:
1) Разделите код на отдельные потоки (миссии и их стартеры)
2) Вставить код ОДНОГО потока в левое многострочное текстовое поле.
3) Нажать кнопку Преобразовать
4) Ответить на вопросы
5) Сконвентированный код появится в правом поле.
6) Проделать это для каждого потока.

В основном, выходной код не нуждается в дополнительном редактировании, или таких моментов очень мало, в большинстве случаев некритичный обмен переменными между стартером и миссией и решаемый опкодами [c]0AB3[/c] и [c]0AB4[/c].

Конечно, не все миссии поддаются быстрому конвентированию в Cleo-формат, т.к. миссия может обмениваться данными с параллейным потоком мейна с помощью глобальных переменных (например, миссия "Блокбастер «Смерть полицейского»" от Nikitos). К счастью, таких моментов обычно мало. Такую миссию и параллейный поток после преобразования нужно вручную подредактировать с использованием Cleo-опкодов [c]0AB3[/c] и [c]0AB4[/c] (глобальные Cleo-переменные). Также миссия может использовать "номерные" глобальные переменные из кода оригинального мейна (например, отключать парковку  т. д.). В таком случае можно вручную исправить.

Пример работы CleoOptimize:
Код миссии Дрифт v2.0 от Flash для мейна:

{В .fxt файл (CLEO_TEXT плагин) необходимо добавить следующее:

DRIFT Drift
DRIFTHI Need to win:
DRIFYOU Your score:
DRIFBON Bonus:
DRIFBNN x~1~}

//This script was created by 'GTA: San Andreas Race Mission Creator v1.0'


:Lap_Example
$Lap_Example_XCoord = 2480.55
$Lap_Example_YCoord = -1666.06
$Lap_Example_ZCoord = 13.34
$Lap_Example_Marker = Marker.CreateIconAndSphere(53, $Lap_Example_XCoord, $Lap_Example_YCoord, $Lap_Example_ZCoord)

:Lap_Example_1349
wait 25 ms
Player.Defined($PLAYER_CHAR)
jf @Lap_Example_1349
0101: actor $PLAYER_ACTOR stopped_near_point $Lap_Example_XCoord $Lap_Example_YCoord $Lap_Example_ZCoord radius 3.0 3.0 3.0 sphere 0
jf @Lap_Example_1349
Player.Controllable($PLAYER_CHAR)
jf @Lap_Example_1349
$ONMISSION == 0 // integer values
jf @Lap_Example_1349
Marker.Disable($11192)
054C: use_GXT_table 'RACETOR'
00BA: text_styled 'RACES_0' 1500 ms 2
0169: set_fade_color 0 0 0
fade 0 (in) 2500 ms

:Lap_Example_1492
wait 0 ms
not fading
jf @Lap_Example_1492
Marker.Disable($11192)
00BE: text_clear_all
03E6: remove_text_box

if $DRIFT_MISSION_PASSED == 0//
then $hiscore = 150// Начальное кол-во очков, необходимых для победы //
end//

start_mission 0
end_thread


//-------------Mission 0---------------

:Lap_Example_000
thread 'EXAMPL1'
gosub @Lap_Example_47
wasted_or_busted
jf @Lap_Example_38
gosub @Lap_Example_2497

:Lap_Example_38
gosub @Lap_Example_2762
end_thread

:Lap_Example_47
increment_mission_attempts
$ONMISSION = 1
Player.ClearWantedLevel($PLAYER_CHAR)
00BE: text_clear_all

{Мои переменные и константы}
const//
PLAYER_CAR = $car[1]//
TEMP_SCORE = 8@//
BONUS = 9@//
DRIFT_ANGLE = 15.0//
CAR_HEALTH = 10@//
CAR_SPEED = 7@//
SPEED_LIMIT = 10.0//
DRIFTING_ANGLE = 15@//
end//
var//
1@:float//
2@:float//
3@:float//
4@:float//
5@:float//
6@:float//
7@:float//
8@:int//
9@:int//
10@:int//
11@:int//
12@:int//
13@:int//
14@:int//
15@:int//
$score:int//
end//

var
$nar : Integer
$tar : Integer
$time : Integer = 1000
$dist : Float
$dist2 : Float
$pos : Integer = 1
$pos2 : Integer = 1
$stage : Array 5 of Integer
$car : Array 5 of Car
$model : Array 5 of Model
$act : Array 5 of Actor
$mark : Array 5 of Marker
$carx : Array 5 of Float
$cary : Array 5 of Float
$carz : Array 5 of Float
$angle : Array 5 of Float
$paintjob : Array 5 of Integer
$pointx : Array 17 of Float
$pointy : Array 17 of Float
$pointz : Array 17 of Float
$speed : Array 17 of Float
$type : Array 17 of Integer
$components : Array 9 of Model
$component1 : Array 9 of Model
$component2 : Array 9 of Model
$component3 : Array 9 of Model
$component4 : Array 9 of Model
$component5 : Array 9 of Model
$component6 : Array 9 of Model
$component7 : Array 9 of Model
$component8 : Array 9 of Model
$component9 : Array 9 of Model
$component10 : Array 9 of Model
end
for $par = 1 to 1
$stage[$par] = 1
end
$pointx[1] = 2372.91
$pointy[1] = -1658.93
$pointz[1] = 13.38
$speed[1] = 100.0
$type[1] = 3
$pointx[2] = 2342.61
$pointy[2] = -1580.44
$pointz[2] = 23.76
$speed[2] = 50.0
$type[2] = 3
$pointx[3] = 2342.81
$pointy[3] = -1538.50
$pointz[3] = 23.84
$speed[3] = 100.0
$type[3] = 3
$pointx[4] = 2228.25
$pointy[4] = -1484.19
$pointz[4] = 23.23
$speed[4] = 100.0
$type[4] = 3
$pointx[5] = 2212.02
$pointy[5] = -1398.15
$pointz[5] = 23.34
$speed[5] = 100.0
$type[5] = 3
$pointx[6] = 2068.81
$pointy[6] = -1278.58
$pointz[6] = 23.34
$speed[6] = 100.0
$type[6] = 3
$pointx[7] = 1792.85
$pointy[7] = -1273.45
$pointz[7] = 12.98
$speed[7] = 100.0
$type[7] = 3
$pointx[8] = 1792.85
$pointy[8] = -1273.45
$pointz[8] = 12.98
$speed[8] = 50.0
$type[8] = 3
$pointx[9] = 1715.13
$pointy[9] = -1417.16
$pointz[9] = 12.90
$speed[9] = 100.0
$type[9] = 3
$carx[1] = 2457.08
$cary[1] = -1656.42
$carz[1] = 13.30
$angle[1] = 90.0
$paintjob[1] = 0
$model[1] = #ELEGY
$components[1] = 7
$component1[1] = #WG_L_A_L
$component2[1] = #EXH_C_L
$component3[1] = #RF_C_L
$component4[1] = #SPL_C_L_B
$component5[1] = #RBMP_C_L
$component6[1] = #FBMP_C_L
$component7[1] = #WG_L_C_L
for $par = 1 to 1
$model[$par].Load
end
06E9: request_car_component $component1[1]
06E9: request_car_component $component2[1]
06E9: request_car_component $component3[1]
06E9: request_car_component $component4[1]
06E9: request_car_component $component5[1]
06E9: request_car_component $component6[1]
06E9: request_car_component $component7[1]
wait 1000 ms

:Lap_Example_111
wait 0 ms
for $par = 1 to 1
$model[$par].Available
jf @Lap_Example_111
end
if and
06EA: car_component $component1[1] available
06EA: car_component $component2[1] available
06EA: car_component $component3[1] available
06EA: car_component $component4[1] available
06EA: car_component $component5[1] available
06EA: car_component $component6[1] available
06EA: car_component $component7[1] available
jf @Lap_Example_111
01EB: set_traffic_density_to 0.0
0395: clear_area 1 at $carx[1] $cary[1] $carz[1] range 300.0
for $par = 1 to 1
$car[$par] = Car.Create($model[$par], $carx[$par], $cary[$par], $carz[$par])
Car.Angle($car[$par]) = $angle[$par]
// Car.SetImmunities($car[$par], 1, 1, 1, 1, 1)
07EE: car $car[$par] enable_tire_marks 1
Car.DoorStatus($car[$par]) = 2
if $components[$par] >= 1
then
06E7: $cmpnent = add_car_component $component1[$par] to_car $car[$par]
if $components[$par] >= 2
then
06E7: $cmpnent2 = add_car_component $component2[$par] to_car $car[$par]
if $components[$par] >= 3
then
06E7: $cmpnent3 = add_car_component $component3[$par] to_car $car[$par]
if $components[$par] >= 4
then
06E7: $cmpnent4 = add_car_component $component4[$par] to_car $car[$par]
if $components[$par] >= 5
then
06E7: $cmpnent5 = add_car_component $component5[$par] to_car $car[$par]
if $components[$par] >= 6
then
06E7: $cmpnent6 = add_car_component $component6[$par] to_car $car[$par]
if $components[$par] >= 7
then
06E7: $cmpnent7 = add_car_component $component7[$par] to_car $car[$par]
if $components[$par] >= 8
then
06E7: $cmpnent8 = add_car_component $component8[$par] to_car $car[$par]
if $components[$par] >= 9
then
06E7: $cmpnent9 = add_car_component $component9[$par] to_car $car[$par]
if $components[$par] >= 10
then
06E7: $cmpnent10 = add_car_component $component10[$par] to_car $car[$par]
end
end
end
end
end
end
end
end
end
end
if $paintjob[$par] <> -1
then
06ED: set_car $car[$par] paintjob $paintjob[$par]
end
end
036A: put_actor $PLAYER_ACTOR in_vehicle $car[1]
0407: create_coordinate $camx $camy $camz from_car $car[1] offset 0.0 -23.7 14.1
Camera.SetPosition($camx, $camy, $camz, 0.0, 0.0, 0.0)
Camera.OnVehicle($car[1], 15, 1)
Player.CanMove($PLAYER_CHAR) = False
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 1
03F4: set_all_vehicles_apply_damage_rules 0
wait 2500 ms
fade 1 (out) 1000 ms
wait 1000 ms
00BA: text_styled 'RACES_4' 1100 ms 4 // 3
097A: at 0.0 0.0 0.0 play_sound 1056
wait 1100 ms
0407: create_coordinate $camx2 $camy2 $camz2 from_car $car[1] offset 0.0 -13.7 7.1
Camera.SetPosition($camx2, $camy2, $camz2, 0.0, 0.0, 0.0)
Camera.OnVehicle($car[1], 15, 1)
0460: set_camera_pointing_time 0.0 2000
00BA: text_styled 'RACES_5' 1100 ms 4 // 2
097A: at 0.0 0.0 0.0 play_sound 1056
wait 1100 ms
0407: create_coordinate $camx3 $camy3 $camz3 from_car $car[1] offset 0.0 -6.7 3.1
Camera.SetPosition($camx3, $camy3, $camz3, 0.0, 0.0, 0.0)
Camera.OnVehicle($car[1], 15, 1)
0460: set_camera_pointing_time 0.0 2000
00BA: text_styled 'RACES_6' 1100 ms 4 // 1
097A: at 0.0 0.0 0.0 play_sound 1056
wait 1100 ms
00BA: text_styled 'RACES_7' 800 ms 4 // GO!
097A: at 0.0 0.0 0.0 play_sound 1057
01BD: 11@ = current_time_in_ms
Player.CanMove($PLAYER_CHAR) = True
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0
03F4: set_all_vehicles_apply_damage_rules 1
01EB: set_traffic_density_to 0.0
Camera.SetBehindPlayer
Camera.Restore

//03C3: set_timer_with_text_to $time type 1 text 'TIMER' // TIME
14@ = car.Health(PLAYER_CAR)//

for $kar = 1 to 9
$nar = $kar // integer values
$nar += 1 // integer values
018A: $chekp = create_checkpoint_at $pointx[$kar] $pointy[$kar] $pointz[$kar]
0168: show_on_radar $chekp 4
if
$kar == 9 // integer values
then
1@ = 1
Marker.SetColor($chekp, 0)
end
06D5: $rchekp = create_racing_checkpoint_at $pointx[$kar] $pointy[$kar] $pointz[$kar] point_to $pointx[$nar] $pointy[$nar] $pointz[$nar] type 1@ radius 6.0
while 8100: not actor $PLAYER_ACTOR near_point_in_vehicle $pointx[$kar] $pointy[$kar] $pointz[$kar] radius 12.0 12.0 12.0 sphere 0

// if
// $time <= 0
// then
// jump @Lap_Example_2497
// end

gosub @drift//

03F0: toggle_text_draw 1//
033F: set_text_draw_letter_size 0.7 0.933//
0340: set_text_draw_RGBA 255 255 255 255//
0348: toggle_text_draw_proportional 1//
0349: set_text_draw_font 2//
060D: draw_text_shadow 1 color_RGBA 0 0 0 255//
045A: draw_text_1number 130.0 415.0 GXT 'NUMBER' number DRIFTING_ANGLE//

08DA: remove_panel 16@//
08D4: 16@ = create_panel_with_title 'DRIFT' position 29.0 30.0 width 35.0 columns 2 interactive 0 background 1 alignment 1//
09DB: set_panel 16@ column 0 width 120//
08DB: set_panel 16@ column 0 header 'DUMMY' data 'DRIFTHI' 'DRIFYOU' 'DUMMY' 'DRIFBON' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'//
08DB: set_panel 16@ column 1 header 'DUMMY' data 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'//
08EE: set_panel 16@ column 1 row 0 text_1number GXT 'NUMBER' number $hiscore//
08EE: set_panel 16@ column 1 row 1 text_1number GXT 'NUMBER' number $score//
08EE: set_panel 16@ column 1 row 3 text_1number GXT 'DRIFBNN' number BONUS//

if TEMP_SCORE > 0//
then//
033F: set_text_draw_letter_size 1.3 1.7//
0340: set_text_draw_RGBA 217 222 12 150//
0348: toggle_text_draw_proportional 1//
0349: set_text_draw_font 3//
060D: draw_text_shadow 0 color_RGBA 0 0 0 125//
0912: unknown_text_draw_flag 1 height 355 width 370//
0342: toggle_text_draw_centered 1//
045A: draw_text_1number 280.0 100.0 GXT 'NUMBER' number TEMP_SCORE//
end//


if and
$pos = 1 // integer values
not Actor.InCar($PLAYER_ACTOR, $car[1])
then
jump @Lap_Example_2497
end
if or
Car.Wrecked($car[1])
02BF: car $car[1] sunk
then
jump @Lap_Example_2497
end
// wait 0 ms
end
Marker.Disable($chekp)
06D6: delete_racing_checkpoint $rchekp
097A: at 0.0 0.0 0.0 play_sound 1058
end
jump @Lap_Example_2491

:Lap_Example_2491
gosub @Lap_Example_REMOVE
if
// $pos2 == 1
002c: $score >= $hiscore//
then
$DRIFT_MISSION_PASSED = 1//
0084: $hiscore = $score//
$score = 0//


00BA: text_styled 'RACES18' 3000 ms 1 // Winner!
wait 3000 ms
01E3: text_1number_styled 'M_PASS' 3000 4000 ms 1 // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 3000
// 01BD: 12@ = current_time_in_ms
// 0085: 13@ = 12@ // integer values and handles
// 0062: 13@ -= 11@ // integer values
// 13@ /= 1000.0 // floating-point values
// 0085: 452@ = 13@ // integer values and handles
// 452@ /= 60 // integer values
// 0085: 36@ = 452@ // integer values and handles
// 36@ *= 60 // integer values
// 0085: 453@ = 13@ // integer values and handles
// 0062: 453@ -= 36@ // integer values
0394: play_music 1
// 02FD: text_2numbers_lowpriority 'TIME' 452@ 453@ 8000 ms 1 // ~1~:~1~
else
01E3: text_1number_styled 'RACES_8' 200 5000 ms 1 // Loser!
create_thread @Lap_Example
// 01BD: 12@ = current_time_in_ms
// 0085: 13@ = 12@ // integer values and handles
// 0062: 13@ -= 11@ // integer values
// 13@ /= 1000.0 // floating-point values
// 0085: 452@ = 13@ // integer values and handles
// 452@ /= 60 // integer values
// 0085: 36@ = 452@ // integer values and handles
// 36@ *= 60 // integer values
// 0085: 453@ = 13@ // integer values and handles
// 0062: 453@ -= 36@ // integer values
// 02FD: text_2numbers_lowpriority 'TIME' 452@ 453@ 8000 ms 1 // ~1~:~1~
end
0318: set_latest_mission_passed_to 'RACES_0'
Player.ClearWantedLevel($PLAYER_CHAR)
create_thread @Lap_Example
gosub @Lap_Example_38
return

:Lap_Example_2497
gosub @Lap_Example_REMOVE
00BA: text_styled 'RACES_8' 5000 ms 1 // Loser!
create_thread @Lap_Example
return

:Lap_Example_REMOVE
01EB: set_traffic_density_to 1.0
Car.DoorStatus($car[1]) = 0
for $par = 1 to 1
if
$car[$par] <> -1
then
Car.SetImmunities($car[$par], 0, 0, 0, 0, 0)
Model.Destroy($model[$par])
Car.RemoveReferences($car[$par])
if
$par <> 1
then
Marker.Disable($mark[$par])
Actor.RemoveReferences($act[$par])
end
end
end
06EB: release_car_component $component1[1]
06EB: release_car_component $component2[1]
06EB: release_car_component $component3[1]
06EB: release_car_component $component4[1]
06EB: release_car_component $component5[1]
06EB: release_car_component $component6[1]
06EB: release_car_component $component7[1]
Marker.Disable($chekp)
06D6: delete_racing_checkpoint $rchekp
03F0: toggle_text_draw 0
014F: delete_timer $time
01B7: release_weather

00BE: text_clear_all//
$score += TEMP_SCORE//
08DA: remove_panel 16@//

return

:Lap_Example_2762
$ONMISSION = 0 // integer values
mission_cleanup
return


{Все последующие строки - мой код.
Их тоже необходимо вставлять в файл.}

:drift
//wait 0
11@ = TEMP_SCORE
gosub @drifted

if
TEMP_SCORE > 11@
then

12@ = 0
13@ = 0
else
if 12@ == 0
then
01BD: 12@ = current_time_in_ms
end
if
13@ <= 2000
then
01BD: 13@ = current_time_in_ms
13@ -= 12@
else
$score += TEMP_SCORE
TEMP_SCORE = 0
12@ = 0
13@ = 0
end
end

CAR_HEALTH = car.Health(PLAYER_CAR)
if
CAR_HEALTH < 14@
then
TEMP_SCORE = 0
12@ = 0
13@ = 0
14@ = CAR_HEALTH
//0A30: repair_car PLAYER_CAR //раскомментируйте эти строки, если необходимо установить на авто иммунитеты //
//14@ = car.Health(PLAYER_CAR) //
00BE: text_clear_all
wait 2000
end

return

:drifted
car.StorePos(PLAYER_CAR,1@,2@,3@)
wait 0
car.StorePos(PLAYER_CAR,3@,4@,5@)
3@ -= 1@
4@ -= 2@
02F8: get_car PLAYER_CAR Z_angle_cosine_to 5@
02F9: get_car PLAYER_CAR Z_angle_sine_to 6@
05A4: get_angle_between_vectors_origin_to 5@ 6@ and_origin_to 3@ 4@ store_to 5@

0087: DRIFTING_ANGLE = 5@
0092: DRIFTING_ANGLE = float DRIFTING_ANGLE to_integer

02E3: CAR_SPEED = car PLAYER_CAR speed
if and
CAR_SPEED >= SPEED_LIMIT
81F4: not car PLAYER_CAR flipped
8119: not car PLAYER_CAR wrecked
82BF: not car PLAYER_CAR sunk
81F3: not car PLAYER_CAR in_air
then
BONUS = 1
if CAR_SPEED >= 19.0
then
BONUS = 2
end
if CAR_SPEED >= 31.0
then
BONUS = 3
end
if CAR_SPEED >= 46.0
then
BONUS = 4
end
if CAR_SPEED >= 63.0
then
BONUS = 5
end

if and
TEMP_SCORE >=50
TEMP_SCORE <150
then
BONUS *= 2
end
if and
TEMP_SCORE >=150
TEMP_SCORE <500
then
BONUS *= 3
end
if and
TEMP_SCORE >=500
TEMP_SCORE <1000
then
BONUS *= 4
end
if TEMP_SCORE >=1000
then
BONUS *= 5
end

if and
5@ >= DRIFT_ANGLE
5@ <= 90.0
then inc(TEMP_SCORE,BONUS)
end
end

return

А вот сконвентированный код:
Миссия:

{$CLEO .cm}

const
  _car = 17@
  _score = 0@
  _nar = 22@
  _tar = 23@
  _time = $1797
  _dist = 25@
  _dist2 = 26@
  _pos = 27@
  _pos2 = 28@
  _stage = 34@
  _model = 39@
  _act = 44@
  _mark = 49@
  _carx = 54@
  _cary = 59@
  _carz = 64@
  _angle = 69@
  _paintjob = 74@
  _pointx = 79@
  _pointy = 96@
  _pointz = 113@
  _speed = 130@
  _type = 147@
  _components = 164@
  _component1 = 173@
  _component2 = 182@
  _component3 = 191@
  _component4 = 200@
  _component5 = 209@
  _component6 = 218@
  _component7 = 227@
  _component8 = 236@
  _component9 = 245@
  _component10 = 254@
  _par = 29@
  _cmpnent = 30@
  _cmpnent2 = 31@
  _cmpnent3 = 263@
  _cmpnent4 = 264@
  _cmpnent5 = 265@
  _cmpnent6 = 266@
  _cmpnent7 = 267@
  _cmpnent8 = 268@
  _cmpnent9 = 269@
  _cmpnent10 = 270@
  _camx = 271@
  _camy = 272@
  _camz = 273@
  _camx2 = 274@
  _camy2 = 275@
  _camz2 = 276@
  _camx3 = 277@
  _camy3 = 278@
  _camz3 = 279@
  _kar = 280@
  _chekp = 281@
  _rchekp = 282@
  _hiscore = 283@
  _DRIFT_MISSION_PASSED = 284@
end

//-------------Mission 0---------------

:Lap_Example_000
thread 'EXAMPL1'
gosub @Lap_Example_47
wasted_or_busted
jf @Lap_Example_38
gosub @Lap_Example_2497

:Lap_Example_38
gosub @Lap_Example_2762
end_thread

:Lap_Example_47
increment_mission_attempts
$ONMISSION = 1
Player.ClearWantedLevel($PLAYER_CHAR)
00BE: text_clear_all

{Мои переменные и константы}
const//
PLAYER_CAR = {_car[1]}18@//
TEMP_SCORE = 8@//
BONUS = 9@//
DRIFT_ANGLE = 15.0//
CAR_HEALTH = 10@//
CAR_SPEED = 7@//
SPEED_LIMIT = 10.0//
DRIFTING_ANGLE = 15@//
end//
var//
1@:float//
2@:float//
3@:float//
4@:float//
5@:float//
6@:float//
7@:float//
8@:int//
9@:int//
10@:int//
11@:int//
12@:int//
13@:int//
14@:int//
15@:int//
_score:int//
end//

var
_nar : Integer
_tar : Integer
_time : Integer = 1000
_dist : Float
_dist2 : Float
_pos : Integer = 1
_pos2 : Integer = 1
_stage : Array 5 of Integer
_car : Array 5 of Car
_model : Array 5 of Model
_act : Array 5 of Actor
_mark : Array 5 of Marker
_carx : Array 5 of Float
_cary : Array 5 of Float
_carz : Array 5 of Float
_angle : Array 5 of Float
_paintjob : Array 5 of Integer
_pointx : Array 17 of Float
_pointy : Array 17 of Float
_pointz : Array 17 of Float
_speed : Array 17 of Float
_type : Array 17 of Integer
_components : Array 9 of Model
_component1 : Array 9 of Model
_component2 : Array 9 of Model
_component3 : Array 9 of Model
_component4 : Array 9 of Model
_component5 : Array 9 of Model
_component6 : Array 9 of Model
_component7 : Array 9 of Model
_component8 : Array 9 of Model
_component9 : Array 9 of Model
_component10 : Array 9 of Model
end
for _par = 1 to 1
{_stage}34@[_par] = 1
end
{_pointx[1]}80@ = 2372.91
{_pointy[1]}97@ = -1658.93
{_pointz[1]}114@ = 13.38
{_speed[1]}131@ = 100.0
{_type[1]}148@ = 3
{_pointx[2]}81@ = 2342.61
{_pointy[2]}98@ = -1580.44
{_pointz[2]}115@ = 23.76
{_speed[2]}132@ = 50.0
{_type[2]}149@ = 3
{_pointx[3]}82@ = 2342.81
{_pointy[3]}99@ = -1538.50
{_pointz[3]}116@ = 23.84
{_speed[3]}133@ = 100.0
{_type[3]}150@ = 3
{_pointx[4]}83@ = 2228.25
{_pointy[4]}100@ = -1484.19
{_pointz[4]}117@ = 23.23
{_speed[4]}134@ = 100.0
{_type[4]}151@ = 3
{_pointx[5]}84@ = 2212.02
{_pointy[5]}101@ = -1398.15
{_pointz[5]}118@ = 23.34
{_speed[5]}135@ = 100.0
{_type[5]}152@ = 3
{_pointx[6]}85@ = 2068.81
{_pointy[6]}102@ = -1278.58
{_pointz[6]}119@ = 23.34
{_speed[6]}136@ = 100.0
{_type[6]}153@ = 3
{_pointx[7]}86@ = 1792.85
{_pointy[7]}103@ = -1273.45
{_pointz[7]}120@ = 12.98
{_speed[7]}137@ = 100.0
{_type[7]}154@ = 3
{_pointx[8]}87@ = 1792.85
{_pointy[8]}104@ = -1273.45
{_pointz[8]}121@ = 12.98
{_speed[8]}138@ = 50.0
{_type[8]}155@ = 3
{_pointx[9]}88@ = 1715.13
{_pointy[9]}105@ = -1417.16
{_pointz[9]}122@ = 12.90
{_speed[9]}139@ = 100.0
{_type[9]}156@ = 3
{_carx[1]}55@ = 2457.08
{_cary[1]}60@ = -1656.42
{_carz[1]}65@ = 13.30
{_angle[1]}70@ = 90.0
{_paintjob[1]}75@ = 0
{_model[1]}40@ = #ELEGY
{_components[1]}165@ = 7
{_component1[1]}174@ = #WG_L_A_L
{_component2[1]}183@ = #EXH_C_L
{_component3[1]}192@ = #RF_C_L
{_component4[1]}201@ = #SPL_C_L_B
{_component5[1]}210@ = #RBMP_C_L
{_component6[1]}219@ = #FBMP_C_L
{_component7[1]}228@ = #WG_L_C_L
for _par = 1 to 1
{_model}39@[_par].Load
end
06E9: request_car_component {_component1[1]}174@
06E9: request_car_component {_component2[1]}183@
06E9: request_car_component {_component3[1]}192@
06E9: request_car_component {_component4[1]}201@
06E9: request_car_component {_component5[1]}210@
06E9: request_car_component {_component6[1]}219@
06E9: request_car_component {_component7[1]}228@
wait 1000 ms

:Lap_Example_111
wait 0 ms
for _par = 1 to 1
{_model}39@[_par].Available
jf @Lap_Example_111
end
if and
06EA: car_component {_component1[1]}174@ available
06EA: car_component {_component2[1]}183@ available
06EA: car_component {_component3[1]}192@ available
06EA: car_component {_component4[1]}201@ available
06EA: car_component {_component5[1]}210@ available
06EA: car_component {_component6[1]}219@ available
06EA: car_component {_component7[1]}228@ available
jf @Lap_Example_111
01EB: set_traffic_density_to 0.0
0395: clear_area 1 at {_carx[1]}55@ {_cary[1]}60@ {_carz[1]}65@ range 300.0
for _par = 1 to 1
{_car}17@[_par] = Car.Create({_model}39@[_par], {_carx}54@[_par], {_cary}59@[_par], {_carz}64@[_par])
Car.Angle({_car}17@[_par]) = {_angle}69@[_par]
// Car.SetImmunities($car[$par], 1, 1, 1, 1, 1)
07EE: car {_car}17@[_par] enable_tire_marks 1
Car.DoorStatus({_car}17@[_par]) = 2
if {_components}164@[_par] >= 1
then
06E7: _cmpnent = add_car_component {_component1}173@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 2
then
06E7: _cmpnent2 = add_car_component {_component2}182@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 3
then
06E7: _cmpnent3 = add_car_component {_component3}191@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 4
then
06E7: _cmpnent4 = add_car_component {_component4}200@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 5
then
06E7: _cmpnent5 = add_car_component {_component5}209@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 6
then
06E7: _cmpnent6 = add_car_component {_component6}218@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 7
then
06E7: _cmpnent7 = add_car_component {_component7}227@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 8
then
06E7: _cmpnent8 = add_car_component {_component8}236@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 9
then
06E7: _cmpnent9 = add_car_component {_component9}245@[_par] to_car {_car}17@[_par]
if {_components}164@[_par] >= 10
then
06E7: _cmpnent10 = add_car_component {_component10}254@[_par] to_car {_car}17@[_par]
end
end
end
end
end
end
end
end
end
end
if {_paintjob}74@[_par] <> -1
then
06ED: set_car {_car}17@[_par] paintjob {_paintjob}74@[_par]
end
end
036A: put_actor $PLAYER_ACTOR in_vehicle {_car[1]}18@
0407: create_coordinate _camx _camy _camz from_car {_car[1]}18@ offset 0.0 -23.7 14.1
Camera.SetPosition(_camx, _camy, _camz, 0.0, 0.0, 0.0)
Camera.OnVehicle({_car[1]}18@, 15, 1)
Player.CanMove($PLAYER_CHAR) = False
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 1
03F4: set_all_vehicles_apply_damage_rules 0
wait 2500 ms
fade 1 (out) 1000 ms
wait 1000 ms
00BA: text_styled 'RACES_4' 1100 ms 4 // 3
097A: at 0.0 0.0 0.0 play_sound 1056
wait 1100 ms
0407: create_coordinate _camx2 _camy2 _camz2 from_car {_car[1]}18@ offset 0.0 -13.7 7.1
Camera.SetPosition(_camx2, _camy2, _camz2, 0.0, 0.0, 0.0)
Camera.OnVehicle({_car[1]}18@, 15, 1)
0460: set_camera_pointing_time 0.0 2000
00BA: text_styled 'RACES_5' 1100 ms 4 // 2
097A: at 0.0 0.0 0.0 play_sound 1056
wait 1100 ms
0407: create_coordinate _camx3 _camy3 _camz3 from_car {_car[1]}18@ offset 0.0 -6.7 3.1
Camera.SetPosition(_camx3, _camy3, _camz3, 0.0, 0.0, 0.0)
Camera.OnVehicle({_car[1]}18@, 15, 1)
0460: set_camera_pointing_time 0.0 2000
00BA: text_styled 'RACES_6' 1100 ms 4 // 1
097A: at 0.0 0.0 0.0 play_sound 1056
wait 1100 ms
00BA: text_styled 'RACES_7' 800 ms 4 // GO!
097A: at 0.0 0.0 0.0 play_sound 1057
01BD: 11@ = current_time_in_ms
Player.CanMove($PLAYER_CHAR) = True
03BF: set_player $PLAYER_CHAR ignored_by_everyone_to 0
03F4: set_all_vehicles_apply_damage_rules 1
01EB: set_traffic_density_to 0.0
Camera.SetBehindPlayer
Camera.Restore

//03C3: set_timer_with_text_to $time type 1 text 'TIMER' // TIME
14@ = car.Health(PLAYER_CAR)//

for _kar = 1 to 9
_nar = _kar // integer values
_nar += 1 // integer values
018A: _chekp = create_checkpoint_at {_pointx}79@[_kar] {_pointy}96@[_kar] {_pointz}113@[_kar]
0168: show_on_radar _chekp 4
if
_kar == 9 // integer values
then
1@ = 1
Marker.SetColor(_chekp, 0)
end
06D5: _rchekp = create_racing_checkpoint_at {_pointx}79@[_kar] {_pointy}96@[_kar] {_pointz}113@[_kar] point_to {_pointx}79@[_nar] {_pointy}96@[_nar] {_pointz}113@[_nar] type 1@ radius 6.0
while 8100: not actor $PLAYER_ACTOR near_point_in_vehicle {_pointx}79@[_kar] {_pointy}96@[_kar] {_pointz}113@[_kar] radius 12.0 12.0 12.0 sphere 0

// if
// $time <= 0
// then
// jump @Lap_Example_2497
// end

gosub @drift//

03F0: toggle_text_draw 1//
033F: set_text_draw_letter_size 0.7 0.933//
0340: set_text_draw_RGBA 255 255 255 255//
0348: toggle_text_draw_proportional 1//
0349: set_text_draw_font 2//
060D: draw_text_shadow 1 color_RGBA 0 0 0 255//
045A: draw_text_1number 130.0 415.0 GXT 'NUMBER' number DRIFTING_ANGLE//

08DA: remove_panel 16@//
08D4: 16@ = create_panel_with_title 'DRIFT' position 29.0 30.0 width 35.0 columns 2 interactive 0 background 1 alignment 1//
09DB: set_panel 16@ column 0 width 120//
08DB: set_panel 16@ column 0 header 'DUMMY' data 'DRIFTHI' 'DRIFYOU' 'DUMMY' 'DRIFBON' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'//
08DB: set_panel 16@ column 1 header 'DUMMY' data 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY' 'DUMMY'//
08EE: set_panel 16@ column 1 row 0 text_1number GXT 'NUMBER' number _hiscore//
08EE: set_panel 16@ column 1 row 1 text_1number GXT 'NUMBER' number _score//
08EE: set_panel 16@ column 1 row 3 text_1number GXT 'DRIFBNN' number BONUS//

if TEMP_SCORE > 0//
then//
033F: set_text_draw_letter_size 1.3 1.7//
0340: set_text_draw_RGBA 217 222 12 150//
0348: toggle_text_draw_proportional 1//
0349: set_text_draw_font 3//
060D: draw_text_shadow 0 color_RGBA 0 0 0 125//
0912: unknown_text_draw_flag 1 height 355 width 370//
0342: toggle_text_draw_centered 1//
045A: draw_text_1number 280.0 100.0 GXT 'NUMBER' number TEMP_SCORE//
end//


if and
_pos = 1 // integer values
not Actor.InCar($PLAYER_ACTOR, {_car[1]}18@)
then
jump @Lap_Example_2497
end
if or
Car.Wrecked({_car[1]}18@)
02BF: car {_car[1]}18@ sunk
then
jump @Lap_Example_2497
end
// wait 0 ms
end
Marker.Disable(_chekp)
06D6: delete_racing_checkpoint _rchekp
097A: at 0.0 0.0 0.0 play_sound 1058
end
jump @Lap_Example_2491

:Lap_Example_2491
gosub @Lap_Example_REMOVE
if
// $pos2 == 1
002c: _score >= _hiscore//
then
_DRIFT_MISSION_PASSED = 1//
0084: _hiscore = _score//
_score = 0//


00BA: text_styled 'RACES18' 3000 ms 1 // Winner!
wait 3000 ms
01E3: text_1number_styled 'M_PASS' 3000 4000 ms 1 // MISSION PASSED!~n~~w~$~1~
Player.Money($PLAYER_CHAR) += 3000
// 01BD: 12@ = current_time_in_ms
// 0085: 13@ = 12@ // integer values and handles
// 0062: 13@ -= 11@ // integer values
// 13@ /= 1000.0 // floating-point values
// 0085: 452@ = 13@ // integer values and handles
// 452@ /= 60 // integer values
// 0085: 36@ = 452@ // integer values and handles
// 36@ *= 60 // integer values
// 0085: 453@ = 13@ // integer values and handles
// 0062: 453@ -= 36@ // integer values
0394: play_music 1
// 02FD: text_2numbers_lowpriority 'TIME' 452@ 453@ 8000 ms 1 // ~1~:~1~
else
01E3: text_1number_styled 'RACES_8' 200 5000 ms 1 // Loser!
0A92: create_custom_thread "DriftStarter.cs" 
// 01BD: 12@ = current_time_in_ms
// 0085: 13@ = 12@ // integer values and handles
// 0062: 13@ -= 11@ // integer values
// 13@ /= 1000.0 // floating-point values
// 0085: 452@ = 13@ // integer values and handles
// 452@ /= 60 // integer values
// 0085: 36@ = 452@ // integer values and handles
// 36@ *= 60 // integer values
// 0085: 453@ = 13@ // integer values and handles
// 0062: 453@ -= 36@ // integer values
// 02FD: text_2numbers_lowpriority 'TIME' 452@ 453@ 8000 ms 1 // ~1~:~1~
end
0318: set_latest_mission_passed_to 'RACES_0'
Player.ClearWantedLevel($PLAYER_CHAR)
0A92: create_custom_thread "DriftStarter.cs" 
gosub @Lap_Example_38
return

:Lap_Example_2497
gosub @Lap_Example_REMOVE
00BA: text_styled 'RACES_8' 5000 ms 1 // Loser!
0A92: create_custom_thread "DriftStarter.cs" 
return

:Lap_Example_REMOVE
01EB: set_traffic_density_to 1.0
Car.DoorStatus({_car[1]}18@) = 0
for _par = 1 to 1
if
{_car}17@[_par] <> -1
then
Car.SetImmunities({_car}17@[_par], 0, 0, 0, 0, 0)
Model.Destroy({_model}39@[_par])
Car.RemoveReferences({_car}17@[_par])
if
_par <> 1
then
Marker.Disable({_mark}49@[_par])
Actor.RemoveReferences({_act}44@[_par])
end
end
end
06EB: release_car_component {_component1[1]}174@
06EB: release_car_component {_component2[1]}183@
06EB: release_car_component {_component3[1]}192@
06EB: release_car_component {_component4[1]}201@
06EB: release_car_component {_component5[1]}210@
06EB: release_car_component {_component6[1]}219@
06EB: release_car_component {_component7[1]}228@
Marker.Disable(_chekp)
06D6: delete_racing_checkpoint _rchekp
03F0: toggle_text_draw 0
014F: delete_timer _time
01B7: release_weather

00BE: text_clear_all//
_score += TEMP_SCORE//
08DA: remove_panel 16@//

return

:Lap_Example_2762
$ONMISSION = 0 // integer values
mission_cleanup
return


{Все последующие строки - мой код.
Их тоже необходимо вставлять в файл.}

:drift
//wait 0
11@ = TEMP_SCORE
gosub @drifted

if
TEMP_SCORE > 11@
then

12@ = 0
13@ = 0
else
if 12@ == 0
then
01BD: 12@ = current_time_in_ms
end
if
13@ <= 2000
then
01BD: 13@ = current_time_in_ms
13@ -= 12@
else
_score += TEMP_SCORE
TEMP_SCORE = 0
12@ = 0
13@ = 0
end
end

CAR_HEALTH = car.Health(PLAYER_CAR)
if
CAR_HEALTH < 14@
then
TEMP_SCORE = 0
12@ = 0
13@ = 0
14@ = CAR_HEALTH
//0A30: repair_car PLAYER_CAR //раскомментируйте эти строки, если необходимо установить на авто иммунитеты //
//14@ = car.Health(PLAYER_CAR) //
00BE: text_clear_all
wait 2000
end

return

:drifted
car.StorePos(PLAYER_CAR,1@,2@,3@)
wait 0
car.StorePos(PLAYER_CAR,3@,4@,5@)
3@ -= 1@
4@ -= 2@
02F8: get_car PLAYER_CAR Z_angle_cosine_to 5@
02F9: get_car PLAYER_CAR Z_angle_sine_to 6@
05A4: get_angle_between_vectors_origin_to 5@ 6@ and_origin_to 3@ 4@ store_to 5@

0087: DRIFTING_ANGLE = 5@
0092: DRIFTING_ANGLE = float DRIFTING_ANGLE to_integer

02E3: CAR_SPEED = car PLAYER_CAR speed
if and
CAR_SPEED >= SPEED_LIMIT
81F4: not car PLAYER_CAR flipped
8119: not car PLAYER_CAR wrecked
82BF: not car PLAYER_CAR sunk
81F3: not car PLAYER_CAR in_air
then
BONUS = 1
if CAR_SPEED >= 19.0
then
BONUS = 2
end
if CAR_SPEED >= 31.0
then
BONUS = 3
end
if CAR_SPEED >= 46.0
then
BONUS = 4
end
if CAR_SPEED >= 63.0
then
BONUS = 5
end

if and
TEMP_SCORE >=50
TEMP_SCORE <150
then
BONUS *= 2
end
if and
TEMP_SCORE >=150
TEMP_SCORE <500
then
BONUS *= 3
end
if and
TEMP_SCORE >=500
TEMP_SCORE <1000
then
BONUS *= 4
end
if TEMP_SCORE >=1000
then
BONUS *= 5
end

if and
5@ >= DRIFT_ANGLE
5@ <= 90.0
then inc(TEMP_SCORE,BONUS)
end
end

return

Стартер:

{$CLEO}

const
  _Lap_Example_XCoord = 0@
  _Lap_Example_YCoord = 1@
  _Lap_Example_ZCoord = 2@
  _Lap_Example_Marker = 3@
  _11192 = 4@
  _DRIFT_MISSION_PASSED = 5@
  _hiscore = 6@
end

:Lap_Example
_Lap_Example_XCoord = 2480.55
_Lap_Example_YCoord = -1666.06
_Lap_Example_ZCoord = 13.34
_Lap_Example_Marker = Marker.CreateIconAndSphere(53, _Lap_Example_XCoord, _Lap_Example_YCoord, _Lap_Example_ZCoord)

:Lap_Example_1349
wait 25 ms
Player.Defined($PLAYER_CHAR)
jf @Lap_Example_1349
0101: actor $PLAYER_ACTOR stopped_near_point _Lap_Example_XCoord _Lap_Example_YCoord _Lap_Example_ZCoord radius 3.0 3.0 3.0 sphere 0
jf @Lap_Example_1349
Player.Controllable($PLAYER_CHAR)
jf @Lap_Example_1349
$ONMISSION == 0 // integer values
jf @Lap_Example_1349
Marker.Disable(_11192)
054C: use_GXT_table 'RACETOR'
00BA: text_styled 'RACES_0' 1500 ms 2
0169: set_fade_color 0 0 0
fade 0 (in) 2500 ms

:Lap_Example_1492
wait 0 ms
not fading
jf @Lap_Example_1492
Marker.Disable(_11192)
00BE: text_clear_all
03E6: remove_text_box

if _DRIFT_MISSION_PASSED == 0//
then _hiscore = 150// Начальное кол-во очков, необходимых для победы //
end//

0A94: start_custom_mission "DriftMission"
0A93: end_custom_thread

А главное, всё работает! Миссия запускается, проходится. Правда, не сохраняется максимальные очки, но это решается вставкой пары строк (opcs [c]0AB3[/c] и [c]0AB4[/c]).

[---]

>>> Скачать программу <<<

#65 Re: Модификации » Езда по земле, горам, стенам, потолкам и др. » 19-11-2009 09:39

Это где?
P.S. С указанием автора мои скрипты выкладывать можно всегда.

#66 Re: Модификации » Езда по земле, горам, стенам, потолкам и др. » 31-10-2009 05:09

@Alien -

Можно проще. Чтобы на машину не действовала гравитация, надо отключить один флаг в ее структуре.

Спасибо smile. Да, это частично решает проблему со скатыванием вниз (вверх) при низком (большом) FPS. Если ещё добавить задержку, то зависимости от FPS почти не будет, но машина будет ехать дёрганно.

Версия без задержки:

thread 'sticky'

{$CLEO}

const
  ACC_VALNEG=-0.01107
end
var
  $PLAYER_ACTOR: Actor
  $PLAYER_CHAR: Player
  0@: Car
  1@: Float
  2@: Float
  3@: Float
  4@: Float
  5@: Float
  6@: Float
  13@: Integer
end

while true 
  //0A8D: 20@ = read_memory 0xB7CD9C size 4 virtual_protect 0
  //0513: show_text_box_1number 'NUMBER' number 20@  // ~1~
  if $PLAYER_CHAR.Defined
  then
    if and 
      $PLAYER_ACTOR.Driving
      0AB0: key_pressed 222 // Э
    then
      00C0: set_current_time_hours_to 12 minutes_to 0 
      03C0: 0@ = actor $PLAYER_ACTOR car
      32@=0
      08C6: set_actor $PLAYER_ACTOR stay_on_bike 1
      gosub @CarGravityOff      
      03E5: show_text_box 'CHEAT1'
      while true    
        if $PLAYER_CHAR.Defined
        jf @clear
        if 056E: car 0@ defined 
        jf @clear
        if $PLAYER_ACTOR.InCar(0@)
        jf @clear
        if and
          32@>200
          0AB0: key_pressed 222 // Э
        then
          Break
        end
        if 0AB0: key_pressed 186
        then
          var
            7@: Float
            8@: Float
            9@: Float
          end
          7@ = 0@.Angle
          7@+=90.0
          02F6: 8@ = cosine 7@ // (float)
          02F7: 9@ = sine 7@ // (float)
          8@*=0.5
          9@*=0.5
          07D5: set_car 0@ acceleration_in_direction_XYZ 0.0 0.0 0.2 rotation_accelerationXY 9@ 8@  0.0//unk 0.0 
          wait 200
          Continue
        end        
        if or 
          81F3: not car 0@ in_air
          02BF: car 0@ sunk 
        then
          33@=0
        end                 
        if 33@>350
        then
          wait 0
          if 13@==true
          then
            gosub @CarGravityOn
          end
          Continue
        end
        if 13@==false
        then
          gosub @CarGravityOff
        end         
        0@.StorePos(1@, 2@, 3@)
        0407: store_coords_to 4@ 5@ 6@ from_car 0@ with_offset 0.0 0.0 ACC_VALNEG
        4@-=1@
        5@-=2@
        6@-=3@
        //6@+=ACC_VAL
        07D5: set_car 0@ acceleration_in_direction_XYZ 4@ 5@ 6@ rotation_accelerationXY 0.0 0.0 unk 0.0 
        if and 
          6@>0.0045
          8185: not car 0@ health >= 350 
        then
          0@.Health = 350
        end
        wait 0
      end
      :clear
      gosub @CarGravityOn
      0@.RemoveReferences
      08C6: set_actor $PLAYER_ACTOR stay_on_bike 0
      03E5: show_text_box 'CHEAT8'
      wait 200
    end
  end
  wait 0 // <<< НЕ МЕНЯТЬ ПАРАМЕТР!!!
end

:CarGravityOff
  0A97: 10@ = car 0@ struct
  10@ += 0x40
  0A8D: 11@ = read_memory 10@ size 4 virtual_protect 0
  08C3: clear 11@ bit 1  
  0A8C: write_memory 10@ size 4 value 11@ virtual_protect 0
  13@=true
return

:CarGravityOn
  0A97: 10@ = car 0@ struct
  10@ += 0x40
  0A8D: 11@ = read_memory 10@ size 4 virtual_protect 0
  08BD: set 11@ bit 1
  0A8C: write_memory 10@ size 4 value 11@ virtual_protect 0
  13@=false
return

Версия с задержкой:

thread 'sticky'

{$CLEO}

const
  ACC_VALNEG=-0.0275
end
var
  $PLAYER_ACTOR: Actor
  $PLAYER_CHAR: Player
  0@: Car
  1@: Float
  2@: Float
  3@: Float
  4@: Float
  5@: Float
  6@: Float
  13@: Integer
end

while true 
  //0A8D: 20@ = read_memory 0xB7CD9C size 4 virtual_protect 0
  //0513: show_text_box_1number 'NUMBER' number 20@  // ~1~
  if $PLAYER_CHAR.Defined
  then
    if and 
      $PLAYER_ACTOR.Driving
      0AB0: key_pressed 222 // Э
    then
      00C0: set_current_time_hours_to 12 minutes_to 0 
      03C0: 0@ = actor $PLAYER_ACTOR car
      32@=0
      08C6: set_actor $PLAYER_ACTOR stay_on_bike 1
      gosub @CarGravityOff      
      03E5: show_text_box 'CHEAT1'
      while true    
        if $PLAYER_CHAR.Defined
        jf @clear
        if 056E: car 0@ defined 
        jf @clear
        if $PLAYER_ACTOR.InCar(0@)
        jf @clear
        if and
          32@>200
          0AB0: key_pressed 222 // Э
        then
          Break
        end
        if 0AB0: key_pressed 186
        then
          var
            7@: Float
            8@: Float
            9@: Float
          end
          7@ = 0@.Angle
          7@+=90.0
          02F6: 8@ = cosine 7@ // (float)
          02F7: 9@ = sine 7@ // (float)
          8@*=0.5
          9@*=0.5
          07D5: set_car 0@ acceleration_in_direction_XYZ 0.0 0.0 0.2 rotation_accelerationXY 9@ 8@  0.0//unk 0.0 
          wait 200
          Continue
        end        
        if or 
          81F3: not car 0@ in_air
          02BF: car 0@ sunk 
        then
          33@=0
        end                 
        if 33@>350
        then
          wait 0
          if 13@==true
          then
            gosub @CarGravityOn
          end
          Continue
        end
        if 13@==false
        then
          gosub @CarGravityOff
        end         
        0@.StorePos(1@, 2@, 3@)
        0407: store_coords_to 4@ 5@ 6@ from_car 0@ with_offset 0.0 0.0 ACC_VALNEG
        4@-=1@
        5@-=2@
        6@-=3@
        07D5: set_car 0@ acceleration_in_direction_XYZ 4@ 5@ 6@ rotation_accelerationXY 0.0 0.0 unk 0.0 
        if and 
          6@>0.0045
          8185: not car 0@ health >= 350 
        then
          0@.Health = 350
        end
        wait 50 // <<< НЕ МЕНЯТЬ ПАРАМЕТР!!!
      end
      :clear
      gosub @CarGravityOn
      0@.RemoveReferences
      08C6: set_actor $PLAYER_ACTOR stay_on_bike 0
      03E5: show_text_box 'CHEAT8'
      wait 200
    end
  end
  wait 0 
end

:CarGravityOff
  0A97: 10@ = car 0@ struct
  10@ += 0x40
  0A8D: 11@ = read_memory 10@ size 4 virtual_protect 0
  08C3: clear 11@ bit 1  
  0A8C: write_memory 10@ size 4 value 11@ virtual_protect 0
  13@=true
return

:CarGravityOn
  0A97: 10@ = car 0@ struct
  10@ += 0x40
  0A8D: 11@ = read_memory 10@ size 4 virtual_protect 0
  08BD: set 11@ bit 1
  0A8C: write_memory 10@ size 4 value 11@ virtual_protect 0
  13@=false
return

#67 Re: Модификации » Мины-лягушки (из Half-Life 2) » 23-10-2009 05:43

А авто-туррели комбайнов можешь сконвертнуть? Только нужно разбить на несколько частей, что-бы можно было вертеть пушкой отдельно от ножек.

#68 Модификации » Езда по земле, горам, стенам, потолкам и др. » 23-10-2009 05:38

VcSaJen
Replies: 8

Тема: Езда по земле, горам, стенам, потолкам и др.
Мод, который позволяет ехать на любой поверхности - по отвесным стенам и даже по потолку. Включить/Выключить - буква Э, прыжок на стену - буква Ж. Как это работает? Как вы знаете из уроков физики, нет никакой разницы между ускорением и гравитацией. Т. е. если в невесомости комнате придать ускорение 9,8 м/с[sup]2[/sup], то нам будет казаться, что на нас действует гравитация.
Опкод

07D5: set_car 0@ acceleration_in_direction_XYZ 0.0 0.0 0.2 rotation_accelerationXY 9@ 8@ 0.0

придаёт машине ускорение по осям XYZ (первые три параметра) и момент силы по осям XYZ (последние параметры). и т.д.
К сожалению, этот опкод очень сильно зависит от FPS, так что нужно настроить константы ACC_VAL и ACC_VALNEG под себя (они должны быть равны по модулю), что бы машина не укатывалась вверх или вниз, а стояла на стене.

thread 'sticky'

{$CLEO}

const
  ACC_VAL=0.01107
  ACC_VALNEG=-0.01107
end
var
  $PLAYER_ACTOR: Actor
  $PLAYER_CHAR: Player
  0@: Car
  1@: Float
  2@: Float
  3@: Float
  4@: Float
  5@: Float
  6@: Float
end

while true 
  //0A8D: 20@ = read_memory 0xB7CD9C size 4 virtual_protect 0
  //0513: show_text_box_1number 'NUMBER' number 20@  // ~1~
  if $PLAYER_CHAR.Defined
  then
    if and 
      $PLAYER_ACTOR.Driving
      0AB0: key_pressed 222 // Э
    then
      00C0: set_current_time_hours_to 12 minutes_to 0 
      03C0: 0@ = actor $PLAYER_ACTOR car
      32@=0
      08C6: set_actor $PLAYER_ACTOR stay_on_bike 1
      03E5: show_text_box 'CHEAT1'
      //0A8C: write_memory 0x863984 size 4 value 0.00001 virtual_protect 1
      while true    
        if $PLAYER_CHAR.Defined
        jf @clear
        if 056E: car 0@ defined 
        jf @clear
        if $PLAYER_ACTOR.InCar(0@)
        jf @clear
        if and
          32@>200
          0AB0: key_pressed 222 // Э
        then
          Break
        end
        if 0AB0: key_pressed 186
        then
          var
            7@: Float
            8@: Float
            9@: Float
          end
          7@ = 0@.Angle
          7@+=90.0
          02F6: 8@ = cosine 7@ // (float)
          02F7: 9@ = sine 7@ // (float)
          8@*=0.5
          9@*=0.5
          07D5: set_car 0@ acceleration_in_direction_XYZ 0.0 0.0 0.2 rotation_accelerationXY 9@ 8@  0.0//unk 0.0 
          //wait 500
          //07D5: set_car 0@ acceleration_in_direction_XYZ 0.0 0.0 0.01 rotation_accelerationXY 0.5 0.0 unk 0.0 
          wait 200
          Continue
        end        
        if or 
          81F3: not car 0@ in_air
          02BF: car 0@ sunk 
        then
          33@=0
        end                 
        if 33@>350
        then
          wait 0
          Continue
        end 
        0@.StorePos(1@, 2@, 3@)
        0407: store_coords_to 4@ 5@ 6@ from_car 0@ with_offset 0.0 0.0 ACC_VALNEG
        4@-=1@
        5@-=2@
        6@-=3@
        6@+=ACC_VAL
        07D5: set_car 0@ acceleration_in_direction_XYZ 4@ 5@ 6@ rotation_accelerationXY 0.0 0.0 unk 0.0 
        if and 
          6@>0.0045
          8185: not car 0@ health >= 350 
        then
          0@.Health = 350
        end
//        07D5: set_car 0@ velocity_in_direction_XYZ 0.0 0.0 0.01109 rotation_velocitiesXY 0.0 0.0 unk 0.0 
        wait 0
      end
      :clear
      0@.RemoveReferences
      08C6: set_actor $PLAYER_ACTOR stay_on_bike 0
      03E5: show_text_box 'CHEAT8'
      wait 200
      //0A8C: write_memory 0x863984 size 4 value 0.008 virtual_protect 1
    end
  end
  wait 0
end

#69 Re: Справочная информация » Ресурсы и структуры GTA IV » 15-10-2009 04:42

@3Doomer -

думаю, он делает удобный компилятор...

Я? grincrazy:crazy: Ты меня с кем-то перепутал.
@listener -

А в чем глубинный смысл вопроса?

Глубинного смысла нет. Я просто хотел узать, какие функции не работают (Ну для поиковика сделать так, что-бы не искать неработающие функции).

Что касается unsupported - это делается диффом между списком всех вызываемых из скриптов функций и полным списком.

То есть все функции, которые не вызываются из оригинальных скриптов, нерабочие? Или я неправильно понял?

#70 Re: Справочная информация » Ресурсы и структуры GTA IV » 09-10-2009 06:37

А native-Функции все работают? Наверняка среди них есть NOP и unsupported функции. Есть список всех таких функций?

#71 Программы для GTA » Native Search Tool » 08-10-2009 02:27

VcSaJen
Replies: 0

Native Search Tool - это поисковик скриптовых функций для GTA IV, наподобие Opcode Search Tool (OST). OST уже устарел (он разрабатывался для ViceCity) и не может нормально искать функции для GTA IV.

Скачать

Возможности:
    * Поиск функций по файлам Natives.txt (полный список функций GTA IV) и NativesPlus.txt (описание функций);
    * Возможность уточнить поиск с помощью различных операторов и использовать скобки (как в продвинутых интернет-поисковиках);
    * Поиск ведётся только по названиям функций, а не по всей строке;
    * Возможность поиска по названиям параметров функции и по типам параметров;
    * Почти полная совместимость с Opcode Search Tool по возможностям, сочетаниям клавиш и виду интерфейса;
    * Более дружелюбный интерфейс: все настройки можно изменить через программу.

Программа так похожа на Opcode Serch Tool, что большинство юзеров даже не заметят подмены smile

Можно составлять сложные запросы, например: (Actor | Char) & (Car | Vehicle) или ((Max & Health) | (Min & Armor)) & Char & -Player

Также можно искать текст параметров (!слово) и типов (#слово) функций, например: Char !x !y !z #f32 #f32 #f32  - искать слово Char в названии функции, xyz в параметрах функции и три дробных параметра (будет найдено например:
procedure ClearAreaOfChars(x : f32; y : f32; z : f32; radius : f32);
procedure GetCharVelocity(pedestrian : Ped; pX : Pf32; pY : Pf32; pZ : Pf32);
и т.д.)

Все ошибки и пожелания пишите здесь. Надеюсь, программа будет востребована. Хорошо бы выложить для этого её на SannyBuilder.com как и выложили fxt editor.

Я ещё собираюсь добавить возможность каталогизирования функций в виде дерева, как OpcodesTreeView, надо ли это?

#72 Re: Вопросы по скриптингу » Один вопрос » 29-09-2009 01:49

0AA5: call 0x438370 num_params 1 pop 1 $NomerKoda

0) Комплект оружия 1, для головореза
1) Комплект оружия 2
2) Комплект оружия 3, для психа
3) Здоровье, броня, 250000 долларов
4) Увеличить уровень разыскиваемости на две звезды
5) Очистить уровень разыскиваемости
6) Сoлнeчнaя пoгoдa
7) Очeнь coлнeчнaя пoгoдa
cool Облaчнaя пoгoдa
9) Дoждливaя пoгoдa
10) Туманная погода
11) Уcкopить часы {SWITCH!!!}
12) Уcкopeннaя игpa
13) Зaмeдлeннaя игpa
14) Пешеходы атакуют друг друга, получают клюшки для гольфа {SWITCH!!!}
15) Все пешеходы толпой нападают(убегают), все машины уезжают {SWITCH!!!}
16) У вcex ecть opyжиe {SWITCH!!!}
17) Получить танк Rhino
18) Получить гоночную машину Bloodring Banger
19) Получить Rancher
20) Получить гоночную машину Hotring Racer A
21) Получить гоночную машину Hotring Racer B
22) Получить гробовозку Romero
23) Получить лимузин Stretch
24) Получить мусоровоз Trashmaster
25) Получить гольф-машину Caddy
26) Взорвать все машины
27) Невидимая машина {SWITCH!!!}
28) Улучшенное управление  {SWITCH!!!}
29) Убить СиДжея
30) Все сфетофоры зелёные {SWITCH!!!}
31) Агрессивные водители {SWITCH!!!}
32) Розовый трафик {SWITCH!!!}
33) Чёрный трафик {SWITCH!!!}
34) Все машины плавают {SWITCH!!!} //!!!!!!!!
35) Лодки могут летать  {SWITCH!!!}
36) Толстый CJ
37) CJ кaчёк
38) Худой CJ
39) Везде Элвисы {SWITCH!!!}
40) Пешеходы атакуют вас с оружием {SWITCH!!!}
41) Пляжная вечеринка {SWITCH!!!}
42) Члены банд везде {SWITCH!!!}
43) Члены банд контролируют улицы {SWITCH!!!}
44) Тема ниндзя {SWITCH!!!}
45) Магнит для потаскушек {SWITCH!!!}
46) Трафик из дешёвых авто {SWITCH!!!}
47) Трафик из гоночных авто {SWITCH!!!}
48) Все машины летают {SWITCH!!!}
49) На велосипеде можно высоко прыгать {SWITCH!!!}
50) Получить военный самолёт с вертикальным взлётом Hydra
51) Получить катер с воздушной подушкой Vortex Hovercraft
52) При прикосновении вашей машины другие взрываются {SWITCH!!!}
53) Все машины с нитро {SWITCH!!!}
54) Машины в невесомости если прикоснуться к ним {SWITCH!!!}
55) Всегда полночь {SWITCH!!!}
56) Всегда закат {SWITCH!!!}
57) Гроза
58) Песчаная буря
59) нет? {CH}
60) Большие прыжки {SWITCH!!!}   
61) Пуленепробиваемость {SWITCH!!!}
62) Бесконечный кислород {SWITCH!!!}
63) Получить парашют
64) Получить реактивный ранец
65) Ноль звезд всегда {SWITCH!!!}
66) Шесть звёзд
67) Мега удар {SWITCH!!!}
68) Никогда не голоден {SWITCH!!!}
69) Режим бунта (как в последней миссии) {SWITCH!!!}
70) Тeмa - дypдoм {SWITCH!!!}
71) Рeжим - aдpeнaлин {SWITCH!!!}
72) Бесконечные патроны, без перезарядки {SWITCH!!!}
73) Drive-by режим в машине {SWITCH!!!}
74) Уменьшает трафик {SWITCH!!!}
75) Трафик из сельского транспорта {SWITCH!!!}
76) Вербовать любого человека, с пистолетом {SWITCH!!!}
77) Сельская тема {SWITCH!!!}
78) Вербовать любого человека, с ракетницей {SWITCH!!!}
79) Максимальное уважение {SWITCH!!!}
80) Максимальная сексуальность {SWITCH!!!}
81) Максимальная выносливость
82) Hitman in All Weapons
83) Вождение велосипеда - максимум
84) Получить Hunter
85) Получить Quad
86) Получить Tanker Truck
87) Получить Dozer
88) Получить Stunt Plane
89) Получить Monster
90) нет?
91) нет?

#73 Re: Sanny Builder и CLEO » Вопросы и предложения по Sanny Builder » 02-07-2009 06:59

Уф... Наконец-то смог ответить.
Например: после сочетания символов {;} или {//} или "wait 0 {Запись; Запись}"

#74 Re: Программы для GTA » [SA] Quick Opcode » 02-07-2009 05:11

@Seemann -
SCMLog конфликтует с QuickOpcode, когда SCMLog установлен, то:
1) Глючит QuickOpcode: не работает нормально функция FUNC_READ_VALUE, работает только один раз, на второй раз игра зависает.
2) Написал функцию:

procedure _OpGetNumberParams(Null1,Null2,Null3: DWord;Count:DWord);
asm
  PUSH EBX
  PUSH ECX
  MOV ECX, [0249184Ch] //02371040h
  PUSH Count
  MOV EBX, 00464080h
  CALL EBX
  POP ECX
  POP EBX
end;

procedure OpGetNumberParams(Count: Word);
begin
  _OpGetNumberParams(0,0,0,DWord(Count));
end;
type
  TOpcodeParams= array [0..31] of Cardinal;
  POpcodeParams= ^TOpcodeParams;

var
  OpcodeParams: POpcodeParams;

...

OpcodeParams:=Ptr($A43C78);
procedure OPCODE_ACTIVATE_CHEAT;
begin // 0B41: activate_cheat %1h%
  OpGetNumberParams(1);
  N:=OpcodeParams^[0];
  ActivateCheat(N);
end;

Этот код работает только когда SCMLog не установлен. Если он установлен, то SCMLog зависает вместе с игрой.


@Alexander Blade - Я детально протестировал твой QuickOpcode v.1.0, и нашёл следующие ошибки:

1) наверху ^
2) Чтение стрингового параметра (FUNC_READ_OPCODE_STRING) сначала работает, но потом игра зависает, если выполнить опкод со стринговым параметром 274 раза.
Наверное, что-то не освобождается этой функцией.

3) Из-за этих ошибок не стабильно работает плагин ScmIni, а также в его исходниках есть ошибка, из-за которой невозможно запустить QOP через папку CLEO:

  
  var AncestorLibrary : Integer;
  
  ...

  AncestorLibrary := GetModuleHandle(QuickOpcodeLib + '.asi');

  if AncestorLibrary = INVALID_HANDLE_VALUE then
  begin
    AncestorLibrary := GetModuleHandle(QuickOpcodeLib + '.cleo');
    if AncestorLibrary = INVALID_HANDLE_VALUE then
    begin
      MessageBox(0, 'Can''t initialize QuickOpcode library .' + #13 +
                    'Press "OK" to exit .', 'Error !', 0);
      ExitProcess(0)
    end;
  end;

При ошибке загрузки функция GetModuleHandle возвращает NULL, а не INVALID_HANDLE_VALUE:

MSDN wrote:

Return Values

If the function succeeds, the return value is a handle to the specified module.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Так что можно исправить на это:

  
  var AncestorLibrary : Cardinal;
  
  ...

  AncestorLibrary := GetModuleHandle(QuickOpcodeLib + '.asi');

  if AncestorLibrary = 0 then
  begin
    AncestorLibrary := GetModuleHandle(QuickOpcodeLib + '.cleo');
    if AncestorLibrary = 0 then
    begin
      MessageBox(0, 'Can''t initialize QuickOpcode library .' + #13 +
                    'Press "OK" to exit .', 'Error !', 0);
      ExitProcess(0)
    end;
  end;

4) А также опечатки файлах ReadMe(rus).txt:
стр 4 стлб 66 - "парметрами" вместо "параметрами"
стр 5 стлб 54 - "оптыному" вместо "опытному"
стр 27 стлб 42 - "родителской" вместо "родительской"
стр 27 стлб 71 - "библотеки" вместо "библиотеки"
стр 37 стлб 6 - "преведено" вместо "приведено"
стр 53 стлб 36 - "глоабльную" вместо "глобальную"
стр 54 стлб 9 - "соттвественно" вместо "соответственно"

QuickOpcode_plugins\ScmIni\ReadMe(rus).txt:
стр 41 стлб 45 - "перменная" вместо "переменная"
стр 48 стлб 67 - "перменную" вместо "переменную"

[hr]
[---]
Вот написал несколько опкодов:
Проверка написания нашего чита:
0B50:  typed_cheat "MYSUPERCHEAT"

Активация чита:
0B51: activate_cheat 3

Открытие и закрытие тестового файла:
0B53: open_text_file "CLEO\log.txt" mode 3 store_to 0@
0B54: close_text_file 0@
При открытии файла можно указать как строку-константу, так и нуль-строку.

Написав это:

0B55: write_file 5@ new_line 1 int_and_str_values "Новая запись"
0B55: write_file 5@ new_line 1 int_and_str_values "Первый параметр: " 111 "Второй: " 222 "3-ий: " 333 "4-ый: " 444 "5-ый: " 555 'Последний: ' 969696969
0B55: write_file 5@ new_line 1 int_and_str_values 1 2 3 4 5 6 "Строки могут " "идти подрят. " 'Семи' ' и пятнадцати' " символьные строки тоже поддерживаются"
0B56: write_file 5@ new_line 1 float_and_str_values "Это числа: " 1.1 2.22 3.333 4.4444 "Длинное число: " 5555555.55
0B55: write_file 5@ new_line 1 int_and_str_values

На выходе получим

Новая запись
Первый параметр: 111 Второй: 222 3-ий: 333 4-ый: 444 5-ый: 555 Последний: 969696969 
1 2 3 4 5 6 Строки могут идти подряд. Семи и пятнадцати символьные строки тоже поддерживаются
Это числа: 1.1000 2.2200 3.3330 4.4444 Длинное число: 5555555.3157

Эти опкоды имеют переменное кол-во параметров. Например в опкоде 0B55 целые числа и строки могут располагаться как угодно в одном опкоде, опкод поймёт, надо писать строку или число.

И другие опкоды:
0B58:   text_file 0@ eoln
0B59:   text_file 0@ eof
0B60:   file "CLEO\log.txt" exist
0B61:   dir "CLEO\MyDir" exist
0B62: make_dir "CLEO\MyDir"

Ссылка на QIP плагин:
http://www.grand-theft-all.narod.ru/StrLib.rar

#75 Re: Sanny Builder и CLEO » Вопросы и предложения по Sanny Builder » 14-05-2009 00:23

Может уже поздно, но всё-таки информирую:
1) В строках типа 'test{skopka}test' или "test{skopka}test" превращается после компиляции в "testtest"
2) Если в комментариях есть некоторый сивол (кажется, двоеточие или как-то так), то SB молча обрывает компиляцию.

Board footer

Powered by FluxBB