AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Insolid players (https://forums.alliedmods.net/showthread.php?t=55028)

Alka 05-11-2007 15:46

Insolid players
 
1 Attachment(s)
Hi! I have this plugin (Is not working properly).Basically is working like this:*When a "id" is in another player(s) range that "id" and that that "players" got insolid ; else if outside of range "they" are solid again!* :wink:

Thanks...

_Master_ 05-11-2007 16:04

Re: Insolid players
 
So it's like this:
1) Player A and player B are close to one another. fm_playerprethink() is called for player A, so player B becomes insolid.
2) Player B and player C are outside the range. fm_playerprethink() is called for player C, so player B becomes solid.

Try and find a workaround for this, or use server_frame(), tho I wouldn't do that if I were you :)

Alka 05-11-2007 16:10

Re: Insolid players
 
hmm....server_frame() is very laggy...:| ! there must be another way to do it :P

_Master_ 05-11-2007 16:13

Re: Insolid players
 
There is. A set_task() would do the job too.

Alka 05-11-2007 16:15

Re: Insolid players
 
how man??:| i realy don't know...

teame06 05-11-2007 20:39

Re: Insolid players
 
Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN "Invisible Range" #define VERSION "1.0" #define AUTHOR "Alka" new radius = 200; public plugin_init() {         register_plugin(PLUGIN, VERSION, AUTHOR);         register_forward(FM_PlayerPreThink,"fm_playerprethink",0)     } public fm_playerprethink(id) {     static players[32], num, player     get_players(players, num,"a")             new distance, i;     new origin1[3], origin2[3];     get_user_origin(id, origin2);         for(i = 0; i < num; i++)     {         player = players[i]                 if(player != id)         {                         get_user_origin(player, origin1);             distance = get_distance(origin1, origin2);             /* Add code here to print out the distance */             if(distance < radius)             {                 set_pev(player, pev_solid, SOLID_NOT);                 fm_set_rendering(player, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 50);                                 set_pev(id, pev_solid, SOLID_NOT);                 fm_set_rendering(id, kRenderFxNone, 0, 0, 0, kRenderTransAdd, 50);                 i = 0;                 break;             }         }     }         if(i == num)     {                 set_pev(id, pev_solid, SOLID_BBOX);                 /* I'm not sure if fm_set_rendering has default values in it stock. If it does this will set the player back to default rendering*/         fm_set_rendering(id);     } } stock fm_set_rendering(ent, fx=kRenderFxNone, r=255, g=255, b=255, rend=kRenderNormal, amt=16) {     set_pev(ent, pev_renderfx, fx);         new Float:rendColor[3];     rendColor[0] = float(r);     rendColor[1] = float(g);     rendColor[2] = float(b);     set_pev(ent, pev_rendercolor, rendColor);         set_pev(ent, pev_rendermode, rend);     set_pev(ent, pev_renderamt, float(amt)); }

This is how I have my Kz plugin v0.09 no block code setup except for more distance checking.

Ps.. Are you only trying to set the SOLID_NOT and SOLID_BBOX only on person?

_Master_ 05-12-2007 02:27

Re: Insolid players
 
I don't think that will work teame06.
Player A is "close" to player B and C. Player B and C are NOT "close". If fm_playerprethink() is called for Player A, your code will set SOLID_NOT ONLY to Player B, but not to Player C.

With that in mind I would suggest this in fm_playerprethink(id):
1) If <id> is solid then test if all other players are within range. If found at least one player then set <id> to be insolid.
2) If <id> is insolid then test if all other players are outside range. If found at least one player then set <id> to be solid.

This will solve the problem for <id> only, while the remaining players are not affected. This is not an issue as fm_playerprethink() will be called on them as well. The two suggestions stand true as, to some degree, distance(A, B)=distance(B, A).

teame06 05-12-2007 02:39

Re: Insolid players
 
Quote:

Originally Posted by _Master_ (Post 475776)
I don't think that will work teame06.
Player A is "close" to player B and C. Player B and C are NOT "close". If fm_playerprethink() is called for Player A, your code will set SOLID_NOT ONLY to Player B, but not to Player C.

No, There more changes to that code I need to do. I still waiting for an answer from Alka. That if Alka wants to set the both players SOLID_NOT and change their rendering. Cause right now it only set the other player SOLID_NOT.

P.S. PreThink is just not called on one person. It still can go from Prethink(player C) -> Player A, PreThink(Player A) -> Player B, and even PreThink(Player B) -> Gaben. It still goes full circle for each player.

_Master_ 05-12-2007 02:44

Re: Insolid players
 
Quote:

Originally Posted by Alka (Post 475672)
Basically is working like this:*When a "id" is in another player(s) range that "id" and that that "players" got insolid ; else if outside of range "they" are solid again

My guess is both <id> and players-in-range.

Alka 05-12-2007 03:13

Re: Insolid players
 
Thanks teame06! So i want when a Player A is close to a Player B both are get insolid! If a Player A is close to Player and Player C all are get insolid, and also for more players...! :wink:

"id" = player who prethink
"players" = others players remain

Later Edit:Thanks teame ,is working...but if E.g : In team Ct remain 1 player and in T team are 2 players /*Alive*/, player on team Ct is solid and transparent (weird)...and players from T are get tucked when walk...:|


All times are GMT -4. The time now is 06:35.

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