/invis plugin

Started by joel
08/04/2008 13:34
Page 1 of 2
joel08/04/2008 13:34

Heyaa! Does anybody have some link for this /invis plugin what makes all players around you invisible to get higher fps in bigger maps?

This plugin is used in KZM servers , I dont know if they are somewhere else too

SiMen.iiN08/04/2008 13:47

http://www.sendspace.com/file/dtk8zr

stask0 Tournament #208/04/2008 17:06(edited 08/04/2008 17:09)

click me invis players + water :P command - /invis

joel08/04/2008 17:15(edited 08/04/2008 17:21)

THX STASK0! and iiN too :)

i'll try those

SchlumPF08/04/2008 18:02(edited 01/05/2008 16:07)

nice stasko for making it on your own but mine should be better since it allows every player to make water vis/invis. your does just allow to make the whole water invis for every palyer ^^ maybe i will add removing sky someday... (original code of my kz plugin)

buggy, continue reading the thread for a better version :)

stask0 Tournament #208/04/2008 20:13(edited 08/04/2008 20:19)

nice schlumpf :P but you had forggot to put
new g_PluginName[] = "name" :P


edit.. and i get that while compiling

Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

E:\CS 1.6\Counter-Strike\cstrike\addonss\amxmodx\scripting\include\fakemeta_util.inc(356) : error 017: undefined symbol "EF_NODRAW"
Error: Expected token: ":", but found "." on line 80
Warning: Expression has no effect on line 80
Error: Expected token: ";", but found ")" on line 80
Error: Invalid expression, assumed zero on line 80
Error: Too many error messages on one line on line 80

Compilation aborted.
5 Errors.
Could not locate output file E:\CS 1.6\Counter-Strike\cstrike\addonss\amxmodx\scripting\compiled\invis.amx (compile failed).


i used AMXX-Studio's compiler cuz when i try amxmodx's compiler it says "home/groups/amxmodx/tmp3/text3kqSJl.sma(3) : fatal error 100: cannot read from file: "fakemeta_util" so if you can upload an .amxx file :P

SchlumPF08/04/2008 22:11(edited 01/05/2008 16:09)

cannot update the post cause the website is bugging for me (rightern menu is over the edit button :/) but i posted a old source code with 2 small errors ^^
this should work


just continue reading xD

skyjur08/04/2008 22:37

SchlumPF*, are you sure that code you have pasted works as /invis and effects only the player who have set "/invis". I mean, Only that player should not see others.


