Raised This Month: $ Target: $400
 0% 

Help adding verification


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 09-08-2023 , 11:57   Help adding verification
Reply With Quote #1

Hello people ! Can anyone help me add a check to see if I already have a revolver in my hand on respawn because now it gives me two. One falls to the ground and the other remains in my hand.

Code:
#include <amxmodx>
#include <reapi>
#include <cromchat>

/** ¦¦¦¦ Bitsum validation by Lethality ¦¦¦¦ */
#define is_user_eligible(%0) ( 1 <= %0 <= MaxClients && is_user_vip( %0 ) )
/*¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦*/

#define VIP_FLAG ADMIN_RESERVATION

#define PLUGIN "VIP Privileges[ReAPI]"
#define VERSION "2.0.3"
#define AUTHOR "Lethality"

#pragma semicolon 1

/**¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ CUSTOM WEAPONS NATIVES - LETHALITY ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦*/
native IsUserHasMolotov( pPlayer );
native GiveUserMolotov( pPlayer );
native GiveUserRevolver( pPlayer );
/**¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ CUSTOM WEAPONS NATIVES - LETHALITY ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦*/

new bool:g_bInformationMessage[MAX_CLIENTS + 1] = {false, ...};

public plugin_init( ) {

	register_plugin( PLUGIN, VERSION, AUTHOR );
	register_cvar( "VIP Privileges[ReAPI]", VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED );

	RegisterHookChain( RG_CBasePlayer_Spawn, "@CBasePlayer__Spawn_Post", .post = true );
	

	CC_SetPrefix( "&x01[&x04CS:GO Remake&x01: &x03VIP&x01]" );
}

public client_putinserver(id)
	g_bInformationMessage[id] = false;

@CBasePlayer__Spawn_Post(pPlayer) {

	if (is_user_alive(pPlayer) && is_user_eligible(pPlayer))
	{
		rg_give_item(pPlayer, "item_assaultsuit");

		GiveUserRevolver(pPlayer);

		if (!IsUserHasMolotov(pPlayer))
			GiveUserMolotov(pPlayer);

		if (get_member(pPlayer, m_iTeam) == TEAM_CT)
			rg_give_defusekit(pPlayer, true);

		if (!g_bInformationMessage[pPlayer])
		{
			CC_SendMatched(pPlayer, CC_COLOR_TEAM, "&x01Hey &x03%n&x01! &x01You're &x03VIP player &x01and you received &x04FREE items&x01!", pPlayer);
			g_bInformationMessage[pPlayer] = true;
		}
	}
}



bool:is_user_vip( pPlayer )
	return bool:( get_user_flags( pPlayer ) & VIP_FLAG );

/*
stock rg_give_item_ex(id, weapon[], GiveType:type = GT_APPEND, ammo = 0, bpammo = 0)
{
	rg_give_item(id, weapon, type);

	if (ammo)
		rg_set_user_ammo(id, rg_get_weapon_info(weapon, WI_ID), ammo);

	if (bpammo)
		rg_set_user_bpammo(id, rg_get_weapon_info(weapon, WI_ID), bpammo);
}*/
__________________
Siska1 is offline
Send a message via Skype™ to Siska1
mlibre
Senior Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 09-08-2023 , 12:56   Re: Help adding verification
Reply With Quote #2

we don't know the natives, I guess it should contain one to confirm if you have it or not. as applied in the molotov.

Code:
if (!IsUserHasMolotov(pPlayer))             GiveUserMolotov(pPlayer);

I was guided by logic, it should be so, then.

PHP Code:
if (!IsUserHasRevolver(pPlayer))
            
GiveUserRevolver(pPlayer); 
you should check if such a native exists. in its plugins

Code:
native IsUserHasRevolver( pPlayer );
__________________
mlibre is offline
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 09-08-2023 , 13:14   Re: Help adding verification
Reply With Quote #3

This is from the revolver plugin.
Should I provide all the code ?
Code:
public plugin_natives()
{
    register_native("GiveUserRevolver", "NativeGiveUserRevolver", false);
}

public NativeGiveUserRevolver(plugin, params)
{
    enum { arg_player = 1 };

    new pPlayer = get_param(arg_player);

    if(!is_user_connected( pPlayer ))
    {
        return false;
    }

    GiveItem( pPlayer );

    return true;
}
__________________

Last edited by Siska1; 09-08-2023 at 13:39.
Siska1 is offline
Send a message via Skype™ to Siska1
mlibre
Senior Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 09-08-2023 , 14:29   Re: Help adding verification
Reply With Quote #4

strange that he does not have it, this way we check if he has the weapon... example

PHP Code:
public plugin_natives()
{
    
//...
    
register_native("IsUserHasRevolver""NativeIsUserHasRevolver"1);
}

public 
NativeIsUserHasRevolver(id)
{
    return 
HasRevolver[id];

I see that the Molotov does come with "IsUserHasMolotov" at least it seems to have it, it provides the code to adapt it to the same method.
__________________
mlibre is offline
Siska1
Senior Member
Join Date: Feb 2020
Location: BedRock
Old 09-09-2023 , 11:19   Re: Help adding verification
Reply With Quote #5

The natives had to be fitted in the revolver and now I have a fixed vip. Thanks for the inclusion.
I almost finished my sprint plugin by the way. I will write in the previous thread very soon to show you how I did it. Greetings
__________________
Siska1 is offline
Send a message via Skype™ to Siska1
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-09-2023 , 21:52   Re: Help adding verification
Reply With Quote #6

PHP Code:
bool:UserHasPistolid )
{
    return 
bool:!!( pevid pev_weapons ) & ( ( << CSW_P228 ) | ( << CSW_ELITE ) | ( << CSW_FIVESEVEN ) | ( << CSW_USP ) | ( << CSW_GLOCK18 ) | ( << CSW_DEAGLE ) ) );

__________________

Last edited by Bugsy; 09-09-2023 at 23:32.
Bugsy is offline
Reply


Thread Tools
Display Modes

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 06:00.


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