Quantcast

Jump to content

» «
Photo

How to use Aru's C++ ScriptHook SDK

2 replies to this topic
Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009

#1

Posted 24 August 2013 - 09:40 AM Edited by Skorpro, 13 September 2013 - 02:37 AM.

Hi modders,

after some requests I decided to post here my small instruction how to use Aru's C++ ScriptHook SDK. I wrote this "HOW TO" some time ago for friends smile.gif

Let's go! Simply follow the instructions biggrin.gif

  • First install Visual C++ 2010 Express and Aru's C++ Script Hook SDK 0.4.0!
  • Then run ScriptHook.sln (C++ ScriptHook SDK)... alter loading double click on SampleCustomFiber (left menu) >> Source Files >> CustomFiberThread.cpp
  • Edit the script like YOU want smile.gif(You can find examples in SDK!)
  • Right click on SampleCustomFiber (left menu) and choose "Set as StartUp Project"!
  • At the top of the window you can see a green PLAYbutton! Besides ("DEBUG") choose "RELEASE" and press PLAY!
  • You get a message like an error >> ignore this and press OK.
  • Go to ScriptHook SDK main folder and you will see a folder called Release. There you can find this file: SampleCustomFiber.dll
    Rename it to "myTestMod.asi" (NOT myTestMod.asi.dll !!!!) and copy it to your GTA game dir (root dir)!
  • Congratulations! Your first mod is ready now!
  • Start the game to test it... Have fun smile.gif

Here is a list with about 250 natives that I have edited! You must edit your "ScriptingNatives.h" too, so download both HERE!

 
// ##########################################
// ######## Natives edited by Skorpro #######
// ##########################################

// Vehicle, Car...
TurnOffVehicleExtra(Vehicle vehicle, int extraID, b8 extraOnOff)  ==>>  TURN_OFF_VEHICLE_EXTRA
SetCanBurstCarTyres(Vehicle vehicle, b8 value)  ==>>  SET_CAN_BURST_CAR_TYRES
SetCarCollision(Vehicle vehicle, b8 collOnOff)  ==>>  SET_CAR_COLLISION
AttachCarToCar(Vehicle newVeh, Vehicle myCurrentVeh, int zero, f32 x, f32 y, f32 z, f32 rotax, f32 rotay, f32 rotaz)  ==>>  ATTACH_CAR_TO_CAR
TaskCarDriveToCoord(Ped ped, Vehicle car, float x, float y, float z, float speed, unsigned int p1f_2b, unsigned int p2, unsigned int p3, unsigned int px2, unsigned int p45000)  ==>>  TASK_CAR_DRIVE_TO_COORD
SetVehHasStrongAxles(Vehicle vehicle, b8 axlesOnOff)  ==>>  SET_VEH_HAS_STRONG_AXLES
SetCarEngineOn(Vehicle vehicle, int var0, int var1)  ==>>  SET_CAR_ENGINE_ON
SetCarAsMissionCar(Vehicle vehicle)  ==>>  SET_CAR_AS_MISSION_CAR
SetCarCoordinatesNoOffset(Vehicle vehicle, f32 x, f32 y, f32 z)  ==>>  SET_CHAR_COORDINATES_NO_OFFSET
AddStuckCarCheckWithWarp(Vehicle vehicle, f32 stuckdif, int time, bool flag1, bool flag2, bool flag3, bool flag4)  ==>>  ADD_STUCK_CAR_CHECK_WITH_WARP
IsVehStuck(Vehicle vehicle, int time, bool flag1, bool flag2, bool flag3)  ==>>  IS_VEH_STUCK
SetCarLivery(Vehicle vehicle, int liveryID)  ==>>  SET_CAR_LIVERY
TakeCarOutOfParkedCarsBudget(Vehicle vehicle, b8 onOff)  ==>>  TAKE_CAR_OUT_OF_PARKED_CARS_BUDGET
SuppressCarModel(eModel model)  ==>>  SUPPRESS_CAR_MODEL
SetVehIndicatorlights(Vehicle vehicle, b8 set)  ==>>  SET_VEH_INDICATORLIGHTS
SetPetrolTankWeakpoint(Vehicle vehicle, b8 set)  ==>>  SET_PETROL_TANK_WEAKPOINT
AttachObjectToCarPhysically(Object obj, Vehicle v, u32 carParts, u32 carParts2, f32 pX, f32 pY, f32 pZ, f32 unkX, f32 unkY, f32 unkZ, f32 rX, f32 rY, f32 rZ, f32 unkHealth, b8 unkTrue)  ==>>  ATTACH_OBJECT_TO_CAR_PHYSICALLY
TriggerPtfxOnVeh(const ch *fxName, Vehicle veh, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, f32 radius)  ==>>  TRIGGER_PTFX_ON_VEH
GetVehicleComponentInfo(Vehicle veh, int component_id_41, Vector3 *pPosition1, Vector3 *pPosition2, int *pMinus1, bool flag)  ==>>  GET_VEHICLE_COMPONENT_INFO
GetCarForwardVector(Vehicle veh, Vector3 *pVeh)  ==>>  GET_CAR_FORWARD_VECTOR
GetVehicleQuaternion(Vehicle vehicle, f32 *px, f32 *py, f32 *pz, f32 *pa)  ==>>  GET_VEHICLE_QUATERNION
ShiftLeft(int val)  ==>>  SHIFT_LEFT
ShiftRight(int val)  ==>>  SHIFT_RIGHT
SetCarLaneShift(Vehicle vehicle, f32 shift)  ==>>  SET_CAR_LANE_SHIFT
AttachCarToObject(Vehicle car, Object obj, u32 unknown0_0, f32 pX, f32 pY, f32 pZ, f32 rX, f32 rY, f32 rZ)  ==>>  ATTACH_CAR_TO_OBJECT
GetCarLivery(Vehicle vehicle, int *liveryID)  ==>>  GET_CAR_LIVERY
LocateCar3D(Vehicle veh, f32 x, f32 y, f32 z, f32 radx, f32 rady, f32 radz, b8 flag)  ==>>  LOCATE_CAR_3D
LocateCharInCar3D(Ped ped, f32 x, f32 y, f32 z, f32 radx, f32 rady, f32 radz, b8 flag)  ==>>  LOCATE_CHAR_IN_CAR_3D
IsCarStuck(Vehicle vehicle)  ==>>  IS_CAR_STUCK
CreateCarGenerator(f32 x, f32 y, f32 z, f32 angle, f32 unk0, f32 unk1, eModel model, int unk2, int unk3, int unk4, int unk5, int unk6, int alarm, int doorlock,int *carGen)  ==>>  CREATE_CAR_GENERATOR
DeleteCarGenerator(int carGen)  ==>>  DELETE_CAR_GENERATOR
SwitchCarGenerator(int carGen, int type_0_101_1000)  ==>>  SWITCH_CAR_GENERATOR
DisableCarGenerators(b8 flag0, b8 flag1)  ==>>  DISABLE_CAR_GENERATORS
SetHasBeenOwnedForCarGenerator(int carGen, b8 set)  ==>>  SET_HAS_BEEN_OWNED_FOR_CAR_GENERATOR
SetAllCarGeneratorsBackToActive()  ==>>  SET_ALL_CAR_GENERATORS_BACK_TO_ACTIVE
DisableCarGeneratorsWithHeli(bool trueFalse)  ==>>  DISABLE_CAR_GENERATORS_WITH_HELI
SetCarGeneratorsActiveInArea(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, bool set)  ==>>  SET_CAR_GENERATORS_ACTIVE_IN_AREA
GetVehiclePlayerWouldEnter(Player playerIndex, Vehicle *veh)  ==>>  GET_VEHICLE_PLAYER_WOULD_ENTER

