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

[CSGO] Deagle with 1 bullet + flag restrict


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sw33T3R
AlliedModders Donor
Join Date: Mar 2014
Old 10-31-2017 , 14:39   [CSGO] Deagle with 1 bullet + flag restrict
Reply With Quote #1

Hello

I'd like 2 request a very simple plugin
On round start player with ADMFLAG_RESERVATION will get weapon_deagle with 1 bullet
Anyone can help ?

PS (I dont know how 2 give deagle with 1 ammo ;-; here is my current plugin code)
PS2 (How can i block pickup deagle for non ADMFLAG_RESERVATION players?)

Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>

public Plugin:myinfo = {
	name = "[ CSGO ] 1 Bullet Deagle",
	author = "unkn0wn",
	description = "lolyou",
	version = "1.0.0",
	url = ""
}

public OnPluginStart() {
	HookEvent("player_spawn", Event_PlayerSpawn);
}

public Action Event_PlayerSpawn(Handle event, const char[] name, bool dontBroadcast)
{
	int client = GetClientOfUserId(GetEventInt(event, "userid"));
	if (IsValidPlayer(client) && IsPlayerVip(client)) {
		GivePlayerItem(client, "weapon_deagle");
	}
}

stock bool IsValidPlayer(int client) {
	if(client >= 1 && client <= MaxClients && IsClientConnected(client) && !IsFakeClient(client) && IsClientInGame(client) )
	return true;
	return false;
}

stock bool IsPlayerVip(int client) {
    if (CheckCommandAccess(client, "check_vip", ADMFLAG_RESERVATION, false)) return true;
    return false;
}
Sw33T3R is offline
Bobakanoosh
Senior Member
Join Date: Sep 2015
Location: United States
Old 10-31-2017 , 17:11   Re: [CSGO] Deagle with 1 bullet + flag restrict
Reply With Quote #2

PHP Code:
int gun GetPlayerWeaponSot(client1);

if(
IsValidEntity(gun))
    
SetEntProp(gunProp_Send"m_iClip1"11); 
Taken from https://forums.alliedmods.net/archiv.../t-122559.html, untested.

Last edited by Bobakanoosh; 10-31-2017 at 17:12.
Bobakanoosh is offline
Elitcky
AlliedModders Donor
Join Date: Jun 2016
Location: Antofagasta, Chile
Old 11-03-2017 , 02:33   Re: [CSGO] Deagle with 1 bullet + flag restrict
Reply With Quote #3

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Elitcky"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo 
{
    
name "[ CSGO ] 1 Bullet Deagle",
    
author PLUGIN_AUTHOR,
    
description "Gr",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
HookEvent("round_start"OnRoundStart);
}

public 
void OnRoundStart(Event hEvent, const char[] sNamebool dontBroadcast)
{
        for (
int iClient 1iClient MaxClientsiClient++)
        {
            if (
IsValidClient(iClient) && (GetUserFlagBits(iClient) & ADMFLAG_RESERVATION))
            {
                
GivePlayerItemAmmo(iClient"weapon_deagle");
            }
        }
}
//Stocks
stock bool IsValidClient(int client)
{
    if (
client <= 0)return false;
    if (
client MaxClients)return false;
    if (!
IsClientConnected(client))return false;
    return 
IsClientInGame(client);
}
stock void GivePlayerItemAmmo(int client, const char[] item)
{
    
int weaponEnt GivePlayerItem(clientitem);
    
    
SetEntProp(weaponEntProp_Data"m_iClip1"1);
    
    
SetEntProp(weaponEntProp_Send"m_iPrimaryReserveAmmoCount"0);
    
SetEntProp(weaponEntProp_Send"m_iSecondaryReserveAmmoCount"0);

Untested...
__________________
Elitcky 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 18:20.


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