Raised This Month: $51 Target: $400
 12% 

add the access flag


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anakonda001
Member
Join Date: Jul 2020
Old 08-17-2020 , 03:19   add the access flag
Reply With Quote #1

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)
}
anakonda001 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-17-2020 , 07:39   Re: add the access flag
Reply With Quote #2

Of course you can. What have you tried and what is the problem?
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
anakonda001
Member
Join Date: Jul 2020
Old 08-17-2020 , 11:42   Re: add the access flag
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
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)
	}
}
anakonda001 is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-17-2020 , 12:21   Re: add the access flag
Reply With Quote #4

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
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]

Last edited by Shadows Adi; 08-17-2020 at 13:43. Reason: Edit, thanks OciXCrom
Shadows Adi is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-17-2020 , 13:16   Re: add the access flag
Reply With Quote #5

There is no "id" in that function.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
anakonda001
Member
Join Date: Jul 2020
Old 08-17-2020 , 13:50   Re: add the access flag
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
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)
		}
	}
}
anakonda001 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:28.


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