// Player, Peds (Char)...
SetCharCollision(Ped ped, b8 collOnOff)  ==>>  SET_CHAR_COLLISION
SetCharCoordinatesNoOffset(Ped ped, f32 x, f32 y, f32 z)  ==>>  SET_CHAR_COORDINATES_NO_OFFSET
SetUseLegIK(Player playerIndex, bool trueFalse)  ==>>  SET_USE_LEG_IK
TaskShuffleToNextCarSeat(Ped ped, Vehicle vehicle)  ==>>  TASK_SHUFFLE_TO_NEXT_CAR_SEAT
SetCharWillLeaveCarInCombat(Ped ped, bool trueFalse)  ==>>  SET_CHAR_WILL_LEAVE_CAR_IN_COMBAT
AllowTargetWhenInjured(Ped ped, bool trueFalse)  ==>>  ALLOW_TARGET_WHEN_INJURED
SetCharMeleeActionFlag0(Ped ped, bool trueFalse)  ==>>  SET_CHAR_MELEE_ACTION_FLAG0
SetCharMeleeActionFlag1(Ped ped, bool trueFalse)  ==>>  SET_CHAR_MELEE_ACTION_FLAG1
SetCharMeleeActionFlag2(Ped ped, bool trueFalse)  ==>>  SET_CHAR_MELEE_ACTION_FLAG2
SetCharStayInCarWhenJacked(Ped ped, bool trueFalse)  ==>>  SET_CHAR_STAY_IN_CAR_WHEN_JACKED
ResetVisiblePedDamage(Ped ped)  ==>>  RESET_VISIBLE_PED_DAMAGE
SetPlayerKeepsWeaponsWhenRespawned(Player playerIndex)  ==>>  SET_PLAYER_KEEPS_WEAPONS_WHEN_RESPAWNED
SuppressPedModel(eModel model)  ==>>  SUPPRESS_PED_MODEL
RegisterTarget(Ped ped, Ped targetped)  ==>>  REGISTER_TARGET
TaskShootAtChar(Ped shooter, Ped victim, int time, int shootmode)  ==>>  TASK_SHOOT_AT_CHAR
LocateCharAnyMeansChar3D(Ped anyPed, Ped playerPed, f32 x, f32 y, f32 z, b8 flag)  ==>>  LOCATE_CHAR_ANY_MEANS_CHAR_3D
BlockCharAmbientAnims(Ped ped, bool onOff)  ==>>  BLOCK_CHAR_AMBIENT_ANIMS
SetCharAngledDefensiveArea(Ped ped, f32 ax, f32 ay, f32 az, f32 bx, f32 by, f32 bz, f32 angle)  ==>>  SET_CHAR_ANGLED_DEFENSIVE_AREA
AttachPedToObject(Ped ped, Object obj, ePedBone bone, f32 X, f32 Y, f32 Z, f32 A, f32 unk0, b8 unk1, b8 unk2)  ==>>  ATTACH_PED_TO_OBJECT
LocateCharOnFoot3D(Ped ped, f32 x, f32 y, f32 z, f32 radx, f32 rady, f32 radz, b8 flag)  ==>>  LOCATE_CHAR_ON_FOOT_3D
SetDrawPlayerComponent(ePedComponent component, b8 set)  ==>>  SET_DRAW_PLAYER_COMPONENT
TaskClimbLadder(Ped ped, bool trueFalse)  ==>>  TASK_CLIMB_LADDER

