Page 3 of 3 FirstFirst 1 2 3
Results 21 to 27 of 27

Thread: [UPDATE|ZE] entWatch 3.0.3 (edited)

  1. Default

    The function is also in efficient in that the order of operations for example is not optimized which is critical for a function that runs constantly.

    Code:
    if (G_bConfigLoaded && !G_bRoundTransition && IsValidEdict(trigger))
        {
            for (new index = 0; index < entArraySize; index++)
            {
                if (entArray[index][ent_hammerid] == Entity_GetHammerID(trigger))
                {
                    if (entArray[index][ent_trigger] == 1)
                    {
                        if (G_bRestricted[client] || G_bTemp[client])
                        {
                            if (entArray[index][ent_torient] == 0)
                            {
                                CPrintToChat(client, "\x07%s[entWatch] \x07%s%t", color_tag, color_warning, "status restricted");
                                TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, straight);
                                return Plugin_Handled;
                            }
                            else if (entArray[index][ent_torient] == 1)
                            {
                                CPrintToChat(client, "\x07%s[entWatch] \x07%s%t", color_tag, color_warning, "status restricted");
                                TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, left);
                                return Plugin_Handled;
                            }
                            else if (entArray[index][ent_torient] == 2)
                            {
                                CPrintToChat(client, "\x07%s[entWatch] \x07%s%t", color_tag, color_warning, "status restricted");
                                TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, right);
                                return Plugin_Handled;
                            }
                            else if (entArray[index][ent_torient] == 3)
                            {
                                CPrintToChat(client, "\x07%s[entWatch] \x07%s%t", color_tag, color_warning, "status restricted");
                                TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, back);
                                return Plugin_Handled;
                            }
                        }
                    }
                }
            }
        }
    Note that in this code we are waiting to check if the client is even supposed to be restricted at the very end within a loop! Also any check that can be done outside of a loop needs to for performance.



  2. Default

    I think that the use of that entire function could be removed. There is weapon plugins that prevent people from ever picking up an awp for example that work without using such an expensive hook. See: https://forums.alliedmods.net/showthread.php?p=950174

    Also there is a few other ways to go about modifying the existing plugin that do not require additional hooks to in effect achieve the same results.

    For example you can make it so that items are auto transferred when picked up by a blocked user. The transfer command already exists so why not have it just auto send it to any non zombie admin who does not currently have an item and if no admins are free it sends to a random player. This way it just hands the item off to someone who can use it.

    Sometimes the easier solution is to approach the problem from a different direction that takes less expensive code to resolve.



  3. Default

    Alright then I'll give that a try. I thought if I reworked it then it would help but if it's a lost cause it's probably best to go with the easier option.

  4. Default

    Now the pickup method they use might not work if it only triggers on weapons. Another solution could be to hook the actual ents instead if there is a blocked user on the server and only until that ent is picked up by a non blocked user and or after X time has passed. This way it minimizes as much as possible the lag as the on touch should not be going off very often for non player ents which are not even moving.



  5. Default

    Well the problem I was trying to fix was items that require a teleport room. Entwatch already prevents banned people from picking up items. When a banned person tries to get a wand in Harry, they get teleported to the item room, striped of weapons and end up leaving the item in the void. A block like push was the only way I saw of doing this but it seems the block method was wrong. What I'll do is I'll rework the code, take out the push and leave the temp ban. I'll see about making it dynamic with times. But we should probably just update ours so we can do temp entwatch bans.

  6. Default

    Also, remember that for cases like that simply automatically giving it to another user might be a better solution so that it does not get left in the void like you said before.



  7. Default

    Well how do we get it out of the void though? If a person is already restricted, the won't be able to pick it up. Found
    Doing a swap to another person on pick up would change how entwatch functions and would in itself become a new program.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •