[FilterScript] RealVehicle 1.0.1
#1

RealVehicle 1.1.1


New Update Version 1.1.1 (24-September-2014) updates
  • Cleaned up the textdraws (again, thanks Pottus!).
  • Fixed a bug that caused the engine to turn off when a passenger exited a vehicle.
  • Fixed a few more minor bugs.
  • Reinstated the "excessive-information" textdraws option.
Version 1.1.0 (23-September-2014)
  • Simplified the speedo display, as the display in 1.0.1 is a little excessive, but I won't remove the old display entirely, I will leave the code there so it can still be used, if desired.
  • Added a vehicle stats system. Vehicles will now be handled more like players, and will have their own stats (distance traveled, times died, etc).
  • Added a vehicle stats save/load system. Vehicle stats can now be saved/loaded from an .ini file, so restarting your server does not need to reset the vehicle stats.
  • Added a few more commands.
  • RE the save/load system, added a command to import vehicles from a csv file, much like grandlarc does.
  • Added a number plate system, all vehicles will now have a unique number plate (which can be customized).
  • Fixed the textdraws to be more efficient
  • Updated the way fuel is calculated - A vehicle can now consume fuel even if there is no player in it (if the engine has been left on, for example).
For those who preferred the excessive-looking textdraws, they are not available in this version, however will be restored as an option in my next release


version 1.0.1
OK, so I've been having a go at sa-mp scripting (I already have knowledge programming C++), and I've made this filterscript that implements a fuel system (with fuel stations and everything) and a few related commands on a server. I am currently developing this, and expect to release upgraded versions in the near future, but for now I am releasing version 1.0.1 to the community. Please be aware that this is my first sa-mp filterscript release, so there are some inefficiencies/bugs in this version that I am aware of, but I will not be patching, because they are caused by redundant code that is being addressed in the next version, which will have a number of new features (in relation to dynamic vehicle management).

However, having said that, you are welcome to give feedback for improvements or things you think I should add in the next version, just be aware that I won't be fixing bugs in this version - any issues that you post will be considered for version 1.1.0.


Documentation

Documentation of the commands and any other important information is also included in the download zip file
Commands
  • /v - toggle players current vehicle's engine on/off
  • /fuel20 - set players current vehicle's fuel to 20L
  • /refuel - refuel players current vehicle to 100% fuel
  • /fixcar - repair players current vehicle to 0% damage
  • /vehimport - import from csv
  • /vehsave - save the current vehicle's stats
  • /vehload - load the specified number plate from file
  • /vehsaveall - save all connected vehicles to file
  • /setplate - set's the current vehicles number plate
The commands are explained in a little more detail in the readme file, but you can just look through the source to find what they are anyway.


Download

(latest) Version 1.1.1
Download zip of source and amx from digiforce.bytesoftwaretech.com/realvehicle.php?id=sampforum

Version 1.1.0
Download zip of source and amx from digiforce.bytesoftwaretech.com/realvehicle.php?id=sampforum
pastebin is no longer available, due to the increased number of include files required - The zip file provides all the includes/plugins required, so if your server doesn't have one of the realvehicles dependencies, you don't have to download them separately.

Version 1.0.1
Download zip of .pwn source and .amx from http://digiforcecreations.eu.pn/file...hicle-1.0.1.7z
*edit* link to pastebin http://pastebin.com/7ChF6sqj

You are free to use this code and alter it to suit your requirements, however please do not redistribute. If you do happen to use this on your server, I would appreciate it if you could let me know, purely for statistical purposes. Overall, I hope this is helpful, and as always, have fun!




---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Insert deep philosophical statement here...
Reply
#2

A pastebin with the code would be appreciated.
Reply
#3

Alright, it seems people here like to use pastebin, I will make a link to that too...
Reply
#4

Oh, really-really nice.

Thanks, keep up the good work
Reply
#5

Quote:
Originally Posted by TheStoNe
Посмотреть сообщение
Oh, really-really nice.

Thanks, keep up the good work
No problem, glad you found it helpful.

For those of you who liked this release, keep watching this thread, because I plan to release version 1.1.0 in the next few days.

List of updates/improvements for RealVehicles 1.1.0 (not yet released)
  • Simplified the speedo display, as the display in 1.0.1 is a little excessive, but I won't remove the old display entirely, I will leave the code there so it can still be used, if desired.
  • Added a vehicle stats system. Vehicles will now be handled more like players, and will have their own stats (distance traveled, times died, etc).
  • Added a vehicle stats save/load system. Vehicle stats can now be saved/loaded from an .ini file, so restarting your server does not need to reset the vehicle stats.
  • Added a few more commands.
*update*
  • RE the save/load system, added a command to import vehicles from a csv file, much like grandlarc does.
  • Added a number plate system, all vehicles will now have a unique number plate (which can be customized).
  • Fixed the textdraws to be more efficient
  • Updated the way fuel is calculated - A vehicle can now consume fuel even if there is no player in it (if the engine has been left on, for example).
Reply
#6

Nice
Reply
#7

You made a critical mistake when you made those textdraws any static non-changing textdraws should be normal textdraws and you only need to create one static textdraw for all players any other textdraws that change on a per-player basis should be player textdraws. This script from my count could only work with a maximum of 100 players as you have it coded 20x100 = 2000.

