kopalov / GTAV-SH-Mod

The Savehouse Mod for GTA V
9 stars 4 forks source link

Test TV activation. #65

Open kopalov opened 9 years ago

kopalov commented 9 years ago

Code I got from BenBaron: //////set everything up/////////Object tv = OBJECT::CREATE_OBJECT(0x557C7587, 0, 0, 0, 1, 1, 0);GRAPHICS::ATTACH_TV_AUDIO_TO_ENTITY(tv);if (!UI::IS_NAMED_RENDERTARGET_REGISTERED("tvscreen")){ UI::REGISTER_NAMED_RENDERTARGET("tvscreen", 0);}int rendertargetid;if (!UI::IS_NAMED_RENDERTARGET_LINKED(ENTITY::GET_ENTITY_MODEL(tv))){ UI::LINK_NAMED_RENDERTARGET(ENTITY::GET_ENTITY_MODEL(tv)); rendertargetid = UI::GET_NAMED_RENDERTARGET_RENDER_ID("tvscreen");}////////////to change channel and volume///////////////GRAPHICS::SET_TV_CHANNEL(tv_channel); // tv_channel = 0 or 1;GRAPHICS::SET_TV_VOLUME(tv_volume); // tv_volume = float in range from -22.5 till 0////////////draw the tv (needs to be called every tick, if the tv has been switched on by the user!)/////////////////if (!ENTITY::HAS_ENTITY_BEEN_DAMAGED_BY_ANY_PED(tv)){ UI::SET_TEXT_RENDER_ID(rendertargetid); GRAPHICS::DRAW_TV_CHANNEL(0.5f, 0.5f, 1, 1, 0, 255, 255, 255, tv_bright); // tv_bright in range from 0 to 255
UI::SET_TEXT_RENDER_ID(UI::GET_DEFAULT_SCRIPT_RENDERTARGET_RENDER_ID());}//////deinitialization//////if (UI::IS_NAMED_RENDERTARGET_REGISTERED("tvscreen")){ UI::RELEASE_NAMED_RENDERTARGET("tvscreen");}

qiangqiang101 commented 9 years ago

its not working

qiangqiang101 commented 9 years ago

//////Code I got from BenBaron: //////set everything up///////// Object tv = OBJECT::CREATE_OBJECT(0x557C7587, 0, 0, 0, 1, 1, 0); GRAPHICS::ATTACH_TV_AUDIO_TO_ENTITY(tv); if (!UI::IS_NAMED_RENDERTARGET_REGISTERED("tvscreen")) { UI::REGISTER_NAMED_RENDERTARGET("tvscreen", 0); }

int rendertargetid; if (!UI::IS_NAMED_RENDERTARGET_LINKED(ENTITY::GET_ENTITY_MODEL(tv))) { UI::LINK_NAMED_RENDERTARGET(ENTITY::GET_ENTITY_MODEL(tv)); rendertargetid = UI::GET_NAMED_RENDERTARGET_RENDER_ID("tvscreen"); }

////////////to change channel and volume/////////////// GRAPHICS::SET_TV_CHANNEL(tv_channel); // tv_channel = 0 or 1; GRAPHICS::SET_TV_VOLUME(tv_volume); // tv_volume = float in range from -22.5 till 0

////////////draw the tv (needs to be called every tick, if the tv has been switched on by the user!)///////////////// if (!ENTITY::HAS_ENTITY_BEEN_DAMAGED_BY_ANY_PED(tv)) { UI::SET_TEXT_RENDER_ID(rendertargetid); GRAPHICS::DRAW_TV_CHANNEL(0.5f, 0.5f, 1, 1, 0, 255, 255, 255, tv_bright); // tv_bright in range from 0 to 255 UI::SET_TEXT_RENDER_ID(UI::GET_DEFAULT_SCRIPT_RENDERTARGET_RENDER_ID()); } //////deinitialization////// if (UI::IS_NAMED_RENDERTARGET_REGISTERED("tvscreen")) { UI::RELEASE_NAMED_RENDERTARGET("tvscreen"); }

kopalov commented 8 years ago

Moving to C# branch for future testing. No idea how to implement this for now.

qiangqiang101 commented 8 years ago

I got it working :)