// Objects & Doors
SetObjectAlpha(Object obj, int alpha)  ==>>  SET_OBJECT_ALPHA
SetObjectHealth(Object obj, f32 health)  ==>>  SET_OBJECT_HEALTH
SetObjectRotation(Object obj, f32 rotax, f32 rotay, f32 rotaz)  ==>>  SET_OBJECT_ROTATION
SetObjectOnlyDamagedByPlayer(Object obj, b8 damOnOff)  ==>>  SET_OBJECT_ONLY_DAMAGED_BY_PLAYER
SlideObject(Object obj, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, int one)  ==>>  SLIDE_OBJECT
StartPtfxOnObj(const ch *fxName, Object obj, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, f32 radius)  ==>>  START_PTFX_ON_OBJ
TriggerPtfxOnObj(const ch *fxName, Object obj, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, f32 radius)  ==>>  TRIGGER_PTFX_ON_OBJ
SetObjectProofs(Object object, b8 bulletProof, b8 fireProof, b8 explosionProof, b8 collisionProof, b8 meleeProof)  ==>>  SET_OBJECT_PROOFS
RotateObject(Object obj, float angle, float rotSpeed, int nullEins)  ==>>  ROTATE_OBJECT
GetClosestStealableObject(f32 x, f32 y, f32 z, f32 radius, Object *obj)  ==>>  GET_CLOSEST_STEALABLE_OBJECT
SetObjectScale(Object obj, f32 scale)  ==>>  SET_OBJECT_SCALE
GetStateOfClosestDoorOfType(u32 model, f32 x, f32 y, f32 z, b8 *lock, f32 *doorswing)  ==>>  GET_STATE_OF_CLOSEST_DOOR_OF_TYPE
SetStateOfClosestDoorOfType(u32 model, f32 x, f32 y, f32 z, b8 lock, f32 doorswing)  ==>>  SET_STATE_OF_CLOSEST_DOOR_OF_TYPE
FindNearestCollectableBinBags(f32 x, f32 y, f32 z)  ==>>  FIND_NEAREST_COLLECTABLE_BIN_BAGS
FindNearestEntitiesWithSpecialAttribute(f32 x, f32 y, f32 z)  ==>>  FIND_NEAREST_ENTITIES_WITH_SPECIAL_ATTRIBUTE
LookAtNearbyEntityWithSpecialAttribute(i32 unkZero, Vector3 *pCoord, f32 *unkFloat, i32 *unkFlag, u32 *pModelHash, f32 *pRotation)  ==>>  LOOK_AT_NEARBY_ENTITY_WITH_SPECIAL_ATTRIBUTE
GrabNearbyObjectWithSpecialAttribute(i32 unkZero, Object *pObj)  ==>>  GRAB_NEARBY_OBJECT_WITH_SPECIAL_ATTRIBUTE
SetObjectQuaternion(Object obj, f32 x, f32 y, f32 z, f32 a)  ==>>  SET_OBJECT_QUATERNION
HasCollisionForModelLoaded(eModel model)  ==>>  HAS_COLLISION_FOR_MODEL_LOADED
RequestCollisionForModel(eModel model)  ==>>  REQUEST_COLLISION_FOR_MODEL
SetLoadCollisionForObjectFlag(Object obj, b8 set)  ==>>  SET_LOAD_COLLISION_FOR_OBJECT_FLAG
SetVisibilityOfClosestObjectOfType(f32 x, f32 y, f32 z, f32 radius, eModel typeOfModel, b8 set)  ==>>  SET_VISIBILITY_OF_CLOSEST_OBJECT_OF_TYPE
EnableDisabledAttractorsOnObject(Object obj, b8 enable)  ==>>  ENABLE_DISABLED_ATTRACTORS_ON_OBJECT

