[Include] vSync - OnVehicleChangePaintjob, OnVehicleRespray, GetVehicleInterior, GetVehicleNumberPlate, Pay 'n' Spray fix, etc.
#1

vSync v0.03


[*] Introduction
Hello, as some of you know, I'm working on a racing gamemode so I've been working with vehicle functions a little bit. I came out with this small include, it syncs random colors, fixes some bugs but also adds some new features. I know this isn't a big deal, usually I share my small scripts. I might say I wrote this from scratch according to my needs, but many thanks to MP2 because this include is based on vFunc and I used some colors data I found there. Over time I added new things and bug fixes and it turned into what it is.


[*] Videos

[*] Bug fixes
  • No more desynchronized vehicle colors when using -1 for the color parameters.
  • Players won't collide anymore if they enter at once inside a mod shop.
  • OnVehicleRespray isn't called anymore when you exit a mod shop if the colors didn't change.
  • OnVehicleRespray isn't called anymore when a component is previewed inside a mod shop.
  • Now the Firetruck (ladder variant) has the addsiren parameter set to true by default.
  • Vehicles won't change their color to white anymore when a paintjob is removed.
  • Bullbar components won't use anymore the same slots as front/rear bumpers (GetVehicleComponentInSlot).
  • Now GetVehicleComponentInSlot works correctly when checking the CARMODTYPE_STEREO slot.
  • Players won't crash anymore if someone tries to add an invalid component to a vehicle. v0.03
[*] New features
  • Now Pay 'n' Spray shops apply random colors and call OnVehicleRespray.
  • Now ChangeVehicleColor applies random colors when using -1 for the color parameters.
  • When using random colors, vehicles get their own colors, those used single player.
  • Two new vehicle component slots: CARMODTYPE_FRONT_BULLBAR, CARMODTYPE_REAR_BULLBAR. Check "Modified Functions" in the documentation.
  • Neon lights related functions (with offsets for all vehicles and Streamer support).
  • New functions and callbacks (check the documentation section). v0.03
[*] Download
Get your ALS or YSI version now from GitHub!

If you don't know what YSI is or if you're not using it, just get the ALS one. The YSI version uses y_bit, y_hooks and y_iterate. Include this script after Incognito's Streamer if you're using it, that way the neon objects will be streamed objects instead of standard ones.


[*] Documentation
Feel free to check the documentation in order to know how the new functions work, make sure you don't miss the Notes section.


[*] Other
Thank you for reading my thread, if you want to support what I do you might buy me a coffe! Join to my Discord server if you want to follow the development of my gamemode.

If you find any bug, please let me know.

Best regards.
Reply
#2

Useful and not useful
3 stars you could improve it with new funcs etc
Reply
#3

I suggest you to change vSync_gVehDefaultColors structure to:
Code:
{ number_of_colors, color1, color2 ... }
So you won't have to loop through all colors everytime when -1 is passed to CreateVehicle and equivalents

Code:
new rand_col = 1 + random(vSync_gVehDefaultColors[modelid - 400][0]);
Reply
#4

another awesome release.
Reply
#5

this include is pre-built.
Reply
#6

Nice work I like to see what you are doing nice work

+rep11
Reply
#7

Well done, R2D.
Reply
#8

Now I am gonna ride 2 day in my server with this new include. +Rep
Reply
#9

Really liked it, another amazing script
Reply
#10

are you sure 1123 and 1125 are front bullbars?

I swear they were rear
Reply
#11

Quote:
Originally Posted by Kar
Посмотреть сообщение
are you sure 1123 and 1125 are front bullbars?

I swear they were rear
Nice find, yes, 1125 affects the back side also. Even so, Remington's bullbars use the same "GTA slot", so we can't use two of those three components (1100, 1123, 1125) at once. For example, if 1125 is installed and we add 1100 the 1125 one would be removed automatically, that's just how GTA works.

In my opinion, in terms of programming, it wouldn't make too much sense to add 1125 to both slots (front and rear) because they would store the same component. And the rear slot should be cleared also whenever the front fullbar changes, just unuseful code in my opinion.
Reply
#12

GetVehicleWeihht should be GetVehicleMass because weight is dynamic (mass + passengers weight).

Quote:

from samp wiki (OnVehicleRespray)

Watch out, the name is ambiguous, Pay 'n' Spray shops don't call this callback.

You have to implement a detection method for this, probably under OnPlayerUpdate. I did this in vehicleplus.inc if i am not mistaken.
Reply
#13

Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
Nice find, yes, 1125 affects the back side also. Even so, Remington's bullbars use the same "GTA slot", so we can't use two of those three components (1100, 1123, 1125) at once. For example, if 1125 is installed and we add 1100 the 1125 one would be removed automatically, that's just how GTA works.

In my opinion, in terms of programming, it wouldn't make too much sense to add 1125 to both slots (front and rear) because they would store the same component. And the rear slot should be cleared also whenever the front fullbar changes, just unuseful code in my opinion.
Well we found the issues and sorted it.

Great stuff to know.
Reply
#14

Quote:
Originally Posted by Gammix
Посмотреть сообщение
GetVehicleWeihht should be GetVehicleMass because weight is dynamic (mass + passengers weight).


You have to implement a detection method for this, probably under OnPlayerUpdate. I did this in vehicleplus.inc if i am not mistaken.
You're totally right about the weight issue, I'm going to change it. The funny fact is that I used "mass" as variable name! On the other hand, this include calls OnVehicleRespray when Pay 'n' Spray shops are used and applies random colors also.

Thanks for pointing that out.
Reply
#15

Quote:
Originally Posted by RIDE2DAY
Посмотреть сообщение
You're totally right about the weight issue, I'm going to change it. The funny fact is that I used "mass" as variable name! On the other hand, this include calls OnVehicleRespray when Pay 'n' Spray shops are used and applies random colors also.

Thanks for pointing that out.
Oh i see it now, you had the OnPlayerUpdate part for OnVehicleRespray already. I use my phone most of the time when i am at work so yeah, i missed that part lol!


EDIT: Another thing, instead of using "CallLocalFunction", call the function directly in case of custom functions, since defualt samp ones like "OnVehicleRespray" are declared no matter you define them (public) or not.

Example:
PHP код:
// replace this
CallLocalFunction("OnVehicleCreated""i"vehicleid);
// to
#if defined OnVehicleCreated
    
OnVehicleCreated(vehicleid);
#endif
// and for decleration
#if defined OnVehicleCreated
    
forward OnVehicleCreated(vehicleid);
#endif 
Reply
#16

wow cool
Reply
#17

Frumoasa melodia din video
Reply
#18

There is expression bug in AddVehicleComponent


fix it =)
Reply
#19

@~Error: thank you for reporting that, fixed.
Reply
#20

OnVehicleDestroyed would be nice.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)