AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Deagle with only 2 bullets (https://forums.alliedmods.net/showthread.php?t=308192)

TrullSin 06-09-2018 20:32

Deagle with only 2 bullets
 
Does anyone knows how to make the deagle have only 2 bullets every rounds?

LenHard 06-09-2018 21:27

Re: Deagle with only 2 bullets
 
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);
    }    



TrullSin 06-20-2018 17:05

Re: Deagle with only 2 bullets
 
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.

KlausLaw 06-20-2018 18:28

Re: Deagle with only 2 bullets
 
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);
}


TrullSin 06-20-2018 18:56

Re: Deagle with only 2 bullets
 
error 017: undefined symbol "GetPlayerWeaponSlot"

KlausLaw 06-20-2018 19:00

Re: Deagle with only 2 bullets
 
1 Attachment(s)
Quote:

Originally Posted by TrullSin (Post 2598283)
error 017: undefined symbol "GetPlayerWeaponSlot"

Here:

TrullSin 06-20-2018 19:32

Re: Deagle with only 2 bullets
 
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

KlausLaw 06-20-2018 19:50

Re: Deagle with only 2 bullets
 
1 Attachment(s)
Quote:

Originally Posted by TrullSin (Post 2598290)
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:

TrullSin 06-20-2018 19:56

Re: Deagle with only 2 bullets
 
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.

KlausLaw 06-20-2018 20:00

Re: Deagle with only 2 bullets
 
Quote:

Originally Posted by TrullSin (Post 2598300)
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.


All times are GMT -4. The time now is 07:40.

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