1.163
46
1.163
46
Yes, you can absolutely watch TV in any Vehicle - Just Drive Safely
This script will play any valid game or addon TV, whether in the game or spawned by a trainer. It works by prop detection rather than the simplistic and limited approach of hardcoding the coordinates of the target TV. You can move the TV anywhere using the Mafins Menyoo Trainer (I recommend the original version).
This functionality and more can be found in this script as well:
https://www.gta5-mods.com/scripts/ultimate-gta-v-tourist
Change log Version 3 - Minor Update
As requested, the script is enabled by default. L to disable/enable.
Also, the change channels is now Q.
To disable script by default, use the ini file and set DetectOn to false
[Settings]
ToggleKey=L
DetectOn=true
With respect to the request to have notifications on, this is harder than it looks. Most scripters have the detection based on the location of the TV. This limits the value of the script. One option is to create a list of TV props but I'm trying to find a better way using keywords or render target ids.
Change log Version 2 - Major Update
All hard coding has been eliminated except for the channels.
The way the script works now is that if the script detects a compatible TV near the player, that TV prop will respond to the E key (on/off) and the Q key (remote: switch channels).
However currently the only props recognized will have those with tvscreen as the target.
Examples of valid TVs are:
prop_tv_flat_01, prop_tv_flat_02, prop_tv_flat_03
prop_tv_flat_michael
vw_prop_vw_cinema_tv_01
Note: it doesn't matter if the TV is ambient or spawned with a trainer or script, it will respond if the criteria is met: i.e. valid (tvscreen) and within player distance.
Description
Whether you’re chilling at your Vinewood Hills mansion or taking a break at the beach or even driving any vehicle, this script brings the TV entertainment right to your fingertips. That’s right, you can place the TV indoors and outdoors or even attach it to a vehicle. This script, unlike all other TV scripts, is relative to the player, not absolute like a mansion or cinema. Also: this incredibly flexible script is fully immersive by removing the on-screen controls, so you can simply sit back and enjoy.
Installation: the dll and the ini file go in your Scripts folder. Requirements: the usual SHV and SHVDN
Controls: The default key is L to enable or disable. Can be changed in the ini file.
The script detects all valid TVs.
Placement: you can easily move the TV using Menyoo, Object Spooner, Manual Placement. Watch the video.
IMPORTANT
This first release will only support props where the target is tvscreen. How would you know that? You go into Open 4, look at the TV prop’s ydr, you look at the embedded textures, and you might see a texture like this: script_rt_tvscreen.dds. If you drop the prefix, you get tvscreen. Not tv_screen or something else
This script will play any valid game or addon TV, whether in the game or spawned by a trainer. It works by prop detection rather than the simplistic and limited approach of hardcoding the coordinates of the target TV. You can move the TV anywhere using the Mafins Menyoo Trainer (I recommend the original version).
This functionality and more can be found in this script as well:
https://www.gta5-mods.com/scripts/ultimate-gta-v-tourist
Change log Version 3 - Minor Update
As requested, the script is enabled by default. L to disable/enable.
Also, the change channels is now Q.
To disable script by default, use the ini file and set DetectOn to false
[Settings]
ToggleKey=L
DetectOn=true
With respect to the request to have notifications on, this is harder than it looks. Most scripters have the detection based on the location of the TV. This limits the value of the script. One option is to create a list of TV props but I'm trying to find a better way using keywords or render target ids.
Change log Version 2 - Major Update
All hard coding has been eliminated except for the channels.
The way the script works now is that if the script detects a compatible TV near the player, that TV prop will respond to the E key (on/off) and the Q key (remote: switch channels).
However currently the only props recognized will have those with tvscreen as the target.
Examples of valid TVs are:
prop_tv_flat_01, prop_tv_flat_02, prop_tv_flat_03
prop_tv_flat_michael
vw_prop_vw_cinema_tv_01
Note: it doesn't matter if the TV is ambient or spawned with a trainer or script, it will respond if the criteria is met: i.e. valid (tvscreen) and within player distance.
Description
Whether you’re chilling at your Vinewood Hills mansion or taking a break at the beach or even driving any vehicle, this script brings the TV entertainment right to your fingertips. That’s right, you can place the TV indoors and outdoors or even attach it to a vehicle. This script, unlike all other TV scripts, is relative to the player, not absolute like a mansion or cinema. Also: this incredibly flexible script is fully immersive by removing the on-screen controls, so you can simply sit back and enjoy.
Installation: the dll and the ini file go in your Scripts folder. Requirements: the usual SHV and SHVDN
Controls: The default key is L to enable or disable. Can be changed in the ini file.
The script detects all valid TVs.
Placement: you can easily move the TV using Menyoo, Object Spooner, Manual Placement. Watch the video.
IMPORTANT
This first release will only support props where the target is tvscreen. How would you know that? You go into Open 4, look at the TV prop’s ydr, you look at the embedded textures, and you might see a texture like this: script_rt_tvscreen.dds. If you drop the prefix, you get tvscreen. Not tv_screen or something else
Pertama diunggah: Jumat, 24 Januari 2025
Terakhir diperbarui: 6 hari yang lalu
Terakhir Diunduh: 2 jam yang lalu
132 Komentar
More mods by JohnFromGWN:
Yes, you can absolutely watch TV in any Vehicle - Just Drive Safely
This script will play any valid game or addon TV, whether in the game or spawned by a trainer. It works by prop detection rather than the simplistic and limited approach of hardcoding the coordinates of the target TV. You can move the TV anywhere using the Mafins Menyoo Trainer (I recommend the original version).
This functionality and more can be found in this script as well:
https://www.gta5-mods.com/scripts/ultimate-gta-v-tourist
Change log Version 3 - Minor Update
As requested, the script is enabled by default. L to disable/enable.
Also, the change channels is now Q.
To disable script by default, use the ini file and set DetectOn to false
[Settings]
ToggleKey=L
DetectOn=true
With respect to the request to have notifications on, this is harder than it looks. Most scripters have the detection based on the location of the TV. This limits the value of the script. One option is to create a list of TV props but I'm trying to find a better way using keywords or render target ids.
Change log Version 2 - Major Update
All hard coding has been eliminated except for the channels.
The way the script works now is that if the script detects a compatible TV near the player, that TV prop will respond to the E key (on/off) and the Q key (remote: switch channels).
However currently the only props recognized will have those with tvscreen as the target.
Examples of valid TVs are:
prop_tv_flat_01, prop_tv_flat_02, prop_tv_flat_03
prop_tv_flat_michael
vw_prop_vw_cinema_tv_01
Note: it doesn't matter if the TV is ambient or spawned with a trainer or script, it will respond if the criteria is met: i.e. valid (tvscreen) and within player distance.
Description
Whether you’re chilling at your Vinewood Hills mansion or taking a break at the beach or even driving any vehicle, this script brings the TV entertainment right to your fingertips. That’s right, you can place the TV indoors and outdoors or even attach it to a vehicle. This script, unlike all other TV scripts, is relative to the player, not absolute like a mansion or cinema. Also: this incredibly flexible script is fully immersive by removing the on-screen controls, so you can simply sit back and enjoy.
Installation: the dll and the ini file go in your Scripts folder. Requirements: the usual SHV and SHVDN
Controls: The default key is L to enable or disable. Can be changed in the ini file.
The script detects all valid TVs.
Placement: you can easily move the TV using Menyoo, Object Spooner, Manual Placement. Watch the video.
IMPORTANT
This first release will only support props where the target is tvscreen. How would you know that? You go into Open 4, look at the TV prop’s ydr, you look at the embedded textures, and you might see a texture like this: script_rt_tvscreen.dds. If you drop the prefix, you get tvscreen. Not tv_screen or something else
This script will play any valid game or addon TV, whether in the game or spawned by a trainer. It works by prop detection rather than the simplistic and limited approach of hardcoding the coordinates of the target TV. You can move the TV anywhere using the Mafins Menyoo Trainer (I recommend the original version).
This functionality and more can be found in this script as well:
https://www.gta5-mods.com/scripts/ultimate-gta-v-tourist
Change log Version 3 - Minor Update
As requested, the script is enabled by default. L to disable/enable.
Also, the change channels is now Q.
To disable script by default, use the ini file and set DetectOn to false
[Settings]
ToggleKey=L
DetectOn=true
With respect to the request to have notifications on, this is harder than it looks. Most scripters have the detection based on the location of the TV. This limits the value of the script. One option is to create a list of TV props but I'm trying to find a better way using keywords or render target ids.
Change log Version 2 - Major Update
All hard coding has been eliminated except for the channels.
The way the script works now is that if the script detects a compatible TV near the player, that TV prop will respond to the E key (on/off) and the Q key (remote: switch channels).
However currently the only props recognized will have those with tvscreen as the target.
Examples of valid TVs are:
prop_tv_flat_01, prop_tv_flat_02, prop_tv_flat_03
prop_tv_flat_michael
vw_prop_vw_cinema_tv_01
Note: it doesn't matter if the TV is ambient or spawned with a trainer or script, it will respond if the criteria is met: i.e. valid (tvscreen) and within player distance.
Description
Whether you’re chilling at your Vinewood Hills mansion or taking a break at the beach or even driving any vehicle, this script brings the TV entertainment right to your fingertips. That’s right, you can place the TV indoors and outdoors or even attach it to a vehicle. This script, unlike all other TV scripts, is relative to the player, not absolute like a mansion or cinema. Also: this incredibly flexible script is fully immersive by removing the on-screen controls, so you can simply sit back and enjoy.
Installation: the dll and the ini file go in your Scripts folder. Requirements: the usual SHV and SHVDN
Controls: The default key is L to enable or disable. Can be changed in the ini file.
The script detects all valid TVs.
Placement: you can easily move the TV using Menyoo, Object Spooner, Manual Placement. Watch the video.
IMPORTANT
This first release will only support props where the target is tvscreen. How would you know that? You go into Open 4, look at the TV prop’s ydr, you look at the embedded textures, and you might see a texture like this: script_rt_tvscreen.dds. If you drop the prefix, you get tvscreen. Not tv_screen or something else
Pertama diunggah: Jumat, 24 Januari 2025
Terakhir diperbarui: 6 hari yang lalu
Terakhir Diunduh: 2 jam yang lalu
Posted a new video showing further evolution of working with TVs and render targets in Los Santos and San Andreas in general. Will also be testing a new target which might allow using laptops as TVs. Stay Tuned
@JohnFromGWN I think releasing a building handle (fwScriptGuid) with the native RELEASE_SCRIPT_GUID_FROM_ENTITY will solve the pool overflowing issue? Because shape test natives return handles for buildings when they detect them, and because SHV increases the pool capacity to (at least) 3072, but it *may* not be enough for the pool to allocate handles for all buildings along with all peds, vehicles, and props/objects. 3072 is 100% enough for all peds, vehicles, and objects with full capacity if you don't increase any capacities for them too much, though (the pool capacity should be sufficient even with PNWParksFan's gameconfig). And no, using the script with SHVDN v3.6.0 and earlier doesn't really solve the pool overflowing issue.
The script should release a handle with RELEASE_SCRIPT_GUID_FROM_ENTITY when GET_ENTITY_TYPE returns 0. GET_ENTITY_TYPE returns 0 if the CEntity type field (the byte field at `CEntiy + 0x28`) with the handle is not one of the values for vehicle, ped, and object (precisely 3, 4, and 5). I don't really think the script should release handles for peds, vehicles, or objects since some other scripts may make the game create them to use them with native functions, and again 3072 is 100% enough for all physical entities.
@ReNNie
1. Did not like the tone. He farts in the room and just leaves. If he had the read thread he would have seen that I don't try to get handles from any props. Ironically, my other script that identifies peds and vehicles does get handles (obviously) and I've played both scripts without any crashes during testing or gameplay.
2. In all my years here, and thousands of hours doing my own scripting and research, have never seen this native used. When I first started scripting I decompiled the dlls from the legends and once more have never seen this native. Personally I've always used something like this for memory management:
if (vehicle != null && vehicle.Exists())
{
vehicle.MarkAsNoLongerNeeded();
vehicle.Delete();
}
3. It's very hard to fix something that you can't reproduce. During testing of this script I once spawned over 20 TVs without a hiccup and turned them on and off. So can you tell me the steps?
4. Script has been downloaded over 1000 times. Whether unique downloads or not, that should have triggered 1 or 2 other complaints.
Finally, yes, I'll rewrite the script although I can't test it and yes, i'll inlcude the pdb which is generated by VS.
If that doesn't work we remove the script.
@kagikn Hi. Since you're the expert here on SHVDN, as I wrote to @ReNNie, I've never seen this native before used by anyone in the community. Is this issue with ambient entities, spawned entities, or both?
Also why is it that only 1 user has communicated this issue? Why can run this script until the cows come home without a crash?
These are the natives I'm currently using in this script but I will modify the script to use the RELEASE_SCRIPT_GUID_FROM_ENTITY entity although I can't test it because my PC doesn't crash except when I try to spawn huge assets or corrupt ones. Never on a script.
Function.Call(Hash.SET_TEXT_RENDER_ID, RenderID);
Function.Call(Hash.SET_TEXT_RENDER_ID, DefaultRenderID);
Function.Call<bool>(Hash.IS_NAMED_RENDERTARGET_REGISTERED, RendertargetName))
Function.Call(Hash.RELEASE_NAMED_RENDERTARGET, RendertargetName);
Function.Call<bool>(Hash.IS_NAMED_RENDERTARGET_REGISTERED, RendertargetName))
Function.Call(Hash.REGISTER_NAMED_RENDERTARGET, RendertargetName, false);
Function.Call<bool>(Hash.IS_NAMED_RENDERTARGET_LINKED, TVx)
Function.Call(Hash.LINK_NAMED_RENDERTARGET, TVx)
@ReNNie Will try this and test it later. I'm not going to delete the prop, because that would be ok for spawned props but would likely cause problems for an ambient prop.
if (!isTVPropDetected && previousProp != null)
{
RELEASE_SCRIPT_GUID_FROM_ENTITY(previousProp);
}
if (!isTVPropDetected)
{
detectedProp = null; // No valid prop detected
}
@ReNNie. Can you outline the steps or events taken that lead to your crash. I will make the changes you requested but I have no idea what leads to the crash. The pool idea, in my opinion is BS, because my old PC, intentionally capped at 60 FPS with vsynch, can easily handle multiple TVs without flinching. I even tested with the game bar and the GPU % was constant. All that to say I need more info. I added a video to show I'm not joking. When I do my initial scripting, I stress test. I remember having at least 30 TVs on. Anyway, take a look at the video when you have a chance.
@kagikn I did further testing which supports your statements. Thank you for your clarification. I'm guessing @ReNNie's issue might be a conflict with another script. It's hard to write scripts that will work in Steam, Epic, Retail, etc and with reverted copies of GTA5.exe as well all different hardware, OS config, drivers etc.
However this new video supports your comments that RELEASE_SCRIPT_GUID_FROM_ENTITY applies to buildings.
You'll note in the video, aside from stability, that the GPU isn't impacted. Should mention that I wrote this script with a 2070 and 8gb of VRAM (32 of system RAM) although my new card, used here is at 16gb. Either way, the 3072 is the determining factor in this discussion:
https://www.youtube.com/watch?v=952YBxk2Kwk
Getting back to @ReNNie, the steps to reproduce his issue are required. Assuming Scripts folder is renamed and only this script is run to eliminate script conflicts.
@JohnFromGWN We have all been scripting without using that native for years. Its only recently that it was brought to light that we have to free these handles. It indeed works just fine without it... until it doesn't. And yes, as Kagikn mentioned, raycasts create these handles as well. I should have mentioned that.
As far as steps to reproduce, you're probably best off just working closely with the person who has the issue. You're extremely unlikely to get this to happen on your machine. There's a reason we've not known to free handles for an entire decade, afterall.
Regarding my "tone": Text doesn't have a tone. The way you read it does. Just stop expecting hostility when reading things. Personally, I don't care if your script works or not as I'll never use it myself (I have no need). I just have a friend who likes it but cannot use it so I'm trying to help you. *Farts and leaves*
@JohnFromGWN I'm sure the answer is no, but if you have Discord please join the 5-Mods Discord server and we can better help you there rather than flooding the comments section of your mod page.
https://discord.gg/6CPK6b6e
@InfamousSabre Right about that. Arguing who is wrong and who is right? No thank you. Unless I'm misinterpreting @kagikn, your comments, which weren't presented at suggestions btw, aren't pertinent to this script.
2. I will definitely help your friend, but I need more information because remote troubleshooting is nasty and inefficient. On site, I would identify the issue quickly by the process of elimination. First step is to eliminate all scripts (dll, lua, asi, whatever) except the essential ones. This is to rule out script conflicts. Next we need the exact conditions - the steps to reproduce the issue systematically and hopefully consistently.
3. I've uploaded 2 videos that clearly emphasize the difference between theory and practice. Even with my modest rtx2070 the script supported significantly more than what users will require - which is one or two TVs. The last video shows multiple videos and stablity. Again, how many other users have this issue? If we can find common grounds, we're half way there.
4. As for tone, well that's subject to interpretation. When someone uploads mods, on their time, after significant coding and testing, and never asks for money or patronage...well it's not hard to feel offended when accused of crashing games with a script. Particularly based on theory that has been debunked. Videos uploaded as proof. Comments that were totally unfounded yet, once more, presented as fact. Maybe next time use “Is it possible that….”, Instead of “it broke because you are using…”.
In passing, my first experiences with Discord (i.e. Toxic Discord), as a complete noob, were so discouraging that I took a different path. Self taught and self sufficient for the most part.
@InfamousSabre Just as an edit, and further to @kagikn's summary. You'll find my natives in the thread above. As you can see I don't use any shape testing natives.
@JohnFromGWN I should point out that this cannot be caused by script conflict but rather it is caused by a collection of scripts all not releasing their handles. If you'd like, I can find the issue quickly for you, or find that your script isn't causing the issue if that ends up being the case. If you post the source on Github, Gitlab, or heck even Pastebin I wouldn't mind giving it a look for you. No money or patronage required. 100% free assistance.
@JohnFromGWN Those aren't all the functions you're using even if you aren't aware of it. This is clear to me by the fact that you have a prop's handle, "previousProp". You got that handle somehow. Either by using a native function directly or by using a SHVDN function that calls its own functions behind-the-scenes
@InfamousSabre The previous prop is not part of the script that is uploaded here. It was just some pseudo code. Here is a summary of the situation based on my understanding which i admit is not perfectly clear. What I don't understand is why you refuse to acknowledge that the script is rock solid based on the last 2 videos i uploaded. You think I faked those?
Since we don’t have forums anymore, and discord doesn’t document anything in a useful form, just thought I would attempt to post some clarifications on the discussion below regarding how this script works.
Essentially the script works similarly to the closest prop method. If the player is within a prescribed distance of the prop it will be detected. However the script doesn’t know if the script is a TV or not. The good news is that the user does. The user knows what a TV is and he/she can activate the TV by pressing the E key. Of course if the TV isn’t a valid game TV, nothing will happen.
This is very different from what is known as shape testing, which in its simplest form is checking if something is in front of you or whatever, or line of sight - meaning you can see the target and it can see you, its not behind a wall, or something. A raycast, shoots out a straight line, and it returns what it hits, the name of the asset and its position. Thankfully raycasts are easy on memory and you can use thousands of them.
So if this script doesn’t use shape testing, instead it detects props (objects), how does it turn on the TV? Well that’s done through a process called render target. This means the prop is a valid TV and it has a texture that display the content.
Ok great, so what’s all this discussion about RELEASE_SCRIPT_GUID_FROM_ENTITY? Well unfortunately this “native function” is not well documented. The description is as follows: invalidates the entity handle passed by removing the fwScriptGuid from the entity. This should be used when receiving an ambient entity from shape testing natives, but can also be used for other natives returning an 'irrelevant' entity handle.
And how does this apply to our script? Not sure. The script definitely does not use shape testing natives. Furthermore, the script has been tested extensively with over 20 or more spawned TVs without any stability issues. It works with ambient TVs as well and of course ambient TVs are sparse in GTA V.
Our SHVDN expert expressed that this RELEASE_SCRIPT_GUID_FROM_ENTITY would only be relevant to buildings rather than the other entities: peds, vehicles, and objects (props).
Summary: at this point we don’t really know if this native function plays any role in a script like this one.
@InfamousSabre "I should point out that this cannot be caused by script conflict but rather it is caused by a collection of scripts all not releasing their handles"
That's the definition of a script conflict.
@JohnFromGWN "That's the definition of a script conflict."
No, it isn't.
Oh! I just remembered I don't need to ask you for the source. Yes, you ARE getting all prop handles. Yes, your script DOES identify props. Here: https://pastebin.com/xS7EBNzd
This should get you moving in the right direction! If you have any further questions or concerns just let me know
@JohnFromGWN I'm quite sorry for thinking the script used shape testing natives without looking at the (decompiled) code.
Speaking of RELEASE_SCRIPT_GUID_FROM_ENTITY, it can release/delete any GUID handles with ambient entities from the handle pool, precisely ones where the assosiated CEntity instnances don't have CScriptEntityExtension instances. It does nothing otherwise, but you can test the result by calling Entity.Exists on the SHVDN Entity or DOES_ENTITY_EXIST before and after the GUID releasing native if you want. Since SHVDN's `GetAll*s`, `GetNearby*s`, and `GetClosest*` methods in the World class create new GUID handles if the found CEntity instances don't have ones, you may also release ambient objects of what one of the methods collected. I think of a potential problem with RELEASE_SCRIPT_GUID_FROM_ENTITY though, that some scripts may fail to identify ambient objects with their cache variables after calling it since handles aren't isolated within a script, precisely a GtaThread instance, where SHVDN uses the same one for all SHVDN scripts. It would be better to raise the handle pool capacity to more than 3072 before the game create the pool for that reason, but I'm not aware of any scripts that raise it. Since the script filters out objects where the distance between it and the player is 4 meters or more, you could replace GetAllProps with GetNearbyProps first so the script won't create handles for objects too far from the player?
@kagikn Not a script exactly, but SHV itself raises the pool I believe. Speaking of SHVDN using the same GUID's for all SHVDN scripts, I don't think SHV has that limitation. Does it? If it is only a SHVDN problem, I'd suggest making a "Release()" function for props that just adds that prop's handle to a list and then have SHVDN itself release them all after all scripts have finished their tick. Hopefully that makes sense.
I'd like to deeply and with repent apologize to you @JohnFromGWN
I had some time testing this morning, early up before dawn
the errors on my end have nothing to do with this script :/
(or any other for that matter it would seem, at least not as such) but as SHVDN threw me the fwscriptpool error I only thought of that route...
I noticed after longer and more patiently testing this issue only occurs on my MLO-infested game and not on my regular modded one (they use a shared scripts folder)
so I started disabling recent things in dlclist, more specifically YMAPS and others add-ons that load in many props ... and voila, no issue so far it seems
the shame is real
so once again, let me say sorry to you and tag me if you want this comments section cleaned up?
And due to my proposed code changes having the potential to cause issues with other SHVDN scripts according to this new info from kagikn, I now don't suggest using that native directly. Instead, SHVDN devs would need to add functionality to remove those guids due to how SHVDN works. Whether they feel this is worth their time is up to them though.
@InfamousSabre SHV itself raises the pool (to 3072), yes, as I mentioned in the first reply to JohnFromGWN. Speaking of GUIDs, any scripts including ysc and SHV ones can suffer the pool overflowing issue if they want to create one by creating mission entities or using SHV's `worldGetAll*s` functions or SHVDN's `Get*s` methods when the pool is full. I'm not sure how the game will get broken by overflowing on that condition, but the game wouldn't be able to return an appropriate GUID. Also, calling RELEASE_SCRIPT_GUID_FROM_ENTITY can affect not only SHVDN scripts but also SHV scripts that aren't for SHVDN since every script can identify a entity with the same handle as long as it's not deleted. These are some of the reasons why I think raising the pool limit would be better (by patching the SHV or whatever). Maybe using the Building Wallhack of Zolika1351's Trainer can help you see how the game can broke along with scripts that query a lot of entities even without SHVDN one?
It is a fact that every SHVDN scripts uses the same script handler (CGameScriptHandler) because of how SHV provides ones, so any SHVDN scripts can mess with script resources freely such as entities of another SHVDN script, but that's another story.