Raised This Month: $32 Target: $400
 8% 

Deagle with only 2 bullets


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-09-2018 , 20:32   Deagle with only 2 bullets
Reply With Quote #1

Does anyone knows how to make the deagle have only 2 bullets every rounds?
TrullSin is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 06-09-2018 , 21:27   Re: Deagle with only 2 bullets
Reply With Quote #2

PHP Code:
#include <sourcemod>
#include <sdktools_functions>

#pragma semicolon 1
#pragma newdecls required

public void OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawnEventHookMode_Post);    
}

public 
void Event_PlayerSpawn(Event hEvent, const char[] sEventNamebool bDontBroadcast)
{
    
CreateTimer(0.5Timer_DelayhEvent.GetInt("userid"), TIMER_FLAG_NO_MAPCHANGE);
}

public 
Action Timer_Delay(Handle hTimerany iUser)
{
    
int client GetClientOfUserId(iUser);
    
    if (
client <= MaxClients && IsClientInGame(client))
    {
        
int iWeapon GivePlayerItem(client"weapon_deagle");
        
SetEntProp(iWeaponProp_Send"m_iClip1"2);
        
SetEntProp(iWeaponProp_Send"m_iPrimaryReserveAmmoCount"0);
    }    

__________________

Last edited by LenHard; 06-09-2018 at 21:34.
LenHard is offline
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-20-2018 , 17:05   Re: Deagle with only 2 bullets
Reply With Quote #3

I wanted the plugin to allow only deagle with 2 bullets, for example, maps with deagle already the plugin wont work. I want to force the server only to use 2 bullets. Maps with deagle for example, awp_lego will give a deagle with full ammo and I dont want that.
TrullSin is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-20-2018 , 18:28   Re: Deagle with only 2 bullets
Reply With Quote #4

Code:
public OnClientPostAdminCheck(int client)
{
	SDKHook(client, SDKHook_WeaponEquip, OnWeaponEquip);
}

public Action OnWeaponEquip(int client, int weapon)
{
	char sWeapon[32];
	GetEdictClassname(weapon, sWeapon, sizeof(sWeapon));
	if (!StrEqual(sWeapon, "weapon_deagle"))return Plugin_Continue;
	if (GetEntProp(weapon, Prop_Send, "m_iClip1") <= 2)return Plugin_Continue;
	CreateTimer(0.1, Timer_ChangeClip, client);
	return Plugin_Continue;
}

public Action Timer_ChangeClip(Handle timer, int client)
{
	int weapon = GetPlayerWeaponSlot(client, CS_SLOT_SECONDARY);
	SetEntProp(weapon, Prop_Send, "m_iPrimaryReserveAmmoCount", 0);
	SetEntProp(weapon, Prop_Send, "m_iClip1", 2);
}
__________________
Taking private requests


Last edited by KlausLaw; 06-20-2018 at 18:48.
KlausLaw is offline
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-20-2018 , 18:56   Re: Deagle with only 2 bullets
Reply With Quote #5

error 017: undefined symbol "GetPlayerWeaponSlot"
TrullSin is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-20-2018 , 19:00   Re: Deagle with only 2 bullets
Reply With Quote #6

Quote:
Originally Posted by TrullSin View Post
error 017: undefined symbol "GetPlayerWeaponSlot"
Here:
Attached Files
File Type: sp Get Plugin or Get Source (2Bullets.sp - 216 views - 1.1 KB)
__________________
Taking private requests

KlausLaw is offline
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-20-2018 , 19:32   Re: Deagle with only 2 bullets
Reply With Quote #7

It is not working, you start with 1 bullet but you can reload, and i want the deagle to have only 1 bullet not more with no more reloads

Last edited by TrullSin; 06-20-2018 at 19:41.
TrullSin is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-20-2018 , 19:50   Re: Deagle with only 2 bullets
Reply With Quote #8

Quote:
Originally Posted by TrullSin View Post
It is not working, you start with 1 bullet but you can reload, and i want the deagle to have only 1 bullet not more with no more reloads
You said you want 2 bullets in the deagle...

Anyway, here you go:
Attached Files
File Type: sp Get Plugin or Get Source (1Bullet.sp - 255 views - 1.1 KB)
__________________
Taking private requests


Last edited by KlausLaw; 06-20-2018 at 19:52.
KlausLaw is offline
TrullSin
Senior Member
Join Date: Jun 2018
Old 06-20-2018 , 19:56   Re: Deagle with only 2 bullets
Reply With Quote #9

Yes, 1 bullet or 2 doesent matter. The map already have deagle. But it isn't working that. Your start with the bullet and then you press R to reload and you get the 7 bullets, and i want only 1 in all deagle, even if you reload you dont get more, you stay with 0 bullets.
TrullSin is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-20-2018 , 20:00   Re: Deagle with only 2 bullets
Reply With Quote #10

Quote:
Originally Posted by TrullSin View Post
Yes, 1 bullet or 2 doesent matter. The map already have deagle. But it isn't working that. Your start with the bullet and then you press R to reload and you get the 7 bullets, and i want only 1 in all deagle, even if you reload you dont get more, you stay with 0 bullets.
I just tested it, and it's working great for me.

1 Bullet, and you can't reload.
__________________
Taking private requests

KlausLaw 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 09:10.


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