[L4D2] Sin Recarga
#1
Hola como estan, soy nuevo aqui y queria saber si hay alguien que pueda modificar un plugin para el juego (Left 4 Dead 2) que lo que hace es que cuando la municion llega a 1 se recarga automaticamente la municion y asi se sigue disparando sin nesecidad de recargar, pero, lo que nesecito es que no sea para todos sino que sea para admin y que un admin pueda dar a otro jugador esa ventaja de no recargar.

Le faltaria algo como esto, lo demas no se:

RegAdminCmd("l4d2_giveclip", Command_GiveClip, ADMFLAG_BAN, "l4d2_giveclip <#userid|name> <0|1> - Toggles Unlimit Reload on player(s)");

Aqui dejo el plugin si alguien puede modificarlo para mi Gracias

Código PHP:
#include <sourcemod>
#include <sdktools>

#define DEFAULT_FLAGS FCVAR_PLUGIN|FCVAR_NOTIFY
#define PLUGIN_VERSION "1"

static Handle:AssaultAmmoCVAR INVALID_HANDLE;
static 
Handle:SMGAmmoCVAR INVALID_HANDLE;
static 
Handle:ShotgunAmmoCVAR INVALID_HANDLE;
static 
Handle:AutoShotgunAmmoCVAR INVALID_HANDLE;
static 
Handle:HRAmmoCVAR INVALID_HANDLE;
static 
Handle:SniperRifleAmmoCVAR INVALID_HANDLE;
static 
Handle:GrenadeLauncherAmmoCVAR INVALID_HANDLE;
static 
Handle:M60AmmoCVAR INVALID_HANDLE;

static 
bool:buttondelay[MAXPLAYERS+1];
public 
Plugin:myinfo ={
    
name "Unlimit Reload",
    
author "Lumiere/亮晶晶",
    
description "Dont ever need to reload again!",
    
version "1.0.0.0",
    
url "http://www.sourcemod.net/"
}
 
