AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Light on func_targer model entity (https://forums.alliedmods.net/showthread.php?t=294393)

DarthMan 02-26-2017 05:21

Light on func_targer model entity
 
Hello. For the info_target entity, how can I make the model to be brighter ?
I mean that after the task is executed, the model should be brighter than it was before.
The entity uses a variable ent_info_target so it should look for that 1 and set the light.

Code:

entity_set_model(ent_info_target, model_path)
This code sets the model of the entity, and the model_path is defined to look for the map name and set the model according to the name of the map but I failed at making it brighter on task execution.
Thanks !

georgik57 02-26-2017 05:50

Re: Light on func_targer model entity
 
1 Attachment(s)
Not sure if this will help, but here u go:
Code:
#include <amxmodx> #include <fakemeta> //#include <hamsandwich> //#include <D7Debug> public plugin_init() {     register_plugin("D7 Render Entities Map", "0.0.5", "D i 5 7 i n c T")         set_pev(0, pev_rendermode, kRenderTransTexture);     set_pev(0, pev_renderamt, 128.0)         new iIDEnt = -1, iSzLenght;         while ((iIDEnt = engfunc(EngFunc_FindEntityInSphere, iIDEnt, Float:{ 0.0, 0.0, 0.0 }, 9000.0)) != 0)     {         if (!pev_valid(iIDEnt))             continue;                 static szEntInfo[32];         pev(iIDEnt, pev_classname, szEntInfo, charsmax(szEntInfo))                 //ftD7Log(_, _, "[plugin_init] iIDEnt: %d. Class name: ^"%s^".", iIDEnt, szEntInfo)                 pev(iIDEnt, pev_model, szEntInfo, charsmax(szEntInfo))                 //ftD7Log(_, _, "[plugin_init] iIDEnt: %d. Model: ^"%s^".^n", iIDEnt, szEntInfo)                 if (szEntInfo[0] != '*')         {             iSzLenght = strlen(szEntInfo);                         if (iSzLenght < 4)                 continue;                         if (equali(szEntInfo[iSzLenght - 4], ".mdl"))             {                 set_pev(iIDEnt, pev_rendermode, kRenderNormal)                 set_pev(iIDEnt, pev_renderfx, kRenderFxGlowShell)                 set_pev(iIDEnt, pev_rendercolor, Float:{ 255.0, 255.0, 255.0 })                 set_pev(iIDEnt, pev_renderamt, 15.0)             }             else if (equali(szEntInfo[iSzLenght - 4], ".spr"))             {                 set_pev(iIDEnt, pev_renderamt, 191.0)             }         }         else         {             set_pev(iIDEnt, pev_rendermode, kRenderTransTexture);             set_pev(iIDEnt, pev_renderamt, 128.0)         }     } }

edon1337 02-26-2017 05:52

Re: Light on func_targer model entity
 
Quote:

Originally Posted by georgik57 (Post 2498637)
Not sure if this will help, but here u go:
Code:
#include <amxmodx> #include <fakemeta> //#include <hamsandwich> //#include <D7Debug> public plugin_init() {     register_plugin("D7 Render Entities Map", "0.0.5", "D i 5 7 i n c T")         set_pev(0, pev_rendermode, kRenderTransTexture);     set_pev(0, pev_renderamt, 128.0)         new iIDEnt = -1, iSzLenght;         while ((iIDEnt = engfunc(EngFunc_FindEntityInSphere, iIDEnt, Float:{ 0.0, 0.0, 0.0 }, 9000.0)) != 0)     {         if (!pev_valid(iIDEnt))             continue;                 static szEntInfo[32];         pev(iIDEnt, pev_classname, szEntInfo, charsmax(szEntInfo))                 //ftD7Log(_, _, "[plugin_init] iIDEnt: %d. Class name: ^"%s^".", iIDEnt, szEntInfo)                 pev(iIDEnt, pev_model, szEntInfo, charsmax(szEntInfo))                 //ftD7Log(_, _, "[plugin_init] iIDEnt: %d. Model: ^"%s^".^n", iIDEnt, szEntInfo)                 if (szEntInfo[0] != '*')         {             iSzLenght = strlen(szEntInfo);                         if (iSzLenght < 4)                 continue;                         if (equali(szEntInfo[iSzLenght - 4], ".mdl"))             {                 set_pev(iIDEnt, pev_rendermode, kRenderNormal)                 set_pev(iIDEnt, pev_renderfx, kRenderFxGlowShell)                 set_pev(iIDEnt, pev_rendercolor, Float:{ 255.0, 255.0, 255.0 })                 set_pev(iIDEnt, pev_renderamt, 15.0)             }             else if (equali(szEntInfo[iSzLenght - 4], ".spr"))             {                 set_pev(iIDEnt, pev_renderamt, 191.0)             }         }         else         {             set_pev(iIDEnt, pev_rendermode, kRenderTransTexture);             set_pev(iIDEnt, pev_renderamt, 128.0)         }     } }

Declare iIDEnt as static.

DarthMan 02-26-2017 06:26

Re: Light on func_targer model entity
 
Quote:

Originally Posted by georgik57 (Post 2498637)
Not sure if this will help, but here u go:
Code:
#include <amxmodx> #include <fakemeta> //#include <hamsandwich> //#include <D7Debug> public plugin_init() {     register_plugin("D7 Render Entities Map", "0.0.5", "D i 5 7 i n c T")         set_pev(0, pev_rendermode, kRenderTransTexture);     set_pev(0, pev_renderamt, 128.0)         new iIDEnt = -1, iSzLenght;         while ((iIDEnt = engfunc(EngFunc_FindEntityInSphere, iIDEnt, Float:{ 0.0, 0.0, 0.0 }, 9000.0)) != 0)     {         if (!pev_valid(iIDEnt))             continue;                 static szEntInfo[32];         pev(iIDEnt, pev_classname, szEntInfo, charsmax(szEntInfo))                 //ftD7Log(_, _, "[plugin_init] iIDEnt: %d. Class name: ^"%s^".", iIDEnt, szEntInfo)                 pev(iIDEnt, pev_model, szEntInfo, charsmax(szEntInfo))                 //ftD7Log(_, _, "[plugin_init] iIDEnt: %d. Model: ^"%s^".^n", iIDEnt, szEntInfo)                 if (szEntInfo[0] != '*')         {             iSzLenght = strlen(szEntInfo);                         if (iSzLenght < 4)                 continue;                         if (equali(szEntInfo[iSzLenght - 4], ".mdl"))             {                 set_pev(iIDEnt, pev_rendermode, kRenderNormal)                 set_pev(iIDEnt, pev_renderfx, kRenderFxGlowShell)                 set_pev(iIDEnt, pev_rendercolor, Float:{ 255.0, 255.0, 255.0 })                 set_pev(iIDEnt, pev_renderamt, 15.0)             }             else if (equali(szEntInfo[iSzLenght - 4], ".spr"))             {                 set_pev(iIDEnt, pev_renderamt, 191.0)             }         }         else         {             set_pev(iIDEnt, pev_rendermode, kRenderTransTexture);             set_pev(iIDEnt, pev_renderamt, 128.0)         }     } }

It doesn't work fine, should find every info_target entities only and make them brighter.
What it does now is that it shows white colors brighted 100% for a few secs, they dissapear and appear on other places. It should light every single info_target entity constantly and u should see the entity not a white background image. Also i don't want the image color to glow, i want it to be static.

HamletEagle 02-26-2017 06:38

Re: Light on func_targer model entity
 
Quote:

Originally Posted by edon1337 (Post 2498638)
Declare iIDEnt as static.

Why?

georgik57 02-26-2017 07:02

Re: Light on func_targer model entity
 
Quote:

Originally Posted by DarthMan (Post 2498647)
It doesn't work fine, should find every info_target entities only and make them brighter.
What it does now is that it shows white colors brighted 100% for a few secs, they dissapear and appear on other places. It should light every single info_target entity constantly and u should see the entity not a white background image. Also i don't want the image color to glow, i want it to be static.

I didn't say it does exactly what you want. I gave it to you as an example.

edon1337 02-26-2017 07:10

Re: Light on func_targer model entity
 
Quote:

Originally Posted by HamletEagle (Post 2498650)
Why?

Because of the while loop?

HamletEagle 02-26-2017 07:43

Re: Light on func_targer model entity
 
Is iIDEnt declared in the loop? No.

edon1337 02-26-2017 07:46

Re: Light on func_targer model entity
 
Quote:

Originally Posted by HamletEagle (Post 2498667)
Is iIDEnt declared in the loop? No.

But it's used in the loop, so it will be called until loop returns true.

Arkshine 02-26-2017 08:29

Re: Light on func_targer model entity
 
You're misunderstanding the purpose of "static". It means just that unlike 'new', the variable is not initialized and the value will remain after the function is executed.
You don't need that in the current context.

You can read the Pawn Language Guide about static local declaration

http://i.imgur.com/WtEweoo.png:


All times are GMT -4. The time now is 20:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.