Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    2. News

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
    1. GTA Online

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

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

    2. GTA Next

    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

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

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

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

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

      1. Merchandising
    1. GTA Modding

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

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

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

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Site Suggestions

Sign in to follow this  
kuhny1

Need Help Making Client Side Mods [FiveM]

Recommended Posts

kuhny1

Hi all. I have recently gotten into scripting for GTA, and i play on my own FiveM server with my brother. Ive been coding for quite sometime but the only modding to GTA i have ever done was changing meta files. Now i want to try script hook scripting, After having spent 7 hours straight trying to get visual studio to work with script hook i finally made a simple script that finds the nearest vehical to the player and blows it up. Scripthook.NET worked almost instantly when setting it up. However, FiveM doesnt work with .Net mods anymore, and thats what i want to mod, to add some things to do in the server. Currently, im only interested in client side mods. I have gotten some mods to work that are only scripthook and they are vehicalJetpack, lambda menu, and simple trainer. However when i put my mod in FiveM it only seems to find work when i disconnect.

 

Now those mods i have said are obviously not designed to work with fiveM, but something they did with their code, makes them work. And thats what im trying to figure out.

 

Basically, i think ive narrowed it down to having a problem of finding the player. See the mod works just fine in single player. I have no idea how the jet pack mod works in FiveM. I mean it would need to keep track of the vehicle and edit its rotation and position. And thats what i need is position of either either the player itself, or the vehicle the player is in. Here is my code, ill comment what i can.

 

I know posting the entire code wasnt really necessary, but i know from other forums some people want to see it all.

 

Edit: just realized that this is in the wrong section, im trying to find a way to delete this and move it to coding

#include "script.h"#include "keyboard.h"void update_features(){			}//the draw text function doesnt work as i expect, i cant figure out how to set notifications with regular script hook yetvoid draw_text(char* text, float x, float y, int scale) {	UI::SET_TEXT_FONT(1);	UI::SET_TEXT_SCALE(scale, scale);	UI::SET_TEXT_COLOUR(255, 255, 255, 255);	UI::SET_TEXT_WRAP(0.0, 1.0);	UI::SET_TEXT_CENTRE(false);	UI::SET_TEXT_DROPSHADOW(2, 2, 0, 0, 0);	UI::SET_TEXT_EDGE(1, 0, 0, 0, 205);	UI::_SET_TEXT_ENTRY("STRING");	UI::_ADD_TEXT_COMPONENT_STRING(text);	UI::_DRAW_TEXT(y, x);}//booleans for toggling the modBOOL toggle = false;bool hasReleased = true;void main(){	while (true)	{		if (IsKeyDown(VK_DELETE) && hasReleased) { //when delete is pressed set toggle equal to the opposite of the current state if the key has been released before			toggle = !toggle;			hasReleased = false;					}		if (IsKeyJustUp(VK_DELETE) && hasReleased == false) { //set released equal to true so the mod can be turned back on			hasReleased = true;					}		if (toggle) { //if mod (toggle=true) is active			draw_text("1", 1000, 1000, 10);//draw text to the UI, doesnt work in single player or fiveM...			Ped playerPed = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(playerPed); //get the players Ped						if (PED::IS_PED_SITTING_IN_ANY_VEHICLE(playerPed)) { //detect if we are in a vehical				Vector3 vehiclePosition = ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(PED::GET_VEHICLE_PED_IS_IN(playerPed, true), 0.0, 0.0, 0.0); //get the position of the vehicle the player is in. This was to test if getting the postion of the vehicle would change anything. It didn't, nothing changed				Vehicle closestVehical = VEHICLE::GET_CLOSEST_VEHICLE(vehiclePosition.x, vehiclePosition.y, vehiclePosition.z, 15, 0, 70); //find the closest vehicle within a radius of 15 centered around the vehicle position				VEHICLE::EXPLODE_VEHICLE(closestVehical, true, false); //blow it up			}					}		else		{			draw_text("0", 1000, 1000, 10); // again, doesnt work		}				WAIT(1); 							}	}void ScriptMain(){	srand(GetTickCount());	main();}
Edited by kuhny1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • 1 User Currently Viewing
    0 Members, 0 Anonymous, 1 Guest

×

Important Information

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