Log in to reply
 

Someone Please Help me with my coding?



  • I made a sourcecode modified to make LAZER attack player in 5 stars "With landing gear in"

    But I have no idea how to make a script with it

    Although I have Zero knowledge in Visual studios and C# I tried but failed

    Someone with good scripting experience please help me finish the mod!

    #include "script.h"
    #include <random>
    #include <iostream>
    #include <string>
    #include <ctime>

    #pragma warning(disable : 4244 4305) // double <-> float conversions

    Vehicle jetVeh;
    Ped driver;
    int jetVehSpawned = 1;

    void update()
    {
    Player player = PLAYER::PLAYER_ID();
    Ped playerPed = PLAYER::PLAYER_PED_ID();
    Vehicle veh = PED::GET_VEHICLE_PED_IS_USING(playerPed);

    DWORD jet = GAMEPLAY::GET_HASH_KEY("lazer");
    Ped driverModel = GAMEPLAY::GET_HASH_KEY("S_M_Y_Marine_03");
    
    if (PLAYER::GET_PLAYER_WANTED_LEVEL(player) == 5 && PED::IS_PED_IN_ANY_PLANE(playerPed) || PLAYER::GET_PLAYER_WANTED_LEVEL(player) == 5 && PED::IS_PED_IN_ANY_HELI(playerPed))
    {
    	WAIT(15000);
    	if (jetVehSpawned == 0)
    	{
    		STREAMING::REQUEST_MODEL(jet);
    		while (!STREAMING::HAS_MODEL_LOADED(jet))
    			WAIT(0);
    		Vector3 position = ENTITY::GET_ENTITY_COORDS(playerPed, 1);
    		jetVeh = VEHICLE::CREATE_VEHICLE(jet, position.x, position.y, position.z + 400.0f, ENTITY::GET_ENTITY_HEADING(playerPed), 0, 0);
    		STREAMING::REQUEST_MODEL(driverModel);
    		while (!STREAMING::HAS_MODEL_LOADED(driverModel))
    			WAIT(0);
    		driver = PED::CREATE_PED_INSIDE_VEHICLE(jetVeh, 26, driverModel, -1, false, false);
    		VEHICLE::SET_VEHICLE_FORWARD_SPEED(jetVeh, 50.0f);
                        VEHICLE::_SET_VEHICLE_LANDING_GEAR(jetVeh, 3);
    		PED::SET_PED_RELATIONSHIP_GROUP_HASH(driver, GAMEPLAY::GET_HASH_KEY("cop"));
    		AI::TASK_VEHICLE_CHASE(driver, playerPed);
    		jetVehSpawned += 1;
    	}
    }
    
    if (jetVehSpawned == 1)
    {
    	WAIT(15000);
    	ENTITY::SET_PED_AS_NO_LONGER_NEEDED(&driver);
    	ENTITY::SET_VEHICLE_AS_NO_LONGER_NEEDED(&jetVeh);
    	jetVehSpawned -= 1;
    }
    
    while (PLAYER::IS_PLAYER_DEAD(player))
    {
    	WAIT(7950);
    	if (PLAYER::IS_PLAYER_DEAD(player))
    	{
    		ENTITY::DELETE_ENTITY(&jetVeh);
    		PED::DELETE_PED(&driver);
    		Vector3 position = ENTITY::GET_ENTITY_COORDS(playerPed, 1);
    		GAMEPLAY::CLEAR_AREA(position.x, position.y, position.z, 1000.0f, 1, 1, 1, 1);
    	}
    }
    

    }

    void main()
    {
    while (true)
    {
    update();
    WAIT(0);
    }
    }

    void ScriptMain()
    {
    srand(GetTickCount());
    main();
    }

    this is the sourcecode I edited


  • MODERATOR

    This is C++ not C#.

    To compile you'll need Visual C++ to be installed (check C++ in the Visual Studio installer) and you'll need the Script Hook V SDK. The easiest way to compile would be to copy-paste this code into one of the samples included in the SDK, then compile the sample.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.