// Effects (Light, PTFX)...
DrawLightWithRange(f32 x, f32 y, f32 z, int r, int g, int b, f32 radius, f32 intensity)  ==>>  DRAW_LIGHT_WITH_RANGE
TriggerPtfxOnPedBone(const ch *fxName, Ped ped, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, ePedBone bone, u32 flags)  ==>>  TRIGGER_PTFX_ON_PED_BONE
TriggerPtfxOnPed(const ch *fxName, Ped ped, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, f32 radius)  ==>>  TRIGGER_PTFX_ON_PED
RemovePtfxFromPed(Player playerIndex)  ==>>  REMOVE_PTFX_FROM_PED
StartPtfx(const ch *fxName, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, f32 radius)  ==>>  START_PTFX
TriggerPtfx(const ch *fxName, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, f32 radius)  ==>>  TRIGGER_PTFX
StartPtfxOnPedBone(const ch *fxName, Ped ped, f32 x, f32 y, f32 z, f32 xspeed, f32 yspeed, f32 zspeed, ePedBone bone, u32 flags)  ==>>  START_PTFX_ON_PED_BONE

// Blip, Sphere, Pickups...
AddSphere(f32 x, f32 y, f32 z, f32 radius, int unknow)  ==>>  ADD_SPHERE
AddNEWSphere(f32 x, f32 y, f32 z, f32 radius, u32 unknow)  ==>>  ADD_SPHERE
RemoveNEWSphere(u32 sphere)  ==>>  REMOVE_SPHERE
RemoveSphere(const ch *sphere)  ==>>  REMOVE_SPHERE
DrawColouredCylinder(f32 x, f32 y, f32 z, f32 hoch, f32 breit, int col_red, int col_green, int col_blue, int alpha)  ==>>  DRAW_COLOURED_CYLINDER
CreatePickupRot(eModel model, u32 pickupType, u32 unknown, f32 x, f32 y, f32 z, f32 rX, f32 rY, f32 rZ, Pickup *pPickup)  ==>>  CREATE_PICKUP_ROTATE
SetPoliceRadarBlips(b8 onOff)  ==>>  SET_POLICE_RADAR_BLIPS
AddPickupToInteriorRoomByKey(Pickup pickup, eInteriorRoomKey roomKey)  ==>>  ADD_PICKUP_TO_INTERIOR_ROOM_BY_KEY
CreateCheckpoint(int type, f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 one)  ==>>  CREATE_CHECKPOINT
DeleteCheckpoint(u32 checkpoint)  ==>>  DELETE_CHECKPOINT

// Diverse, World, Script, Room...
IsControlPressed(int nullZwei, int sysKey)  ==>>  IS_CONTROL_PRESSED
DoesScriptExist(const ch *scriptName)  ==>>  DOES_SCRIPT_EXIST
RequestScript(const ch *scriptName)  ==>>  REQUEST_SCRIPT
SetThisScriptCanRemoveBlipsCreatedByAnyScript(b8 reBlip)  ==>>  SET_THIS_SCRIPT_CAN_REMOVE_BLIPS_CREATED_BY_ANY_SCRIPT
TerminateAllScriptsWithThisName(const ch *scriptName)  ==>>  TERMINATE_ALL_SCRIPTS_WITH_THIS_NAME
GetWaterHeight(f32 x, f32 y, f32 z, f32 *height)  ==>>  GET_WATER_HEIGHT
LoadPathNodesInArea(f32 x1, f32 y1, f32 x2, f32 y2)  ==>>  LOAD_PATH_NODES_IN_AREA
ReleasePathNodes()  ==>>  RELEASE_PATH_NODES
UpdateLoadScene()  ==>>  UPDATE_LOAD_SCENE
TurnOffRadioHUBInLobby()  ==>>  TURN_OFF_RADIOHUD_IN_LOBBY
SetPedNonCreationArea(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2)  ==>>  SET_PED_NON_CREATION_AREA
LoadSceneForRoomByKey(Interior interior, eInteriorRoomKey roomKey)  ==>>  LOAD_SCENE_FOR_ROOM_BY_KEY
SetRoomForCarByKey(Vehicle car, eInteriorRoomKey key)  ==>>  SET_ROOM_FOR_CAR_BY_KEY
SetRoomForViewportByKey(int viewportid, eInteriorRoomKey key)  ==>>  SET_ROOM_FOR_VIEWPORT_BY_KEY
SetMinigameInProgress(b8 onOff)  ==>>  SET_MINIGAME_IN_PROGRESS
StartNewScript(const ch *scriptName, u32 stacksize)  ==>>  START_NEW_SCRIPT
AllocateScriptToObject(const ch *scriptName, u32 model, int unk, float radius, int UnkTime)  ==>>  ALLOCATE_SCRIPT_TO_OBJECT
IsModelInCDImage(eModel model)  ==>>  IS_MODEL_IN_CDIMAGE
SwapNearestBuildingModel(f32 x, f32 y, f32 z, f32 radius, eModel fromModel, eModel toModel)  ==>>  SWAP_NEAREST_BUILDING_MODEL
RegisterWorldPointScriptBrain(char *scriptName, f32 radius)  ==>>  REGISTER_WORLD_POINT_SCRIPT_BRAIN

