SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 13/06/2018, 09:26 AM   #1
jlalt
High-roller
 
Join Date: Oct 2014
Location: Iran
Posts: 1,415
Reputation: 352
Default SDV ( Semi Dynamic Vehicle ) Plugin

SDV 1.0.5

Description:
  • A plugin to destroy / recreate a vehicle when its necessary to avoid caring about the 2,000 vehicle limit

Natives
PHP Code:
native CreateDynamicVehicle(vehicletypeFloat:xFloat:yFloat:zFloat:rotationcolor1color2respawn_delayaddsiren=0virtualworld 0interior 0Floatstreamdis V_STREAM_DIS);
native DestroyDynamicVehicle(vehicleid);
native SetStreamDistance(Float:streamdistance);
native SetVehicleCheckDelay(milliseconds);
native GetDynamicVehiclePos(vehicleid, &Float:x, &Float:y, &Float:z);
native SetDynamicVehiclePos(vehicleidFloat:xFloat:yFloat:z);
native SetDynamicVehicleZAngle(vehicleidFloat:z_angle);
native GetDynamicVehicleZAngle(vehicleid, &Float:z_angle);
native GetDynamicVehicleRotationQuat(vehicleid, &Float:w, &Float:x, &Float:y, &Float:z);
native Float:GetDVehicleDistanceFromPoint(vehicleidFloat:XFloat:YFloat:Z);
native SetDynamicVehicleParamsEx(vehicleidenginelightsalarmdoorsbonnetbootobjective);
native GetDynamicVehicleParamsEx(vehicleid, &engine, &lights, &alarm, &doors, &bonnet, &boot, &objective);
native SetDynamicVehicleToRespawn(vehicleid);
native LinkDynamicVehicleToInterior(vehicleidinteriorid);
native GetDynamicVehicleInterior(vehicleid); // New
native AddDynamicVehicleComponent(vehicleidcomponentid);
native RemoveDynamicVehicleComponent(vehicleidcomponentid);
native GetDVehicleComponentInSlot(vehicleidslot);
native ChangeDynamicVehicleColor(vehicleidcolor1color2);
native GetDynamicVehicleColor(vehicleid, &color1, &color2); // new
native ChangeDynamicVehiclePaintjob(vehicleidpaintjobid);
native GetDynamicVehiclePaintjob(vehicleid);
native SetDynamicVehicleHealth(vehicleidFloat:health);
native GetDynamicVehicleHealth(vehicleid, &Float:health);
native SetDynamicVehicleNumberPlate(vehicleidnumberplate[]);
native GetDynamicVehicleNumberPlate(vehicleidnumberplate[], len sizeof numberplate); // new
native SetDynamicVehicleModel(vehicleidmodelbool:bultinrespawn false); // New, requires respawn
native GetDynamicVehicleModel(vehicleid);
native RepairDynamicVehicle(vehicleid); 
native GetDynamicVehicleVelocity(vehicleid, &Float:X, &Float:Y, &Float:Z);
native SetDynamicVehicleVelocity(vehicleidFloat:XFloat:YFloat:Z);
native SetDVehicleAngularVelocity(vehicleidFloat:XFloat:YFloat:Z);
native GetDynamicVehicleDamageStatus(vehicleid, &panels, &doors, &lights, &tires);
native UpdateDVehicleDamageStatus(vehicleidpanelsdoorslightstires);
native SetDynamicVehicleVirtualWorld(vehicleidworldid);
native GetDynamicVehicleVirtualWorld(vehicleid);
native IsDynamicVehicleStreamedIn(vehicleidforplayerid);
native IsPlayerInDynamicVehicle(playeridvehicleid);
native PlayerSpectateDynamicVehicle(playeridtargetvehicleidmode SPECTATE_MODE_NORMAL);
native IsValidDynamicVehicle(vehicleid);
native PutPlayerInDynamicVehicle(playeridvehicleidseatid);
native GetPlayerDynamicVehicleID(playerid);
native GetPlayerSurfingDVehicleID(playerid);
native UpdateTheVehicles();
native SetDVehicleParamsForPlayer(vehicleidplayeridobjectivedoorslocked);
native GetVehicleDynamicID(vehicleid);
native MoveVehicleDynamicID(fromidtoid = -1);

