Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
text
Languages:
Russian
Size:
10K - 100K
Tags:
code
License:
| Fakemeta function: | |
| PHP Code: | |
| EngFunc_CheckVisibility | |
| Description: | |
| This function is used to check if an entity is in your PVS. | |
| It can be used on all entities except worldspawn! | |
| Here I will show you how to use is, since this function has a paramater that must be obtained in a special way! | |
| What is PVS? | |
| PVS means potentially visible set, this means that the entities that we have in this list can be seen. | |
| PVS does not hold just the entities that we see! | |
| By knowing this we can get to the conclusion that PVS has the role of limiting data transfer for better internet connection/lower amount of data transfer! | |
| So in small words I want to say something like this: | |
| Code: | |
| Entity that is in PVS => Can be seen => Data Transfer about that entity | |
| Entity that it is not in PVS => Can not be seen => No data transfer => Save bandwidth | |
| How does it work? | |
| Well let's say that every room of the map is a cube. | |
| We find ourselves in a room and that also means that we are in the cube of that room. | |
| We can see the entities in the next rooms because the cubes of that room touch with the cube of the room we are in. | |
| How do I use this function? | |
| Well this function has a parameter that must be obtained in a special way. That is the "pset" parameter. | |
| Here is how you obtain that parameter. | |
| Note: The parameter is player only, that means that if you get pset for example for a player that has the id "1". When you use this function on an entity it will check whether that entity is in PVS of the Player id "1". | |
| Example Usage: | |
| PHP Code: | |
| new g_cl_pset[33] | |
| public plugin_init(id) | |
| { | |
| register_forward(FM_AddToFullPack, "pfw_atfp", 1) | |
| } | |
| public pfw_atfp(es, e, ent, host, flags, player, set) | |
| { | |
| g_cl_pset[host] = set | |
| return FMRES_IGNORED | |
| } | |
| stock is_ent_in_player_pvs(id, entity) | |
| { | |
| return engfunc(EngFunc_CheckVisibility, entity, g_cl_pset[id]) | |
| } | |
| stock get_pvs_players(id, players[32], num, flags[], team[]) | |
| { | |
| if (!is_user_connected(id)) | |
| return 0 | |
| get_players(players, num, flags, team) | |
| for (new i=0;i<num;i++) | |
| { | |
| if (!is_ent_in_player_pvs(id, players[i])) | |
| { | |
| num--; | |
| for (new j=i;j<num;j++) | |
| { | |
| players[j] = players[j+1] | |
| } | |
| i-- | |
| } | |
| } | |
| return 1 | |
| } |