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

problem with this script (remove)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
generals
Senior Member
Join Date: Aug 2018
Old 02-11-2019 , 04:32   problem with this script (remove)
Reply With Quote #1

hi guys

i have problem ..i want remove only glock and usp every round and spawn .. but this script remove all weapons .. whats wrong?
Remove the glock from T and Remove the usp from CT and replace the deagle
for example: If someone bought a p228 or elite or awp ... don't remove and replace deagle and ak-47 on spawn
In simpler language (just remove glock and usp)

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

// If you use this please give me the credit :D

public Plugin:myinfo 
{
    
name "Remove Weapons",
    
author "Marcus",
    
description "Removes a players' weaopon(s) on spawn",
    
version "0.0.2",
    
url "http://www.sourcemod.net"
};

public 
OnPluginStart()
{
    
HookEvent("player_spawn"Event_Spawn);
    
HookEvent("round_start"Event_Start);
}

public 
Action:Event_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
GetClientOfUserId(GetEventInt(event"userid"));
    
RemoveWeapons(i)

}

public 
Action:Event_Start(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
GetClientOfUserId(GetEventInt(event"userid"));
    
RemoveWeapons(i)
}

RemoveWeapons(client)
{
    new 
team GetClientTeam(client);
    
    
Client_RemoveAllWeapons(client"weapon_usp"true); // Removes all the weapons ; Add a weapon name into the "" to exclude that weapon.
    
Client_RemoveAllWeapons(client"weapon_glock"true); 
    if( 
team != && team == // Checks if the player is not a spectator and if the player is on Red Team
    
{
        
Client_GiveWeaponAndAmmo(client"weapon_deagle"true90); // Change weapon_glock to the weapon you want. 90 is the amount of ammo given.
        
Client_GiveWeaponAndAmmo(client"weapon_ak47"true90); // Change weapon_ak47 to the weapon you want.
        
Client_GiveWeaponAndAmmo(client"weapon_knife"true1);
        
Client_GiveWeaponAndAmmo(client"weapon_hegrenade"true2);
        
Client_GiveWeaponAndAmmo(client"weapon_flashbang"true2);
        
Client_GiveWeaponAndAmmo(client"weapon_smokegrenade"true1);
    } else if ( 
team != && team == 3// Checks if the player is not a spectator and if the player is on the Blu Team
    
{
        
Client_GiveWeaponAndAmmo(client"weapon_deagle"true90); // Change weapon_p228 to the weapon you want. 90 is the amount of ammo given.
        
Client_GiveWeaponAndAmmo(client"weapon_m4a1"true90); // Change weapon_m4a1 to the weapon you want.
        
Client_GiveWeaponAndAmmo(client"weapon_knife"true1);
        
Client_GiveWeaponAndAmmo(client"weapon_hegrenade"true2);
        
Client_GiveWeaponAndAmmo(client"weapon_flashbang"true2);
        
Client_GiveWeaponAndAmmo(client"weapon_smokegrenade"true1);
    }
    


Last edited by generals; 02-11-2019 at 04:41.
generals is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 02-11-2019 , 08:03   Re: problem with this script (remove)
Reply With Quote #2

so you want to replace the spawning weapon?
IF CSGO:
u can do it with these commands:
mp_ct_default_melee weapon_knife
mp_ct_default_secondary weapon_hkp2000
mp_ct_default_primary ""
mp_t_default_melee weapon_knife
mp_t_default_secondary weapon_glock
mp_t_default_primary ""

If css i can make a plugin, just let me know

Last edited by Nexd; 02-11-2019 at 08:05.
Nexd is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-11-2019 , 08:10   Re: problem with this script (remove)
Reply With Quote #3

hi

thanks for answer...css

can u edit this plugin? i want 2 grenade

"give weapon" worked perfectly..weapon remove don't work good

Last edited by generals; 02-11-2019 at 08:13.
generals is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 02-11-2019 , 08:42   Re: problem with this script (remove)
Reply With Quote #4

u can try this:
PHP Code:
#include <sourcemod>
#include <smlib>

public Plugin:myinfo =  

    
name "Remove Weapons"
    
author "Marcus, edited by Nexd"
    
description "Removes a players' weaopon(s) on spawn"
    
version "0.0.2"
};

public 
OnPluginStart() 

    
HookEvent("player_spawn"Event_Spawn); 
    
HookEvent("round_start"Event_Start); 


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

    new 
GetClientOfUserId(GetEventInt(event"userid")); 
    
RemoveWeapons(i);



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

    new 
GetClientOfUserId(GetEventInt(event"userid")); 
    
RemoveWeapons(i);


RemoveWeapons(client

    new 
team GetClientTeam(client); 
     
    
Client_RemoveAllWeapons(client); // Removes all the weapons ; Add a weapon name into the "" to exclude that weapon.  
    
if( team != && team == // Checks if the player is not a spectator and if the player is on Red Team 
    

        
Client_GiveWeaponAndAmmo(client"weapon_deagle"true90); // Change weapon_glock to the weapon you want. 90 is the amount of ammo given. 
        
Client_GiveWeaponAndAmmo(client"weapon_ak47"true90); // Change weapon_ak47 to the weapon you want. 
        
Client_GiveWeaponAndAmmo(client"weapon_knife"true1); 
        
Client_GiveWeaponAndAmmo(client"weapon_hegrenade"true1); 
        
Client_GiveWeaponAndAmmo(client"weapon_flashbang"true2); 
        
Client_GiveWeaponAndAmmo(client"weapon_smokegrenade"true1); 
    } else if ( 
team != && team == 3// Checks if the player is not a spectator and if the player is on the Blu Team 
    

        
Client_GiveWeaponAndAmmo(client"weapon_deagle"true90); // Change weapon_p228 to the weapon you want. 90 is the amount of ammo given. 
        
Client_GiveWeaponAndAmmo(client"weapon_m4a1"true90); // Change weapon_m4a1 to the weapon you want. 
        
Client_GiveWeaponAndAmmo(client"weapon_knife"true1); 
        
Client_GiveWeaponAndAmmo(client"weapon_hegrenade"true1); 
        
Client_GiveWeaponAndAmmo(client"weapon_flashbang"true2); 
        
Client_GiveWeaponAndAmmo(client"weapon_smokegrenade"true1); 
    } 
     

Nexd is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-11-2019 , 08:55   Re: problem with this script (remove)
Reply With Quote #5

when i buy p228 and awp...next round has been deleted (at spawn)
i want Remove the glock from T and Remove the usp from CT and replace the deagle
generals is offline
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 02-11-2019 , 09:01   Re: problem with this script (remove)
Reply With Quote #6

So you only want a deagle at spawn?
Nexd is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-11-2019 , 09:14   Re: problem with this script (remove)
Reply With Quote #7

no..

i have public server

i want every round create 2 flashbang ..2grenade..1smoke...1deagle and 1 m4a1 for ct (ak47 for T)

example::: if players buy p228 and awp (Any gun) dont remove this guns at spawn..if 1 flashbang used.. 1flashbang replaced it...

But there is an exception: remove glock and usp at spawn..(every round) and replace deagle

Script I put in the first post ...do everything good.. but have 1 problem (remove all weapons at spawn...i want just remove glock and usp ..but anything remove

srry for my bad english

Last edited by generals; 02-11-2019 at 09:16.
generals is offline
Rowdy4E
Junior Member
Join Date: Nov 2018
Location: Czech Republic
Old 02-11-2019 , 09:41   Re: problem with this script (remove)
Reply With Quote #8

Quote:
Originally Posted by generals View Post
hi guys

i have problem ..i want remove only glock and usp every round and spawn .. but this script remove all weapons .. whats wrong?
Remove the glock from T and Remove the usp from CT and replace the deagle
for example: If someone bought a p228 or elite or awp ... don't remove and replace deagle and ak-47 on spawn
In simpler language (just remove glock and usp)
I really don't know what you need from the plugin, but maybe try this?
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Rowdy"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo 
{
    
name "Replacing Guns?",
    
author PLUGIN_AUTHOR,
    
description "...",
    
version PLUGIN_VERSION,
    
url "https://steamcommunity.com/profiles/76561198307962930"
};

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

public 
void OnPlayerSpawn(Handle eventchar[] namebool dontBroadcast
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
ReplaceSecondary(client);
}

public 
void ReplaceSecondary(int client
{
    
int weaponIndex;
    
    if ((
weaponIndex GetPlayerWeaponSlot(client1)) != -1
    {
        
RemovePlayerItem(clientweaponIndex);
        if (
IsValidEntity(weaponIndex))
            
AcceptEntityInput(weaponIndex"Kill");
    }
    
    
GivePlayerItem(client"weapon_deagle");

Rowdy4E is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-11-2019 , 09:58   Re: problem with this script (remove)
Reply With Quote #9

Close up..

i want replace deagle when i have usp or glock .... when i have p228 or elite or other colt dont replace

---------------------------------------------
only remove this guns:

PHP Code:
    Client_RemoveAllWeapons(client"weapon_usp"true);
    
Client_RemoveAllWeapons(client"weapon_glock"true); 
add this guns:

PHP Code:
        Client_GiveWeaponAndAmmo(client"weapon_deagle"true90);
        
Client_GiveWeaponAndAmmo(client"weapon_ak47"true90); 
        
Client_GiveWeaponAndAmmo(client"weapon_knife"true1);
        
Client_GiveWeaponAndAmmo(client"weapon_hegrenade"true2);
        
Client_GiveWeaponAndAmmo(client"weapon_flashbang"true2);
        
Client_GiveWeaponAndAmmo(client"weapon_smokegrenade"true1); 
for example : if any one have awp ..dont replace ak-47 or m4a1 (i say again: just remove glock and usp and replace deagle .. if player have this guns) if dont have glock and usp... don't remove and don't replace deagle

Last edited by generals; 02-11-2019 at 10:05.
generals is offline
Rowdy4E
Junior Member
Join Date: Nov 2018
Location: Czech Republic
Old 02-11-2019 , 10:24   Re: problem with this script (remove)
Reply With Quote #10

Quote:
Close up..

i want replace deagle when i have usp or glock .... when i have p228 or elite or other colt dont replace
Hmm.. ok. Try this.

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Rowdy"
#define PLUGIN_VERSION "1.01"

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#pragma newdecls required

public Plugin myinfo 
{
    
name "Replacing Guns?",
    
author PLUGIN_AUTHOR,
    
description "...",
    
version PLUGIN_VERSION,
    
url "https://steamcommunity.com/profiles/76561198307962930"
};

public 
void OnPluginStart()
{
    
// ...
}

public 
void OnClientPostAdminCheck(int client) {
    
SDKHook(clientSDKHook_WeaponSwitchOnWeaponSwitch);
}

public 
void OnClientDisconnect(int client) {
    
SDKUnhook(clientSDKHook_WeaponSwitchOnWeaponSwitch);
}

public 
void OnWeaponSwitch(int clientint weapon) {
    
char weaponName[64];
    if (
IsValidEntity(weapon)) {
        
GetEntityClassname(weaponweaponNamesizeof(weaponName));
        if (
StrContains(weaponName"hkp2000"false) != -|| StrContains(weaponName"glock"false) != -1) {
            if (
IsClientInGame(client) && IsPlayerAlive(client)) {
                
RemovePlayerItem(clientweapon);
                
AcceptEntityInput(weapon"Kill");
                
CreateTimer(0.7GiveDeagleclient);
            }
        }
    }
}

public 
Action GiveDeagle(Handle timerint client) {
    if (
IsClientInGame(client) && IsPlayerAlive(client))
        
GivePlayerItem(client"weapon_deagle");


Last edited by Rowdy4E; 02-11-2019 at 10:26.
Rowdy4E 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 17:59.


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