AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] Set Weapon Clip and BP ammo (https://forums.alliedmods.net/showthread.php?t=243112)

Roccoxx 06-29-2014 19:13

[CS:GO] Set Weapon Clip and BP ammo
 
hi i have a dude, how i can set in my deagle 1/0 ammo

y have this code, but not works, and i try after give weapon:

PHP Code:

case 15:{
            
Client_RemoveAllWeapons(client"weapon_knife"true);
            
GivePlayerItem(client"weapon_deagle")
            
            
Client_SetWeaponClipAmmo(client"weapon_deagle"4);
            
Client_SetWeaponPlayerAmmo(client"weapon_deagle"5);
            
//Client_GiveWeaponAndAmmo(client, "weapon_deagle", false, 0)
            //Client_GiveWeaponAndAmmo(client, "weapon_deagle", true, 7, -1, 8, -1)
        


sorry for my bad english :S

thanks for read

Bacardi 06-30-2014 08:38

Re: [CS:GO] Set Weapon Clip and BP ammo
 
well if you use berni smlib
http://www.sourcemodplugins.org/smlib/

PHP Code:

stock Client_GiveWeaponAndAmmo(client, const String:className[], bool:switchTo=trueprimaryAmmo=-1secondaryAmmo=-1primaryClip=-1secondaryClip=-1);

stock Client_RemoveAllWeapons(client, const String:exclude[]=""bool:clearAmmo=false); 

PHP Code:


#include <smlib>

public OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action:test(clientargs)
{
    
Client_RemoveAllWeapons(client"weapon_knife"true);
    
Client_GiveWeaponAndAmmo(client"weapon_deagle"_0_1);

    return 
Plugin_Handled;


But if you stand inside buy zone, player refill automatically ammo, so you need disable buy zone for prevent it.

Roccoxx 06-30-2014 11:41

Re: [CS:GO] Set Weapon Clip and BP ammo
 
Quote:

Originally Posted by Bacardi (Post 2159646)
But if you stand inside buy zone, player refill automatically ammo, so you need disable buy zone for prevent it.

thanks :), but i not found how remove buy zone ent :S

i set ammo cvars to 0 :/

Bacardi 06-30-2014 11:53

Re: [CS:GO] Set Weapon Clip and BP ammo
 
Quote:

Originally Posted by Roccoxx (Post 2159757)
thanks :), but i not found how remove buy zone ent :S

i set ammo cvars to 0 :/

that works too.

anyway, here snip
PHP Code:

...
    new 
ent MaxClients+1;
    new 
bool:DisableBuyZone false;

    while( (
ent FindEntityByClassname(ent"func_buyzone")) != -)
    {
        
DisableBuyZone AcceptEntityInput(ent"Disable"):AcceptEntityInput(ent"Enable");
    }
... 


Roccoxx 06-30-2014 14:06

Re: [CS:GO] Set Weapon Clip and BP ammo
 
Quote:

Originally Posted by Bacardi (Post 2159771)
that works too.

anyway, here snip
PHP Code:

...
    new 
ent MaxClients+1;
    new 
bool:DisableBuyZone false;

    while( (
ent FindEntityByClassname(ent"func_buyzone")) != -)
    {
        
DisableBuyZone AcceptEntityInput(ent"Disable"):AcceptEntityInput(ent"Enable");
    }
... 


why not this?

PHP Code:

public OnConfigsExecuted()
{
    new 
ent = -1;
    while((
ent FindEntityByClassname(ent"func_buyzone")) != -1)
    {
        
AcceptEntityInput(ent"Disable");
    }



Bacardi 06-30-2014 14:37

Re: [CS:GO] Set Weapon Clip and BP ammo
 
Quote:

Originally Posted by Roccoxx (Post 2159859)
why not this?

Well, why not ?
Do what ever you like. :bee:

Roccoxx 07-01-2014 20:45

Re: [CS:GO] Set Weapon Clip and BP ammo
 
Quote:

Originally Posted by Bacardi (Post 2159874)
Well, why not ?
Do what ever you like. :bee:

this not works, i have a deagle with 7/0 ammo, i need 1/0

PHP Code:

public OnConfigsExecuted() 

    new 
ent = -1
    while((
ent FindEntityByClassname(ent"func_buyzone")) != -1
    { 
        
AcceptEntityInput(ent"Disable"); 
    } 


where i put this code ?

PHP Code:

new ent MaxClients+1
    new 
bool:DisableBuyZone false

    while( (
ent FindEntityByClassname(ent"func_buyzone")) != -
    { 
        
DisableBuyZone AcceptEntityInput(ent"Disable"):AcceptEntityInput(ent"Enable"); 
    } 

thanks for help me :bee:

Roccoxx 07-10-2014 18:56

Re: [CS:GO] Set Weapon Clip and BP ammo
 
someone can help me?

Roccoxx 07-28-2014 00:21

Re: [CS:GO] Set Weapon Clip and BP ammo
 
Quote:

Originally Posted by Roccoxx (Post 2165419)
someone can help me?


kadet.89 07-28-2014 01:11

Re: [CS:GO] Set Weapon Clip and BP ammo
 
Put it inside "RoundStart_Event" function:

PHP Code:

#include <sourcemod> 

public OnPluginStart() 

     
HookEvent("round_start",RoundStart_Event); 


public 
RoundStart_Event(Handle:event, const String:name[], bool:dontBroadcast

     
//here!


You may have to add a small delay before removing this entity, but I'm not quite sure


All times are GMT -4. The time now is 16:31.

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