/*
native AttachTrailerToVehicle(trailerid, vehicleid);
native DetachTrailerFromVehicle(vehicleid);
native IsTrailerAttachedToVehicle(vehicleid);
native GetVehicleTrailer(vehicleid);
native AttachObjectToVehicle(objectid, vehicleid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ);
native AttachPlayerObjectToVehicle(playerid, objectid, vehicleid, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:RotZ);
native Attach3DTextLabelToVehicle(Text3D:id, vehicleid, Float:OffsetX, Float:OffsetY, Float:OffsetZ);
native Update3DTextLabelText(Text3D:id, color, text[]);
native PlayerText3D:CreatePlayer3DTextLabel(playerid, text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, attachedplayer=INVALID_PLAYER_ID, attachedvehicle=INVALID_VEHICLE_ID, testLOS=0);
native DeletePlayer3DTextLabel(playerid, PlayerText3D:id);
native UpdatePlayer3DTextLabelText(playerid, PlayerText3D:id, color, text[]);
^ To be made */ 
Is it stable?
  • Plugin has been tested with +3 thousand vehicles and +25 ( Up to 40 ) player base every thing was looking good. ( I don't refuse that I've did several changes and bug fixes to let it look good for now xd )

Shall I use it?
  • Its really up to you, but it looks semi-stable

Is it complete yet?
  • Honestly, no, there's some supports and functions missing, check github for more information about those
  • Github

Easy installation:
  • 1. Put the plugin in your server plugin folder and include in pawno includes.
  • 2. Include the include in your script and before the include add: #define RVFunc ( Replace Vehicle Functions )
  • 3. So now every callback and create normal vehicle is auto converted to dynamic.
  • 4. Enjoy!