public fwdAddToFullPack( es_handle, e, ent, host, hostflags, player, pset )
{
if( is_user_alive( ent ) && is_user_alive( host ) )
{
if( g_bPlayerInvisible[host] )
fm_set_rendering( ent, kRenderFxNone, 0, 0, 0, kRenderTransAlpha, 0);
else if( !g_bPlayerInvisible[host] )
fm_set_rendering( ent, kRenderFxNone, 255, 255, 255, kRenderNormal, 25 );
}


I think that fm_set_rendering(...) will set a global value, so every one in the server will be effected.

There is set_es(...) function, which can be used in AddToFullPack. Its sets information about entity "e". This information will be sent to entity "ent" only.


I have tested some things.
I have found smth a bit strange, but works similar to "/invis".



// add this into AddToFullPack{ ... }
if(e == ent && is_alive(ent))
{
if( player_is_turned_on_invis ( ent )
{
set_es(es_handle, ES_Origin, {-10000.0, -10000.0, -10000.0});
// this will not set my origin,
// it makes me to think that i am in that origin,
// well you need to test it by your self :)
}
}

I usualy test everything with buch of bots (POD Bots works through fakemeta)

I am not good at explaining everything clearly... You you will need to test this.

SchlumPF09/04/2008 16:24(edited 09/04/2008 16:26)

tested that invis on a server and it works. im just using the set_rendering command because set_es did not work for me when i wanted to test it oO

fm_set_invisibility works also fine and was used global for example in climb too ^^

also addtofullpack is just changing the data which the player receives so it ahs to work with ur set origin thingy ^^

stask0 Tournament #209/04/2008 16:27

schlumpf can you upload an .amxx file? still cant compile :P

skyjur09/04/2008 17:02(edited 10/04/2008 12:23)


tested that invis on a server and it works. im just using the set_rendering command because set_es did not work for me when i wanted to test it oO

fm_set_invisibility works also fine and was used global for example in climb too ^^

also addtofullpack is just changing the data which the player receives so it ahs to work with ur set origin thingy ^^

SchlumPF*


I have understood now why you code works However you are still changing the global value for rendering, not the one which will be sent to client. It works because you change that global value before each time information is sent to client. Your way works well with everything what does not matter to server (like rendering, but not with origin).

I find the way how to use set_es(...) correctly, here is a code snipest:
public plugin_init(){
...
register_forward(FM_AddToFullPack, "addToFullPack", 1)
// 1 sets that this function will be called after original,
// and it means, that changes about entity info wont be changed by server
}

public addToFullPack(es, e, ent, host, hostflags, player, pSet)
{
if( plr_invis_enabled(host) )
{
if(player == 1) // means that e is player not a water or smth
{
set_es(es, ES_Effects, EF_NODRAW)
}
}
}


I have also find a very very good method of semiclip. All players are like SOLID_BBOX and can go trought each other only and will collide with every other entities accept players. I will write about it later.

BTW i have done some tests on performance with addToFullPack. It seams that you must add as less as possible stuff to this function. Bicouse this function is called verry often (up to ~1000 times more often than FM_Think)
Here some stats in bkz_goldbhop:
function name |    calls | total time
addToFullPack | 31260905 | 70.857777
postThink | 70250 | 0.198070
preThink | 70250 | 0.223913

joel09/04/2008 18:08(edited 09/04/2008 18:08)

stask0's plugin works fine.. no need to be up anymore, close ;P

(If needed)

SchlumPF09/04/2008 18:54

will update it to set_es i think :S did not know that it is called that often :S
btw player == 1 does just set es_effects for one player... the palyer with id 1. it should be 0 < player < 33 ^^

skyjur09/04/2008 20:02

player can be 0 or 1. And 1 means that entity e is player :)

Found this in amxx forums:

/*
(es_handle,e,ent,host,hostflags,player,pSet)

AddToFullPack

Return 1 if the entity state has been filled in for the ent and the entity will be propagated to the client, 0 otherwise

state is the server maintained copy of the state info that is transmitted to the client
a MOD could alter values copied into state to send the "host" a different look for a particular entity update, etc.
e and ent are the entity that is being added to the update, if 1 is returned
host is the player's edict of the player whom we are sending the update to
player is 1 if the ent/e is a player and 0 otherwise
pSet is either the PAS or PVS that we previous set up. We can use it to ask the engine to filter the entity against the PAS or PVS.
we could also use the pas/ pvs that we set in SetupVisibility, if we wanted to. Caching the value is valid in that case, but still only for the current frame
*/

I cant understand one thing here. What for is "ent" at all if we have "e" - the entity, and host - the player who gets info about entity "e".

SchlumPF09/04/2008 21:15(edited 11/04/2008 21:46)

nvm

skyjur10/04/2008 12:25

Originally posted by skyjur
I have also find a very very good method of semiclip. All players are like SOLID_BBOX and can go trought each other only and will collide with every other entities accept players. I will write about it later.


You can check out my new way of semiclip in AMXX Forums: http://forums.alliedmods.net/showthread.php?p=609131

SchlumPF10/04/2008 16:42(edited 10/04/2008 17:10)

very nice as i said in the amxx thread :) does improve semiclip very well and helped me a lot ^^ maybe i would ahve searched weeks for a way to fix the trigger_* bug :)

edit: did you allready test it on a gameserver? it might have worked on your lan because all bots ahve as much fps as u have. also fps might bug it so i would check in postthink if palyer is colliding with another palyer

might help you
http://forums.alliedmods.net/showpost.php?p=571762&postcount=30

stask0 Tournament #210/04/2008 18:19

i need a little help... still cant compile the plugin


Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

E:\CS 1.6\Counter-Strike\cstrike\addonss\amxmodx\scripting\include\fakemeta_util.inc(356) : error 017: undefined symbol "EF_NODRAW"

1 Error.
Could not locate output file E:\CS 1.6\Counter-Strike\cstrike\addonss\amxmodx\scripting\compiled\invis.amx (compile failed).


line 356 at fakemeta_util.inc


stock fm_set_entity_visibility(index, visible = 1) {
set_pev(index, pev_effects, visible == 1 ? pev(index, pev_effects) & ~EF_NODRAW : pev(index, pev_effects) | EF_NODRAW)

return 1
}

Fatalis11/04/2008 13:03

comparing strings in addtofullpack is a major cpu hit.

StormZz12/04/2008 00:43

I'm confused.
Non-Scripters like me dont get all this.
Could someone really explain how u can add these lines into a plugin or just upload the amxx?
I'd really appreciate that thx :)

Page 1 of 2

Please log in to post replies.