// Traffic Control & SpeedUp
SetCarDensityMultiplier(f32 CarDensity)  ==>>  SET_CAR_DENSITY_MULTIPLIER
SetPedDensityMultiplier(f32 PedDensity)  ==>>  SET_PED_DENSITY_MULTIPLIER
SetRandomCarDensityMultiplier(f32 RandomCarDensity)  ==>>  SET_RANDOM_CAR_DENSITY_MULTIPLIER
SetParkedCarDensityMultiplier(f32 CarDensity)  ==>>  SET_PARKED_CAR_DENSITY_MULTIPLIER
DontSuppressCarModel(eModel carmodel)  ==>>  DONT_SUPPRESS_CAR_MODEL
DontSuppressAnyCarModel()  ==>>  DONT_SUPPRESS_CAR_MODEL
ForceRandomCarModel(eModel carmodel)  ==>>  FORCE_RANDOM_CAR_MODEL
DontSuppressPedModel(eModel pedmodel)  ==>>  DONT_SUPPRESS_PED_MODEL
DontSuppressAnyPedModels()  ==>>  DONT_SUPPRESS_ANY_PED_MODELS
AddAdditionalPopulationModel(eModel popmodel)  ==>>  ADD_ADDITIONAL_POPULATION_MODEL
RemoveAdditionalPopulationModel(eModel popmodel)  ==>>  REMOVE_ADDITIONAL_POPULATION_MODEL

// Emergency, Police & Undercover
PlaySoundFromVehicle(eSound sound, ch *soundName, Vehicle vehicle)  ==>>  PLAY_SOUND_FROM_VEHICLE, ScriptVoid>(sound, soundName, vehicle); }
SwitchCarSiren(Vehicle vehicle, b8 sirenOnOff)  ==>>  SWITCH_CAR_SIREN
SetSirenWithNoDriver(Vehicle vehicle, b8 sirenOnOff)  ==>>  SET_SIREN_WITH_NO_DRIVER
CreateEmergencyServicesCarReturnDriver(eModel modelPolCar, f32 x, f32 y, f32 z, Vehicle *vehiclePolCar, Ped *char1, Ped *char2)  ==>>  CREATE_EMERGENCY_SERVICES_CAR_RETURN_DRIVER
CreateEmergencyServicesCarThenWalk(eModel modelPolCar, f32 x, f32 y, f32 z)  ==>>  CREATE_EMERGENCY_SERVICES_CAR_THEN_WALK
SetMaxWantedLevel(int wantedLevel)  ==>>  SET_MAX_WANTED_LEVEL

// Camera
ActivateScriptedCams(int highDOF, int highDOF2)  ==>>  ACTIVATE_SCRIPTED_CAMS
AttachCamToPed(Camera camera, Ped ped)  ==>>  ATTACH_CAM_TO_PED
SetCamAttachOffset(Camera camera, f32 xoff, f32 yoff, f32 zoff)  ==>>  SET_CAM_ATTACH_OFFSET
SetCamAttachOffsetIsRelative(Camera camera, bool onOff)  ==>>  SET_CAM_ATTACH_OFFSET_IS_RELATIVE
PointCamAtPed(Camera camera, Ped ped)  ==>>  POINT_CAM_AT_PED
SetCamPointOffset(Camera camera, f32 xoff, f32 yoff, f32 zoff)  ==>>  SET_CAM_POINT_OFFSET
SetCamPointOffsetIsRelative(Camera camera, bool onOff)  ==>>  SET_CAM_POINT_OFFSET_IS_RELATIVE
AttachCamToObject(Camera camera, Object obj)  ==>>  ATTACH_CAM_TO_OBJECT
PointCamAtObject(Camera camera, Object obj)  ==>>  POINT_CAM_AT_PED
SetDrunkCam(Camera camera, f32 effect, u32 time)  ==>>  SET_DRUNK_CAM
ForceGameTelescopeCam(b8 force)  ==>>  FORCE_GAME_TELESCOPE_CAM
SetCamSplineSpeedGraph(Camera camera, int graph)  ==>>  SET_CAM_SPLINE_SPEED_GRAPH
SetCamSplineCustomSpeedGraph(f32 speed)  ==>>  SET_CAM_SPLINE_CUSTOM_SPEED_GRAPH
ResetCamSplineCustomSpeedGraph()  ==>>  RESET_CAM_SPLINE_CUSTOM_SPEED_GRAPH
SetCamInterpCustomSpeedGraph(f32 speed)  ==>>  SET_CAM_INTERP_CUSTOM_SPEED_GRAPH
ResetCamInterpCustomSpeedGraph()  ==>>  RESET_CAM_INTERP_CUSTOM_SPEED_GRAPH
CamSequenceOpen(int sequence)  ==>>  CAM_SEQUENCE_OPEN
CamSequenceStart(int sequence)  ==>>  CAM_SEQUENCE_START
CamSequenceWait(int sequence, u32 time)  ==>>  CAM_SEQUENCE_WAIT
IsCamSequenceComplete(int sequence)  ==>>  IS_CAM_SEQUENCE_COMPLETE
CamSequenceRemove(int sequence)  ==>>  CAM_SEQUENCE_REMOVE
CamSequenceStop(int sequence)  ==>>  CAM_SEQUENCE_STOP
CamSequenceClose()  ==>>  CAM_SEQUENCE_CLOSE
SetCamRoll(Camera camera, f32 roll)  ==>>  SET_CAM_ROLL
BeginCamCommands(int *num)  ==>>  BEGIN_CAM_COMMANDS
EndCamCommands(int *num)  ==>>  END_CAM_COMMANDS
CamSetCinematic(Vehicle veh, b8 set)  ==>>  CAM_SET_CINEMATIC
GetCinematicCam(Camera *camera)  ==>>  GET_CINEMATIC_CAM
ForceNoCamPause(b8 force)  ==>>  FORCE_NO_CAM_PAUSE
GetFreeCam(Camera *camera)  ==>>  GET_FREE_CAM
UnattachCam(Camera camera)  ==>>  UNATTACH_CAM
SetCamMotionBlur(Camera camera, f32 blur)  ==>>  SET_CAM_MOTION_BLUR
GetCamMotionBlur(Camera camera, int *blur)  ==>>  GET_CAM_MOTION_BLUR
SetViewportShape(Camera camera, int shape)  ==>>  SET_VIEWPORT_SHAPE
DestroyAllCams()  ==>>  DESTROY_ALL_CAMS
EnableCamCollision(Camera camera, b8 onOff)  ==>>  ENABLE_CAM_COLLISION
SetGameCameraControlsActive(b8 onOff)  ==>>  SET_GAME_CAMERA_CONTROLS_ACTIVE