Example script:
PHP Code:
#define RVFunc
#include <dvehicles>
public OnGameModeInit()
{
    for(new 
06000i++)
    {
        
CreateVehicle(4110.0 + ( 5.0 ), 0.0 + ( 5.0 ), 3.00.03700);
    }

Download
Source Code

Last edited by jlalt; 23/06/2018 at 04:59 PM.
jlalt is offline   Reply With Quote
Old 13/06/2018, 11:23 AM   #2
Verc
Big Clucker
 
Verc's Avatar
 
Join Date: Apr 2018
Location: 🇯🇵
Posts: 161
Reputation: 29
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

What about the vehicleid? Is it changed everytime the player streams the vehicle?
Verc is offline   Reply With Quote
Old 13/06/2018, 11:29 AM   #3
jlalt
High-roller
 
Join Date: Oct 2014
Location: Iran
Posts: 1,415
Reputation: 352
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

Quote:
Originally Posted by Verc View Post
What about the vehicleid? Is it changed everytime the player streams the vehicle?
Now there's two kind of ids, dynamic and normal one.
the id returned by CreateDynamicVehicle is stable and never changes until you order the script to change it.
the id returned from OnVehicleDeath, OnPlayerEnterVehicle, OnPlayerWeaponShot...
can be converted to dynamic id using: GetVehicleDynamicID
jlalt is offline   Reply With Quote
Old 13/06/2018, 11:31 AM   #4
Verc
Big Clucker
 
Verc's Avatar
 
Join Date: Apr 2018
Location: 🇯🇵
Posts: 161
Reputation: 29
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

Great,just as what I expected.
Good luck maintaining this plugin!
Verc is offline   Reply With Quote
Old 13/06/2018, 11:48 AM   #5
Tebrex
Little Clucker
 
Join Date: Aug 2016
Posts: 2
Reputation: 0
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

It looks good at first glance, but i don't think it will work pretty good on more players, for example 200/300+ or even 500+/1000. Anyway, i'll test it and we'll see.

Btw good job
Tebrex is offline   Reply With Quote
Old 13/06/2018, 12:24 PM   #6
GangstaSunny.
Huge Clucker
 
GangstaSunny.'s Avatar
 
Join Date: Apr 2010
Location: Hamburg - Germany
Posts: 203
Reputation: 23
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

Dope. +1 rep

Whatever those guys talking bro, keep working.
I would like to usw a stable release asap.
__________________
Visit my Website
https://gangstasunny.de
GangstaSunny. is offline   Reply With Quote
Old 13/06/2018, 12:57 PM   #7
jlalt
High-roller
 
Join Date: Oct 2014
Location: Iran
Posts: 1,415
Reputation: 352
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

Quote:
Originally Posted by GangstaSunny. View Post
Dope. +1 rep

Whatever those guys talking bro, keep working.
I would like to usw a stable release asap.
To be honest I've solved all the issues I've realize of while its being tested, so far it looks running smooth. [ if you want I can give you the server ip so you can test by yourself! ]
jlalt is offline   Reply With Quote
Old 13/06/2018, 12:58 PM   #8
Pottus
Godfather
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 5,420
Reputation: 1227
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

Vehicle streaming is a bad idea overall however the results should be alright with a low player count and low vehicle count. I can guarantee that a server with 200 players and 4000 vehicles is going to have a lot of problems. I don't think the effort put into this plugin will ever be worth the reward the demographics is a very small and for the servers that could actually use it viability just isn't there.

You have 200 players.
You have 4000 vehicles.
Those 200 players are evenly distributed about the map each out of each others stream range.
Each of those 200 players could see a maximum of 10 vehicles.
However each player has 20 vehicles in their stream range.
Therefore 10 vehicles per player won't ever be seen.
Pottus is offline   Reply With Quote
Old 13/06/2018, 01:13 PM   #9
jlalt
High-roller
 
Join Date: Oct 2014
Location: Iran
Posts: 1,415
Reputation: 352
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

Quote:
Originally Posted by Pottus View Post
Vehicle streaming is a bad idea overall however the results should be alright with a low player count and low vehicle count. I can guarantee that a server with 200 players and 4000 vehicles is going to have a lot of problems. I don't think the effort put into this plugin will ever be worth the reward the demographics is a very small and for the servers that could actually use it viability just isn't there.

You have 200 players.
You have 4000 vehicles.
Those 200 players are evenly distributed about the map each out of each others stream range.
Each of those 200 players could see a maximum of 10 vehicles.
However each player has 20 vehicles in their stream range.
Therefore 10 vehicles per player won't ever be seen.
Saw the algorithm I wrote?
It streams the nearest and unstreams the farthest, so if a car near you its always supposed to show it for you and unstream the far one if necessary [ GetFarestCarID ]
jlalt is offline   Reply With Quote
Old 13/06/2018, 02:00 PM   #10
GangstaSunny.
Huge Clucker
 
GangstaSunny.'s Avatar
 
Join Date: Apr 2010
Location: Hamburg - Germany
Posts: 203
Reputation: 23
Default Re: SDV ( Semi Dynamic Vehicle ) Plugin

Quote:
Originally Posted by Pottus View Post
Vehicle streaming is a bad idea overall however the results should be alright with a low player count and low vehicle count. I can guarantee that a server with 200 players and 4000 vehicles is going to have a lot of problems. I don't think the effort put into this plugin will ever be worth the reward the demographics is a very small and for the servers that could actually use it viability just isn't there.

You have 200 players.
You have 4000 vehicles.
Those 200 players are evenly distributed about the map each out of each others stream range.
Each of those 200 players could see a maximum of 10 vehicles.
However each player has 20 vehicles in their stream range.
Therefore 10 vehicles per player won't ever be seen.
You're thinking in the right way BUT

This plugin unstreams vehicles for the player which means there is no problem client side at least.

Server-side it can be a Problem, yes. But only if your server is crap. The limit of 2000 vehicles doesnt mean thats all samp can handle, it just mean that samp actualy dies not SUPPORT more than 2000. In the end, samp doesnt have to support it, since the plugin does.


Also:
You got 200 players.
50 are at the lspd with all the 50 faction vehicles (for example). It does not mean there will be 200x50 vehicles streamed. It will just be 50.
__________________
Visit my Website
https://gangstasunny.de
GangstaSunny. is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [E.V.O] Elite Vehicle Ownership [V1.0] [Dynamic Vehicle System] DarkSkull Filterscripts 10 20/05/2018 06:02 PM
Dynamic Vehicle morocco Scripting Help 1 20/07/2013 08:47 PM
Dynamic Vehicle morocco Scripting Help 0 19/07/2013 07:03 AM
Dynamic Vehicle Tanush123 Scripting Help 4 07/07/2013 11:54 PM


All times are GMT. The time now is 02:58 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.