public 
OnPluginStart(){
    
CreateConVar("l4d2_unlimitreload_version"PLUGIN_VERSION" Version of L4D2 Unlimit Reload on this server "DEFAULT_FLAGS|FCVAR_SPONLY|FCVAR_DONTRECORD);
    
    
AssaultAmmoCVAR CreateConVar("l4d2_unlimitreload_assaultreload""30""Reload amont for Assault Rifles "DEFAULT_FLAGS);
    
SMGAmmoCVAR CreateConVar("l4d2_unlimitreload_smgreload""50""Reload amount for SMG gun types "DEFAULT_FLAGS);
    
ShotgunAmmoCVAR CreateConVar("l4d2_unlimitreload_shotgunreload""8""Reload amount for Shotgun and Chrome Shotgun "DEFAULT_FLAGS);
    
AutoShotgunAmmoCVAR CreateConVar("l4d2_unlimitreload_autoshotgunreload""10""Reload amount for Autoshottie and SPAS "DEFAULT_FLAGS);
    
HRAmmoCVAR CreateConVar("l4d2_unlimitreload_huntingrifleareload""30""Reload amount for the Hunting Rifle "DEFAULT_FLAGS);
    
SniperRifleAmmoCVAR CreateConVar("l4d2_unlimitreload_sniperrifleareload""30""Reload amount for the Military Sniper Rifle, AWP, and Scout "DEFAULT_FLAGS);    
    
GrenadeLauncherAmmoCVAR CreateConVar("l4d2_unlimitreload_grenadelauncherreload""1""Reload amount for the Grenade Launcher "DEFAULT_FLAGS);
    
AutoExecConfig(true"l4d2_unlimitreload");
    
HookEvent("weapon_fire"Event_Weapon_fire);
}
public 
Action:Event_Weapon_fire(Handle:event, const String:name[], bool:dontBroadcast){
    new 
client GetClientOfUserId(GetEventInt(event"userid"));    
    
decl String:weaponName[20];
    
GetEventString(event"weapon"weaponNamesizeof(weaponName));
    if (!
IsValidEntity(client)) return 1000;
    new 
weapon GetPlayerWeaponSlot(client0); 
    if (
IsValidEntity(weapon)){
        new 
iOffset GetEntProp(weaponProp_Send"m_iPrimaryAmmoType"0)*4;
        new 
iAmmoTable FindSendPropInfo("CTerrorPlayer""m_iAmmo");
        new 
clipammo=GetEntProp(weaponProp_Send"m_iClip1");
        new 
allAmmo=GetEntData(clientiAmmoTable+iOffset);
        
PrintToServer("GetAmmo  %d,%d %s %",clipammo,allAmmo,weaponName);
        if(
clipammo<=1){
            if (
StrEqual(weaponName"pumpshotgun")||StrEqual(weaponName"shotgun_chrome")){
                if(
allAmmo>=GetConVarInt(ShotgunAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(ShotgunAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(ShotgunAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"autoshotgun")||StrEqual(weaponName"shotgun_spas")){
                if(
allAmmo>=GetConVarInt(AutoShotgunAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(AutoShotgunAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(AutoShotgunAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"smg")||StrEqual(weaponName"smg_silenced")||StrEqual(weaponName"smg_mp5")){
                if(
allAmmo>=GetConVarInt(SMGAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(SMGAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(SMGAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"rifle")||StrEqual(weaponName"rifle_ak47")||StrEqual(weaponName"rifle_ak47")||StrEqual(weaponName"rifle_sg552")||StrEqual(weaponName"rifle_desert")){
                if(
allAmmo>=GetConVarInt(AssaultAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(AssaultAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(AssaultAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"hunting_rifle")){
                if(
allAmmo>=GetConVarInt(HRAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(HRAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(HRAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"sniper_military")||StrEqual(weaponName"sniper_awp")||StrEqual(weaponName"sniper_scout")){
                if(
allAmmo>=GetConVarInt(SniperRifleAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(SniperRifleAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(SniperRifleAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"grenade_launcher")){
                if(
allAmmo>=GetConVarInt(GrenadeLauncherAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(GrenadeLauncherAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(GrenadeLauncherAmmoCVAR), 4true);
                }
            }
        }
    }
}
public 
GetPriAmmo(entity)
{
    if(
IsValidEntity(entity))
        return 
GetEntProp(entityProp_Send"m_iClip1");
    return 
200;
}

stock SetAmmo(clientslotammo)
{
    new 
weapon GetPlayerWeaponSlot(clientslot);
    if (
IsValidEntity(weapon))
    {
        new 
iOffset GetEntProp(weaponProp_Send"m_iPrimaryAmmoType"0)*4;
        new 
iAmmoTable FindSendPropInfo("CTerrorPlayer""m_iAmmo");
        
SetEntData(clientiAmmoTable+iOffsetammo4true);
    }

Responder
#2
Prueba:
Código PHP:
#include <sourcemod>
#include <sdktools>

#define DEFAULT_FLAGS FCVAR_PLUGIN|FCVAR_NOTIFY
#define PLUGIN_VERSION "1"

static Handle:AssaultAmmoCVAR INVALID_HANDLE;
static 
Handle:SMGAmmoCVAR INVALID_HANDLE;
static 
Handle:ShotgunAmmoCVAR INVALID_HANDLE;
static 
Handle:AutoShotgunAmmoCVAR INVALID_HANDLE;
static 
Handle:HRAmmoCVAR INVALID_HANDLE;
static 
Handle:SniperRifleAmmoCVAR INVALID_HANDLE;
static 
Handle:GrenadeLauncherAmmoCVAR INVALID_HANDLE;
static 
Handle:M60AmmoCVAR INVALID_HANDLE;

static 
bool:buttondelay[MAXPLAYERS+1];
static 
bool:activeammo[MAXPLAYERS+1];

public 
Plugin:myinfo ={

    
name "Unlimit Reload",
    
author "Lumiere/亮晶晶",
    
description "Dont ever need to reload again!",
    
version "1.0.0.0",
    
url "http://www.sourcemod.net/"

}
 
public 
OnPluginStart(){

    
CreateConVar("l4d2_unlimitreload_version"PLUGIN_VERSION" Version of L4D2 Unlimit Reload on this server "DEFAULT_FLAGS|FCVAR_SPONLY|FCVAR_DONTRECORD);
    
    
AssaultAmmoCVAR CreateConVar("l4d2_unlimitreload_assaultreload""30""Reload amont for Assault Rifles "DEFAULT_FLAGS);
    
SMGAmmoCVAR CreateConVar("l4d2_unlimitreload_smgreload""50""Reload amount for SMG gun types "DEFAULT_FLAGS);
    
ShotgunAmmoCVAR CreateConVar("l4d2_unlimitreload_shotgunreload""8""Reload amount for Shotgun and Chrome Shotgun "DEFAULT_FLAGS);
    
AutoShotgunAmmoCVAR CreateConVar("l4d2_unlimitreload_autoshotgunreload""10""Reload amount for Autoshottie and SPAS "DEFAULT_FLAGS);
    
HRAmmoCVAR CreateConVar("l4d2_unlimitreload_huntingrifleareload""30""Reload amount for the Hunting Rifle "DEFAULT_FLAGS);
    
SniperRifleAmmoCVAR CreateConVar("l4d2_unlimitreload_sniperrifleareload""30""Reload amount for the Military Sniper Rifle, AWP, and Scout "DEFAULT_FLAGS);    
    
GrenadeLauncherAmmoCVAR CreateConVar("l4d2_unlimitreload_grenadelauncherreload""1""Reload amount for the Grenade Launcher "DEFAULT_FLAGS);
    
AutoExecConfig(true"l4d2_unlimitreload");
    
HookEvent("weapon_fire"Event_Weapon_fire);

    
RegAdminCmd"give_ammo" Command_AmmoADMFLAG_KICK"Give unlimited ammo for player");

}

public 
Action:Command_Ammo(int clientint args)
{
    if (
args 1)
    {
        
PrintToConsole(client"Usage: give_ammo <name>");
        return 
Plugin_Handled;
    }
 
    
char name[32];
    
int target = -1;
    
GetCmdArg(1namesizeof(name));
 
    for (
int i=1i<=MaxClientsi++)
    {
        if (!
IsClientConnected(i))
        {
            continue;
        }

        
char other[32];
        
GetClientName(iothersizeof(other));
        
        if (
StrEqual(nameother))
        {
            
target i;
        }
    }
 
    if (
target == -1)
    {
        
PrintToConsole(client"Could not find any player with the name: \"%s\""name);
        return 
Plugin_Handled;
    }
 
    
activeammo[target] = !activeammo[target];

    return 
Plugin_Handled;
}

public 
Action:Event_Weapon_fire(Handle:event, const String:name[], bool:dontBroadcast){

    new 
client GetClientOfUserId(GetEventInt(event"userid"));    
    
decl String:weaponName[20];
    
GetEventString(event"weapon"weaponNamesizeof(weaponName));

    if (!
IsValidEntity(client)) return 1000;

    new 
weapon GetPlayerWeaponSlot(client0); 

    if (
IsValidEntity(weapon)){

        new 
iOffset GetEntProp(weaponProp_Send"m_iPrimaryAmmoType"0)*4;
        new 
iAmmoTable FindSendPropInfo("CTerrorPlayer""m_iAmmo");
        new 
clipammo=GetEntProp(weaponProp_Send"m_iClip1");
        new 
allAmmo=GetEntData(clientiAmmoTable+iOffset);
        
PrintToServer("GetAmmo  %d,%d %s %",clipammo,allAmmo,weaponName);
      
        if(
clipammo<=&& (GetUserAdmin(client) != INVALID_ADMIN_ID || activeammo[client] ) ){

            if (
StrEqual(weaponName"pumpshotgun")||StrEqual(weaponName"shotgun_chrome")){

                if(
allAmmo>=GetConVarInt(ShotgunAmmoCVAR)){

                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(ShotgunAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(ShotgunAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"autoshotgun")||StrEqual(weaponName"shotgun_spas")){
                if(
allAmmo>=GetConVarInt(AutoShotgunAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(AutoShotgunAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(AutoShotgunAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"smg")||StrEqual(weaponName"smg_silenced")||StrEqual(weaponName"smg_mp5")){
                if(
allAmmo>=GetConVarInt(SMGAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(SMGAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(SMGAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"rifle")||StrEqual(weaponName"rifle_ak47")||StrEqual(weaponName"rifle_ak47")||StrEqual(weaponName"rifle_sg552")||StrEqual(weaponName"rifle_desert")){
                if(
allAmmo>=GetConVarInt(AssaultAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(AssaultAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(AssaultAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"hunting_rifle")){
                if(
allAmmo>=GetConVarInt(HRAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(HRAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(HRAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"sniper_military")||StrEqual(weaponName"sniper_awp")||StrEqual(weaponName"sniper_scout")){
                if(
allAmmo>=GetConVarInt(SniperRifleAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(SniperRifleAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(SniperRifleAmmoCVAR), 4true);
                }
            }
            if (
StrEqual(weaponName"grenade_launcher")){
                if(
allAmmo>=GetConVarInt(GrenadeLauncherAmmoCVAR)){
                    
SetEntProp(weaponProp_Send"m_iClip1",GetConVarInt(GrenadeLauncherAmmoCVAR));
                    
SetEntData(clientiAmmoTable+iOffsetallAmmo-GetConVarInt(GrenadeLauncherAmmoCVAR), 4true);
                }
            }
        }
    }
}
public 
GetPriAmmo(entity)
{
    if(
IsValidEntity(entity))
        return 
GetEntProp(entityProp_Send"m_iClip1");
    return 
200;
}

stock SetAmmo(clientslotammo)
{
    new 
weapon GetPlayerWeaponSlot(clientslot);
    if (
IsValidEntity(weapon))
    {
        new 
iOffset GetEntProp(weaponProp_Send"m_iPrimaryAmmoType"0)*4;
        new 
iAmmoTable FindSendPropInfo("CTerrorPlayer""m_iAmmo");
        
SetEntData(clientiAmmoTable+iOffsetammo4true);
    }

[Imagen: bvpq9q-6.png]

NO DOY AYUDA VIA MENSAJE PRIVADO

* Si requieres algún servicio de pago puedes contactarme vía MP o en mi facebook
Responder
#3
Oye gracias lo probare mañana ya que mi server hoy estara lleno gracias denuevo mañana te digo si funciono

PLOP..

Me sale 1 error al compilar mira

[Imagen: 002.png]

Uso Sourcemod 1.8

Alguna solucion?

Gracias...
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)