AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved [ H3LP ] Light Issue (https://forums.alliedmods.net/showthread.php?t=299184)

DarthMan 07-06-2017 08:40

[ H3LP ] Light Issue
 
Hello. So I am trying to light an entity without adding lights outside of it. Everytime I execute this the server crashes. Any ideas? I can confirm that the entity is valid.

Code:
public lights_task(ent) {     static Float:origin[3];     static iOrigin[3];         pev(ent, pev_origin, origin)         FVecIVec(origin, iOrigin)         message_begin( MSG_BROADCAST, SVC_TEMPENTITY );     write_byte(TE_ELIGHT)     write_coord(iOrigin[0]); // x     write_coord(iOrigin[1]); // y     write_coord(iOrigin[2]); // z     write_coord(50); // radius     write_byte(255); // r     write_byte(0); // g     write_byte(0); // b     write_byte(25); // life <<<<<<<<     write_coord(0); // decay rate     message_end()     set_task(1.0, "lights_task", ent) }

SpawnerF 07-06-2017 10:20

Re: [ H3LP ] Light Issue
 
Looking at this
Code:
 // Teh_Freak: Entity Lighting!      MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );           WRITE_BYTE( TE_ELIGHT );           WRITE_SHORT( entindex( ) );     // entity, attachment           WRITE_COORD( pev->origin.x );     // origin           WRITE_COORD( pev->origin.y );           WRITE_COORD( pev->origin.z );           WRITE_COORD( 8 );     // radius           WRITE_BYTE( 255 );     // R           WRITE_BYTE( 192 );     // G           WRITE_BYTE( 64 );     // B           WRITE_BYTE( 2 );     // life * 10           WRITE_COORD( 0 ); // decay      MESSAGE_END();      // Teh_Freak: Entity Lighting!

or

Code:
stock Create_TE_ELIGHT(entity, start[3], radius, red, green, blue, life, decayRate){     message_begin( MSG_BROADCAST, SVC_TEMPENTITY )     write_byte( TE_ELIGHT )     write_short( entity )           // entity     write_coord( start[0] )         // initial position     write_coord( start[1] )         // initial position     write_coord( start[2] )         // initial position     write_coord( radius )           // radius     write_byte( red )               // red     write_byte( green )             // green     write_byte( blue )              // blue     write_byte( life )              // life     write_coord( decayRate )        // decay rate     message_end() }

You didn't add
Code:
write_short( entity )

http://twhl.info/articulator.php?art=167

Spoiler


which is the entity index also adding set_task make no sense, you already write things to the entity ...

DarthMan 07-06-2017 10:34

Re: [ H3LP ] Light Issue
 
Quote:

Originally Posted by SpawnerF (Post 2533733)
Looking at this
Code:
 // Teh_Freak: Entity Lighting!      MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );           WRITE_BYTE( TE_ELIGHT );           WRITE_SHORT( entindex( ) );     // entity, attachment           WRITE_COORD( pev->origin.x );     // origin           WRITE_COORD( pev->origin.y );           WRITE_COORD( pev->origin.z );           WRITE_COORD( 8 );     // radius           WRITE_BYTE( 255 );     // R           WRITE_BYTE( 192 );     // G           WRITE_BYTE( 64 );     // B           WRITE_BYTE( 2 );     // life * 10           WRITE_COORD( 0 ); // decay      MESSAGE_END();      // Teh_Freak: Entity Lighting!

or

Code:
stock Create_TE_ELIGHT(entity, start[3], radius, red, green, blue, life, decayRate){     message_begin( MSG_BROADCAST, SVC_TEMPENTITY )     write_byte( TE_ELIGHT )     write_short( entity )           // entity     write_coord( start[0] )         // initial position     write_coord( start[1] )         // initial position     write_coord( start[2] )         // initial position     write_coord( radius )           // radius     write_byte( red )               // red     write_byte( green )             // green     write_byte( blue )              // blue     write_byte( life )              // life     write_coord( decayRate )        // decay rate     message_end() }

You didn't add
Code:
write_short( entity )

http://twhl.info/articulator.php?art=167

Spoiler


which is the entity index also adding set_task make no sense, you already write things to the entity ...

No, I read somewhere that in the recent updates, after SteamPipe, Valve removed that write short parameter, so that's why I did not use it, but I tried both ways and even with DLIGHT without the parameter and it still crashed the server.

"The WRITE_SHORT is no longer used, it is used by TE_ELIGHTs (entity lights), but Valve removed it. If you do use it, the DLL will compile fine, but an error will pop up in-game saying its an illegal message. So to put it basically, DONT USE IT." on http://twhl.info/articulator.php?art=167

DarthMan 07-06-2017 10:55

Re: [ H3LP ] Light Issue
 
Quote:

Originally Posted by SpawnerF (Post 2533733)
Looking at this
Code:
 // Teh_Freak: Entity Lighting!      MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );           WRITE_BYTE( TE_ELIGHT );           WRITE_SHORT( entindex( ) );     // entity, attachment           WRITE_COORD( pev->origin.x );     // origin           WRITE_COORD( pev->origin.y );           WRITE_COORD( pev->origin.z );           WRITE_COORD( 8 );     // radius           WRITE_BYTE( 255 );     // R           WRITE_BYTE( 192 );     // G           WRITE_BYTE( 64 );     // B           WRITE_BYTE( 2 );     // life * 10           WRITE_COORD( 0 ); // decay      MESSAGE_END();      // Teh_Freak: Entity Lighting!

or

Code:
stock Create_TE_ELIGHT(entity, start[3], radius, red, green, blue, life, decayRate){     message_begin( MSG_BROADCAST, SVC_TEMPENTITY )     write_byte( TE_ELIGHT )     write_short( entity )           // entity     write_coord( start[0] )         // initial position     write_coord( start[1] )         // initial position     write_coord( start[2] )         // initial position     write_coord( radius )           // radius     write_byte( red )               // red     write_byte( green )             // green     write_byte( blue )              // blue     write_byte( life )              // life     write_coord( decayRate )        // decay rate     message_end() }

You didn't add
Code:
write_short( entity )

http://twhl.info/articulator.php?art=167

Spoiler


which is the entity index also adding set_task make no sense, you already write things to the entity ...

I updated my amxx 1.8.3.5120 to latest 1.8.3.5123 build and now it works fine.

SpawnerF 07-06-2017 10:59

Re: [ H3LP ] Light Issue
 
Quote:

Originally Posted by DarthMan (Post 2533738)
"The WRITE_SHORT is no longer used, it is used by TE_ELIGHTs (entity lights), but Valve removed it. If you do use it, the DLL will compile fine, but an error will pop up in-game saying its an illegal message. So to put it basically, DONT USE IT." on http://twhl.info/articulator.php?art=167

I didn't see that lol.

Glad that you've solved your problem.


All times are GMT -4. The time now is 23:10.

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