Jump to content

Django93

Members
  • Posts

    6
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Django93

  1. On my server all data is stored in Mysql. When a player wants to lock or unlock a vehicle, it is checked if he has a key for the vehicle. But I cut the part out.

    Everyone has to know that himself, how he wants to implement it. Both varieties work.

  2. This function is intended to simulate that the tires break when fired. getClosestVehicle() returns only one int, not the vehicle handle.

    Here is my working client-side script:

    mp.events.add('playerWeaponShot', (targetPosition) => {
        let nearestVehicle = mp.game.vehicle.getClosestVehicle(targetPosition.x, targetPosition.y, targetPosition.z, 2, 0, 70);
    
        if( nearestVehicle != 0 ) {
            // chance of damage
            if( Math.floor((Math.random() * 100) + 1) < 25 ) {
                for (var i = 0; i < 4; i++) {
                    var DamagedWheel = Math.floor((Math.random() * 9));
                    mp.vehicles.atHandle(nearestVehicle).setTyreBurst(DamagedWheel, true, 1000);
                }
            }
        }
    });

    But I think it's easier and safer to run these functions on the server side. Here is an example from my server:

    mp.events.add('vehicle_toggle_lock', (Player) => {
        var NearbyVehicles = [];
        mp.vehicles.forEachInRange(Player.position, 2.5, (NerbyVehicle) => {
            NearbyVehicles.push(NerbyVehicle);
        });
    
    	// sort the vehicles by range (0 is closest to the player)
        NearbyVehicles.sort(function(a, b){return b.dist(Player.position)-a.dist(Player.position)});
    
        if( NearbyVehicles.length > 0 )
        {
    		if( NearbyVehicles[0].locked ) {
            	NearbyVehicles[0].locked = false;
            	Player.notify("You ~g~unlocked the vehicle.");
            	// MySQL_Conn.query("UPDATE vehicles SET veh_locked='0' WHERE vehicle=?", [NearbyVehicles[0].data.id]);
            } else {
            	NearbyVehicles[0].locked = true;
            	Player.notify("You ~r~locked the vehicle.");
            	// MySQL_Conn.query("UPDATE vehicles SET veh_locked='1' WHERE vehicle=?", [NearbyVehicles[0].data.id]);
            }
    	}
    });

     

    • Like 1
  3. Thank you for your answer. With locally I meant to add the vehicles to GTA 5. I just tried it again with the mod in different folders, but without success. I'm not sure which folder you mean by "server folder".

    At the moment my structure looks like this:

    - server-files
    	- bridge
    	- client_packages
    		- some node.js files
    		- dlcpacks
    			- rs6
    				- dlc.rpf
    	- dlcpacks <-- for testing
    	- maps
    	- packages
    		- some node.js files
    		- dlcpacks <-- for testing
    	- plugins

    after a test I remove the new folders again. I had also tested it with the Shelbygt500 from the test pack and 5 other vehicles - without success. So far I have not found a Rage.MP server that had mod vehicles.

    Unfortunately, I find no official documentation on this topic.

    • Like 1
  4. Good evening,
    I'm looking for some days for a way to change individual garments on a character. However, until now without success.

    I did not get any further with player.setClothes. I have tried many values, but my player's clothing has not changed. Can someone help me there?

    I am thankful for every help.
    greeting
    Kai

×
×
  • Create New...