Another thing you should really do is use a command processor like zcmd it will organize your commands a lot of effectively.
Reply
#8

Quote:
Originally Posted by Pottus
Посмотреть сообщение
You made a critical mistake when you made those textdraws any static non-changing textdraws should be normal textdraws and you only need to create one static textdraw for all players any other textdraws that change on a per-player basis should be player textdraws. This script from my count could only work with a maximum of 100 players as you have it coded 20x100 = 2000.

Another thing you should really do is use a command processor like zcmd it will organize your commands a lot of effectively.
Thanks for your comment, this is really good feedback. I was not aware of the textdraws problem, so I will look into it and correct it in my next release.

As for the command processor, I am switching to dcmd.
Reply
#9

dcmd is old as the hills use zcmd or ycmd in fact you should really have YSI for any development you do.

https://github.com/Y-Less/YSI

Command example zcmd/ycmd style:

pawn Код:
CMD:kill(playerid, params[])
{
    SetPlayerHealth(playerid, 0.0);
    SendClientMessage(playerid, 0xFF0000FF, "You killed yourself");
    return 1;
}
Reply
#10

Quote:
Originally Posted by Pottus
Посмотреть сообщение
dcmd is old as the hills use zcmd or ycmd in fact you should really have YSI for any development you do.

https://github.com/Y-Less/YSI

Command example zcmd/ycmd style:

pawn Код:
CMD:kill(playerid, params[])
{
    SetPlayerHealth(playerid, 0.0);
    SendClientMessage(playerid, 0xFF0000FF, "You killed yourself");
    return 1;
}
Actually, I had already implemented dcmd into my code before you mentioned it, however I will take your advice and switch to zcmd (apparently its faster), but that's not a priority, because dcmd already looks a lot more tidy.
Reply
#11

I would suggest just going with the zcmd method since this is what you should really be using for anything you release anyways might as well start
Reply
#12

Quote:
Originally Posted by Pottus
Посмотреть сообщение
I would suggest just going with the zcmd method since this is what you should really be using for anything you release anyways might as well start
Thanks for your comments, your feedback is much appreciated and I will take your suggestions into account Nice server btw
Reply
#13

Update released - realvehicles version 1.1.0

  • Simplified the speedo display, as the display in 1.0.1 is a little excessive, but I won't remove the old display entirely, I will leave the code there so it can still be used, if desired.
  • Added a vehicle stats system. Vehicles will now be handled more like players, and will have their own stats (distance traveled, times died, etc).
  • Added a vehicle stats save/load system. Vehicle stats can now be saved/loaded from an .ini file, so restarting your server does not need to reset the vehicle stats.
  • Added a few more commands.
  • RE the save/load system, added a command to import vehicles from a csv file, much like grandlarc does.
  • Added a number plate system, all vehicles will now have a unique number plate (which can be customized).
  • Fixed those sloppy textdraws to be more efficient (thanks, Pottus!)
  • Updated the way fuel is calculated - A vehicle can now consume fuel even if there is no player in it (if the engine has been left on, for example).
check the new link I added to this thread. Pastebin is no longer available, as my code has become more complicated with the new features.
Reply
#14

The textdraws are still incorrect you need to use player textdraws read about it here.

https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
Reply
#15

Good Job
Reply
#16

Quote:
Originally Posted by Pottus
Посмотреть сообщение
The textdraws are still incorrect you need to use player textdraws read about it here.

https://sampwiki.blast.hk/wiki/CreatePlayerTextDraw
I released the wrong file - "display_adv.inc" should not have been included in the release, because as you pointed out it is not correct.

Here is a corrected version of that file http://pastebin.com/QgRNNB25

EDIT** Sorry people, I'm having a really bad day, that one wasn't correct either, but it should be now
Reply
#17

Quote:
Originally Posted by EnforcerDon
Посмотреть сообщение
I released the wrong file - "display_adv.inc" should not have been included in the release, because as you pointed out it is not correct.

Here is a corrected version of that file http://pastebin.com/QgRNNB25
One more issue.

pawn Код:
new PlayerText:vehStatsDisplayAdvanced_ptxt[12];
This is an issue because depending on how filterscripts are loaded/unloaded it can change the order of textdraw ids which could result in incorrect referencing for players with textdraws already created you need to change this to accommodate each player.

pawn Код:
new PlayerText:vehStatsDisplayAdvanced_ptxt[MAX_PLAYERS][12];
Reply
#18

Quote:
Originally Posted by Pottus
Посмотреть сообщение
One more issue.

pawn Код:
new PlayerText:vehStatsDisplayAdvanced_ptxt[12];
This is an issue because depending on how filterscripts are loaded/unloaded it can change the order of textdraw ids which could result in incorrect referencing for players with textdraws already created you need to change this to accommodate each player.

pawn Код:
new PlayerText:vehStatsDisplayAdvanced_ptxt[MAX_PLAYERS][12];
I see, will fix that too. Thanks for your help, once again!

EDIT** for the (I think third time?), here is the corrected file http://pastebin.com/QgRNNB25. I will do a patch release tonight, because I've fixed a few other bugs as well.
Reply
#19

ITS A VERY NICE FS....

im definitely adding it to my server!!!
Reply
#20

Quote:
Originally Posted by Vishalshetty
Посмотреть сообщение
ITS A VERY NICE FS....

im definitely adding it to my server!!!
Thanks mate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)