// Text & GXT
ClearHelp()  ==>>  CLEAR_HELP
IsThisHelpMessageBeingDisplayed(const ch *gxtName)  ==>>  IS_THIS_HELP_MESSAGE_BEING_DISPLAYED

// NETWORK, Multiplayer...
IsNetworkPlayerActive(u32 playerId)  ==>>  IS_NETWORK_PLAYER_ACTIVE
NetworkKickPlayer(u32 playerId)  ==>>  NETWORK_KICK_PLAYER
NetworkKickPlayer2(u32 playerId, b8 yesNo)  ==>>  NETWORK_KICK_PLAYER
GivePedFakeNetworkName(Ped ped, char *name, u32 red, u32 green, u32 blue, u32 alpha)  ==>>  GIVE_PED_FAKE_NETWORK_NAME
UsePlayerColourInsteadOfTeamColour(b8 yesNo)  ==>>  USE_PLAYER_COLOUR_INSTEAD_OF_TEAM_COLOUR
SetPlayerIconColour(int color)  ==>>  SET_PLAYER_ICON_COLOUR
ThisScriptIsSafeForNetworkGame()  ==>>  THIS_SCRIPT_IS_SAFE_FOR_NETWORK_GAME
IsNetworkSession()  ==>>  IS_NETWORK_SESSION

// Weapons
GiveDelayedWeaponToChar(Ped ped, eWeapon weapon, int delay, bool flag)  ==>>  GIVE_DELAYED_WEAPON_TO_CHAR
SetCharCurrentWeaponVisible(Ped ped, b8 visible)  ==>>  SET_CHAR_CURRENT_WEAPON_VISIBLE
GetWeapontypeModel(eWeapon weapon, eModel *model)  ==>>  GET_WEAPONTYPE_MODEL

// Anims, Sequences & Screen
HasCharAnimFinished(Ped ped, ch *animSet, ch *animName)  ==>>  HAS_CHAR_ANIM_FINISHED
SetWidescreenBorders(b8 onOff)  ==>>  SET_WIDESCREEN_BORDERS
SetInstantWidescreenBorders(b8 onOff)  ==>>  SET_INSTANT_WIDESCREEN_BORDERS
IsSittingObjectNear(f32 x, f32 y, f32 z, int model_or_null)  ==>>  IS_SITTING_OBJECT_NEAR
TaskSitDownOnSeat(Ped ped, int u1, int u2, f32 x, f32 y, f32 z, f32 a, int minus2)  ==>>  TASK_SIT_DOWN_ON_SEAT
TaskSitDownOnNearestObject(Ped ped, int u1, int u2, f32 x, f32 y, f32 z, int model_or_null, f32 a, int minus2, int one)  ==>>  TASK_SIT_DOWN_ON_NEAREST_OBJECT
ClearNewsScrollbar()  ==>>  CLEAR_NEWS_SCROLLBAR
AddStringToNewsScrollbar(const ch *newsScrollText)  ==>>  ADD_STRING_TO_NEWS_SCROLLBAR
ChangeCharSitIdleAnim(Ped ped, const ch *animSet, const ch *animName, int oneOrNull)  ==>>  CHANGE_CHAR_SIT_IDLE_ANIM
TaskPlayAnimNonInterruptable(Ped ped, const ch *animName, const ch *animSet, f32 unk1, int RepeatIsONE, int unk2, int unk3, int unk4, int unk5)  ==>>  TASK_PLAY_ANIM_NON_INTERRUPTABLE
ClearNamedCutscene(char *name)  ==>>  CLEAR_NAMED_CUTSCENE
InitCutscene(char *name)  ==>>  INIT_CUTSCENE
StopCutscene()  ==>>  STOP_CUTSCENE

