AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   add the access flag (https://forums.alliedmods.net/showthread.php?t=326793)

anakonda001 08-17-2020 03:19

add the access flag
 
hi all, can I please make the plugin work on the flag
Code:

#include <amxmodx>

#define NEW_SPRITE "sprites/muzzleflash67.spr"

new g_sModelIndexExp;
new g_sModelIndexExp2;
new g_sModelIndexFireball2;
new g_sModelIndexFireball3;
public plugin_init()
{
    register_plugin("[CS] HE grenade Sprite", "1.0", "Doc.Batcon");
    register_message(SVC_TEMPENTITY, "MsgHook_SVC_TEMPENTITY");
}
public plugin_precache()
{
    g_sModelIndexFireball2 = precache_model("sprites/eexplo.spr");
    g_sModelIndexFireball3 = precache_model("sprites/fexplo.spr");
    g_sModelIndexExp = precache_model(NEW_SPRITE);
}
public MsgHook_SVC_TEMPENTITY(iMsgID, iMsgDest, pClient)
{
    if (iMsgDest != MSG_PAS)
        return;

    if (get_msg_arg_int(1) != TE_EXPLOSION)
        return;

    static sNewModelIndex; sNewModelIndex = -1;
    static sModelIndex; sModelIndex = get_msg_arg_int(5);

    if (sModelIndex == g_sModelIndexFireball2)
        sNewModelIndex = g_sModelIndexExp
    else if (sModelIndex == g_sModelIndexFireball3)
        sNewModelIndex = g_sModelIndexExp2

    // CSSDK | HE Grenade framerate = 30
    if (get_msg_arg_int(7) != 30)
        return;

    if (sNewModelIndex != -1)
        set_msg_arg_int(5, ARG_SHORT, sNewModelIndex)
}


OciXCrom 08-17-2020 07:39

Re: add the access flag
 
Of course you can. What have you tried and what is the problem?

anakonda001 08-17-2020 11:42

Re: add the access flag
 
Quote:

Originally Posted by OciXCrom (Post 2714513)
Of course you can. What have you tried and what is the problem?

so I was made but a mistake
Code:

#include <amxmodx>

#define NEW_SPRITE "sprites/muzzleflash67.spr"
#define ADMIN_ACCESS ADMIN_RESERVATION

new g_sModelIndexExp;
new g_sModelIndexExp2;
new g_sModelIndexFireball2;
new g_sModelIndexFireball3;
public plugin_init()
{
    register_plugin("[CS] HE grenade Sprite", "1.0", "Doc.Batcon");
    register_message(SVC_TEMPENTITY, "MsgHook_SVC_TEMPENTITY");
}
public plugin_precache()
{
    g_sModelIndexFireball2 = precache_model("sprites/eexplo.spr");
    g_sModelIndexFireball3 = precache_model("sprites/fexplo.spr");
    g_sModelIndexExp = precache_model(NEW_SPRITE);
}
public MsgHook_SVC_TEMPENTITY(iMsgID, iMsgDest, pClient)
{
    if (iMsgDest != MSG_PAS)
        return;

    if (get_msg_arg_int(1) != TE_EXPLOSION)
        return;

    static sNewModelIndex; sNewModelIndex = -1;
    static sModelIndex; sModelIndex = get_msg_arg_int(5);

        if(get_user_flags(id) & ADMIN_ACCESS)
        {
        if (sModelIndex == g_sModelIndexFireball2)
        sNewModelIndex = g_sModelIndexExp
        else if (sModelIndex == g_sModelIndexFireball3)
        sNewModelIndex = g_sModelIndexExp2

    // CSSDK | HE Grenade framerate = 30
        if (get_msg_arg_int(7) != 30)
        return;

        if (sNewModelIndex != -1)
        set_msg_arg_int(5, ARG_SHORT, sNewModelIndex)
        }
}


Shadows Adi 08-17-2020 12:21

Re: add the access flag
 
You forgot to close the braces { }

Code:
if(get_user_flags(pClient) & ADMIN_ACCESS)     {                // code         }
Also, look here for more info: https://www.amxmodx.org/api/messages/register_message

Code:

The function is called in the following manner:
  msg_id          - Message id
  msg_dest        - Destination type (see MSG_* constants in messages_const.inc)
  msg_entity      - Entity receiving the message


OciXCrom 08-17-2020 13:16

Re: add the access flag
 
There is no "id" in that function.

anakonda001 08-17-2020 13:50

Re: add the access flag
 
Quote:

Originally Posted by OciXCrom (Post 2714555)
There is no "id" in that function.

that's how it works! but how do I add another explosion sprite here and what would it work for players without ADMIN_KICK
Code:

#include <amxmodx>

#define NEW_SPRITE "sprites/eexplo9.spr"
#define ADMIN_ACCESS ADMIN_KICK

new g_sModelIndexExp;
new g_sModelIndexExp2;
new g_sModelIndexFireball2;
new g_sModelIndexFireball3;
public plugin_init()
{
    register_plugin("[CS] HE grenade Sprite", "1.0", "Doc.Batcon");
    register_message(SVC_TEMPENTITY, "MsgHook_SVC_TEMPENTITY");
}
public plugin_precache()
{
    g_sModelIndexFireball2 = precache_model("sprites/eexplo.spr");
    g_sModelIndexFireball3 = precache_model("sprites/fexplo.spr");
    g_sModelIndexExp = precache_model(NEW_SPRITE);
}
public MsgHook_SVC_TEMPENTITY(iMsgID, iMsgDest, pClient)
{
    if (iMsgDest != MSG_PAS)
        return;

    if (get_msg_arg_int(1) != TE_EXPLOSION)
        return;

    static sNewModelIndex; sNewModelIndex = -1;
    static sModelIndex; sModelIndex = get_msg_arg_int(5);
    new players[32], inum
    get_players(players, inum)

    for(new i = 0; i < inum; ++i)
        {
    if(get_user_flags(players[i]) & ADMIN_ACCESS)
        {
    if (sModelIndex == g_sModelIndexFireball2)
        sNewModelIndex = g_sModelIndexExp
    else if (sModelIndex == g_sModelIndexFireball3)
        sNewModelIndex = g_sModelIndexExp2

    // CSSDK | HE Grenade framerate = 30
    if (get_msg_arg_int(7) != 30)
        return;

    if (sNewModelIndex != -1)
        set_msg_arg_int(5, ARG_SHORT, sNewModelIndex)
                }
        }
}



All times are GMT -4. The time now is 13:44.

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