// Sound & Audio & Radio & TV & Movie & Stream
PlayAudioEventFromPed(const ch *audioName, Ped ped)  ==>>  PLAY_AUDIO_EVENT_FROM_PED
PlayAudioEventFromVehicle(const ch *audioName, Vehicle veh)  ==>>  PLAY_AUDIO_EVENT_FROM_VEHICLE
PlayAudioEventFromObject(const ch *audioName, Object obj)  ==>>  PLAY_AUDIO_EVENT_FROM_OBJECT
MutePositionedRadio(b8 yesNo)  ==>>  MUTE_POSITIONED_RADIO
MuteGameworldAndPositionedRadioForTv(b8 yesNo)  ==>>  MUTE_GAMEWORLD_AND_POSITIONED_RADIO_FOR_TV
MuteGameworldAudio(b8 yesNo)  ==>>  MUTE_GAMEWORLD_AUDIO
RegisterScriptWithAudio(b8 one)  ==>>  REGISTER_SCRIPT_WITH_AUDIO
SetMobileRadioEnabledDuringGameplay(b8 onOff)  ==>>  SET_MOBILE_RADIO_ENABLED_DURING_GAMEPLAY
StopPedSpeaking(Ped ped, b8 onOff)  ==>>  STOP_PED_SPEAKING
SetCurrentMovie(char *moviefile)  ==>>  SET_CURRENT_MOVIE
DrawMovie(f32 u1, f32 u2, f32 u3, f32 u4, f32 u5, int red, int green, int blue, int alpha)  ==>>  DRAW_MOVIE
SetMovieTime(f32 time)  ==>>  SET_MOVIE_TIME
SetMovieVolume(f32 volume)  ==>>  SET_MOVIE_VOLUME
StopMovie()  ==>>  STOP_MOVIE
OverrideFreezeFlags(b8 onOff)  ==>>  OVERRIDE_FREEZE_FLAGS
SwitchStreaming(b8 onOff)  ==>>  SWITCH_STREAMING
PlayStreamFromObject(Object obj)  ==>>  PLAY_STREAM_FROM_OBJECT
PlayStreamFrontend()  ==>>  PLAY_STREAM_FRONTEND
StopStream()  ==>>  STOP_STREAM
RequestAmbientAudioBank(char *name)  ==>>  REQUEST_AMBIENT_AUDIO_BANK
PreloadStream(char *name)  ==>>  PRELOAD_STREAM
AmbientAudioBankNoLongerNeeded()  ==>>  AMBIENT_AUDIO_BANK_NO_LONGER_NEEDED
GetStreamPlaytime()  ==>>  GET_STREAM_PLAYTIME
DrawSprite(Texture texture, f32 u1, f32 u2, f32 u3, f32 u4, f32 angle, int red, int green, int blue, int alpha)  ==>>  DRAW_SPRITE
StartEndCreditsMusic()  ==>>  START_END_CREDITS_MUSIC
StopEndCreditsMusic()  ==>>  STOP_END_CREDITS_MUSIC
PlaySoundFromPed(eSound sound, ch *soundName, Ped ped)  ==>>  PLAY_SOUND_FROM_PED
PlaySoundFromObject(eSound sound, ch *soundName, Object obj)  ==>>  PLAY_SOUND_FROM_OBJECT
PlaySoundFromPosition(eSound sound, ch *soundName, f32 x, f32 y, f32 z)  ==>>  PLAY_SOUND_FROM_POSITION

// HTML WEB WHM
AddToHtmlScriptObject(int htmlobj, char *htmlcode)  ==>>  ADD_TO_HTML_SCRIPT_OBJECT
CreateHtmlScriptObject(char *objname)  ==>>  CREATE_HTML_SCRIPT_OBJECT
CreateHtmlViewport(int *htmlviewport)  ==>>  CREATE_HTML_VIEWPORT
DeleteAllHtmlScriptObjects()  ==>>  DELETE_ALL_HTML_SCRIPT_OBJECTS
DeleteHtmlScriptObject(int htmlobj)  ==>>  DELETE_HTML_SCRIPT_OBJECT
DoesWebPageExist(char *webaddress)  ==>>  DOES_WEB_PAGE_EXIST
DoesViewportExist(int htmlviewport)  ==>>  DOES_VIEWPORT_EXIST
GetScreenViewportId(int *viewportID)  ==>>  GET_SCREEN_VIEWPORT_ID
GetGameViewportId(int *viewportID)  ==>>  GET_GAME_VIEWPORT_ID
LoadWebPage(int htmlviewport, char *webaddress)  ==>>  LOAD_WEB_PAGE
ReloadWebPage(int htmlviewport)  ==>>  RELOAD_WEB_PAGE
GetWebPageHeight(int htmlviewport)  ==>>  GET_WEB_PAGE_HEIGHT
SetWebPageScroll(int htmlviewport, float scroll)  ==>>  SET_WEB_PAGE_SCROLL
GetNumberOfWebPageLinks(int htmlviewport)  ==>>  GET_NUMBER_OF_WEB_PAGE_LINKS
ch *GetWebPageLinkHref(int htmlviewport, int linkid)  ==>>  GET_WEB_PAGE_LINK_HREF
GetWebPageLinkPosn(int htmlviewport, int linkid, float *x, float *y)  ==>>  GET_WEB_PAGE_LINK_POSN
GetWebPageLinkAtPosn(int htmlviewport, float x, float y)  ==>>  GET_WEB_PAGE_LINK_AT_POSN
SetWebPageLinkActive(int htmlviewport, int linkid, b8 active)  ==>>  SET_WEB_PAGE_LINK_ACTIVE
AddFirstNCharactersOfStringToHtmlScriptObject(int htmlobj, char *str, int n)  ==>>  ADD_FIRST_N_CHARACTERS_OF_STRING_TO_HTML_SCRIPT_OBJECT
AddStringToHtmlScriptObject(int htmlobj, char *str)  ==>>  ADD_STRING_TO_HTML_SCRIPT_OBJECT
ConvertThenAddStringToHtmlScriptObject(int htmlobj, char *strgxtkey)  ==>>  CONVERT_THEN_ADD_STRING_TO_HTML_SCRIPT_OBJECT
CompareStrings(const char *str1, const char *str2)  ==>>  COMPARE_STRING       

Feel free to edit/use anything! If you have more edited natives post it here. Small code examples are welcome too.
Always respect the hard work of other coders/modders -> please make a small notation like "Thanks to Aru, Alexander Blade, Skorpro" if you use this in own mods! THANX
biggrin.gif


Hope it's helpful - have fun now smile.gif


Special thanx to:

  • Alexander Blade for ASI Loader & SCOCL natives list
  • Aru for C++ ScriptHook SDK

AXLiberty
  • AXLiberty

    Player Hater

  • Members
  • Joined: 07 Sep 2011

#2

Posted 24 August 2013 - 10:49 AM

Thank you for this! smile.gif

Skorpro
  • Skorpro

    GTAholic

  • Members
  • Joined: 19 Jul 2009

#3

Posted 24 December 2013 - 04:17 AM Edited by Skorpro, 24 December 2013 - 04:22 AM.

Hi guys!

 

It's been a long time...

 

LetsPlayOrDy has looked for a method to set a vehicle to a position just a couple of feet in front of player.
This is a small example to do this in C++
.

Car Spawn Example:

 

CustomFiberThread.h

Scripting::Vehicle SpawnCar(Scripting::eModel model, f32 x, f32 y, f32 z, f32 h);

CustomFiberThread.cpp

...
...
...

// Global vars
Vehicle spawnCar;
f32 sx, sy, sz, sh;
b8 delcar = 0;


Scripting::Vehicle CustomFiberThread::SpawnCar(Scripting::eModel model, f32 x, f32 y, f32 z, f32 h)
{
	// Local vars
	Vehicle retVeh;
	eInteriorRoomKey carRoomKey;
	// Load model
	RequestModel(model);
	while(!HasModelLoaded(model)) { Wait(0); }
	// Spawn vehicle
	ClearArea(x, y, z, 3.01f, 1);
	Wait(0);
	CreateCar(model, x, y, z, &retVeh, true);
	GetKeyForCharInRoom(GetPlayerPed(), &carRoomKey);
	SetCarOnGroundProperly(retVeh);
	SetRoomForCarByKey(retVeh, carRoomKey);
	SetCarHeading(retVeh, h);
	MarkModelAsNoLongerNeeded(model);

	return retVeh;
}


void CustomFiberThread::RunScript()
{
	// This is a fiber thread, so we use an loop to run the contents of this script.
	// The thread will terminate when we return from this function.
	
	Wait(2000);

	while(IsThreadAlive())		// MAIN LOOP
	{
		if (GetKeyState(116)<0)	// Press <F5> to spawn vehicle (F5 = 116)
		{
			if (delcar == 0)
			{
				GetOffsetFromCharInWorldCoords(GetPlayerPed(), 0.0f, 5.0f, 0.0f, &sx, &sy, &sz); // 5 steps from player (y coord!)
				GetCharHeading(GetPlayerPed(), &sh);
				spawnCar = SpawnCar(MODEL_ORACLE, sx, sy, sz, sh); // Check "ScriptingEnums.h" for models...
				ChangeCarColour(spawnCar, 0, 1);
				SetExtraCarColours(spawnCar, 0, 0);
				SetVehicleDirtLevel(spawnCar, 0.0f);
				WashVehicleTextures(spawnCar, 255);
				PrintStringWithLiteralStringNow("STRING", "Car spawned!", 2000, 1);
				delcar = 1;
			}
			else if (delcar == 1)
			{ 
				if ( (DoesVehicleExist(spawnCar)) && (!IsCharInCar(GetPlayerPed(), spawnCar)) ) // To delete car exit it first...
				{
					DeleteCar(&spawnCar); 
					PrintStringWithLiteralStringNow("STRING", "Car deleted!", 2000, 1);
					delcar = 0;
				}
				else PrintStringWithLiteralStringNow("STRING", "Can't delete car...", 2000, 1);
			}
			Wait(200);
		}
		Wait(0);
	}
}

Any questions? Post it here! :)

 

Merry Christmas and a Happy New Year! :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users