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

problem with this script (remove)


Post New Thread Reply   
 
Thread Tools Display Modes
Nexd
BANNED
Join Date: Dec 2013
Location: Hungary
Old 02-11-2019 , 10:30   Re: problem with this script (remove)
Reply With Quote #11

Quote:
Originally Posted by Rowdy4E View Post
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");

there is no hkp2000 in CSS, use USP instead
PHP Code:
if (StrContains(weaponName"usp"false) != -|| StrContains(weaponName"glock"false) != -1) { 
Nexd is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-11-2019 , 10:48   Re: problem with this script (remove)
Reply With Quote #12

i changed ""hkp2000" to "usp" its worked..but have 1 problem

i want at spawn remove usp or glock and replace deagle...after round start when i buy glock dont remove it..i cant pick up glock or usp now..i want remove 1 time in round start and spawn

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

Quote:
Originally Posted by generals View Post
i changed ""hkp2000" to "usp" its worked..but have 1 problem

i want at spawn remove usp or glock and replace deagle...after round start when i buy glock dont remove it..i cant pick up glock or usp now..i want remove 1 time in round start and spawn
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Rowdy"
#define PLUGIN_VERSION "1.02"

#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()
{
    
HookEvent("player_spawn"OnPlayerSpawn);
}

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

public 
void ReplaceGuns(int client) {
    
int weaponIndex;
    
char weaponName[64];
    
    if ((
weaponIndex GetPlayerWeaponSlot(client1)) != -1) {
        if (
IsValidEntity(weaponIndex)) {
            
GetEntityClassname(weaponIndexweaponNamesizeof(weaponName));
            if (
StrContains(weaponName"usp"false) != -|| StrContains(weaponName"glock"false) != -1) { 
                
RemovePlayerItem(clientweaponIndex);
                
AcceptEntityInput(weaponIndex"Kill");
                
GivePlayerItem(client"weapon_deagle");
            }
        }
    }

Rowdy4E is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-12-2019 , 06:16   Re: problem with this script (remove)
Reply With Quote #14

really thanks.. it's worked now

how can i add other weapons with ammo in round start.. i edit this code:

i see this error in compile: error 147: new-style declarations are required

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Rowdy"
#define PLUGIN_VERSION "1.02"

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

#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"));
    
    
ReplaceGuns(client);
}

public 
void ReplaceGuns(int client) {
    
int weaponIndex;
    
char weaponName[64];
    
    if ((
weaponIndex GetPlayerWeaponSlot(client1)) != -1) {
        if (
IsValidEntity(weaponIndex)) {
            
GetEntityClassname(weaponIndexweaponNamesizeof(weaponName));
            if (
StrContains(weaponName"usp"false) != -|| StrContains(weaponName"glock"false) != -1) { 
                
RemovePlayerItem(clientweaponIndex);
                
AcceptEntityInput(weaponIndex"Kill");
                
    new 
team GetClientTeam(client);
    if( 
team != && team == )
    {
        
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);
    } else if ( 
team != && team == 3)
    {
        
Client_GiveWeaponAndAmmo(client"weapon_deagle"true90);
        
Client_GiveWeaponAndAmmo(client"weapon_m4a1"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);
    }
    
            }
        }
    }

generals is offline
Rowdy4E
Junior Member
Join Date: Nov 2018
Location: Czech Republic
Old 02-12-2019 , 08:07   Re: problem with this script (remove)
Reply With Quote #15

Quote:
Originally Posted by generals View Post
really thanks.. it's worked now

how can i add other weapons with ammo in round start.. i edit this code:

i see this error in compile: error 147: new-style declarations are required
It means that you are doing it in old syntax

PHP Code:
new team GetClientTeam(client); 
Should be like this
PHP Code:
int team GetClientTeam(client); 
or you can just remove this line
PHP Code:
#pragma newdecls required 

Last edited by Rowdy4E; 02-12-2019 at 08:08.
Rowdy4E is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-12-2019 , 09:16   Re: problem with this script (remove)
Reply With Quote #16

hi..tnx but i have problem again

dont work...when i change:

PHP Code:
HookEvent("round_start"Event_Start); 
to
PHP Code:
HookEvent("player_spawn"Event_Start); 
work ..but have problem... first round create: 2 flashbang ..2grenade..1smoke...1deagle and 1 m4a1 for ct (ak47 for T)

when i use 1 smoke in current round... just give smoke on next round..whats the problem?

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

PHP Code:
#pragma semicolon 1
#define DEBUG

#define PLUGIN_AUTHOR "Rowdy"
#define PLUGIN_VERSION "1.02"

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

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);
    
HookEvent("round_start"Event_Start);
}

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

public 
void ReplaceGuns(int client) {
    
int weaponIndex;
    
char weaponName[64];
    
    if ((
weaponIndex GetPlayerWeaponSlot(client1)) != -1) {
        if (
IsValidEntity(weaponIndex)) {
            
GetEntityClassname(weaponIndexweaponNamesizeof(weaponName));
            if (
StrContains(weaponName"usp"false) != -|| StrContains(weaponName"glock"false) != -1) { 
                
RemovePlayerItem(clientweaponIndex);
                
AcceptEntityInput(weaponIndex"Kill");
                
GivePlayerItem(client"weapon_deagle");
            }
        }
    }
}


public 
Action Event_Start(Handle eventchar[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
NewGuns(client);
}

NewGuns(client)
{

    
int team GetClientTeam(client);
    
    if( 
team != && team == )
    {
        
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);
    } else if ( 
team != && team == 3)
    {
        
Client_GiveWeaponAndAmmo(client"weapon_m4a1"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);
    }
    


Last edited by generals; 02-12-2019 at 11:30.
generals is offline
Cruze
Veteran Member
Join Date: May 2017
Old 02-12-2019 , 10:14   Re: problem with this script (remove)
Reply With Quote #17

PHP Code:
public Action Event_Start(Handle eventchar[] namebool dontBroadcast)
{
    for(
int i 1<= MaxClientsi++)
    {
        
NewGuns(i);
    }

Wrote from mobile that's why couldn't use tab. But this should work!
__________________
Taking paid private requests! Contact me

Last edited by Cruze; 02-12-2019 at 11:39. Reason: now i'm from pc xd
Cruze is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-12-2019 , 10:57   Re: problem with this script (remove)
Reply With Quote #18

hi..problem not fix

When I use smoke in the first round, he gives me a smoke second round (remove flash and grenade)

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Rowdy"
#define PLUGIN_VERSION "1.02"

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

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);
    
HookEvent("round_start"Event_Start);
}

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

public 
void ReplaceGuns(int client) {
    
int weaponIndex;
    
char weaponName[64];
    
    if ((
weaponIndex GetPlayerWeaponSlot(client1)) != -1) {
        if (
IsValidEntity(weaponIndex)) {
            
GetEntityClassname(weaponIndexweaponNamesizeof(weaponName));
            if (
StrContains(weaponName"usp"false) != -|| StrContains(weaponName"glock"false) != -1) { 
                
RemovePlayerItem(clientweaponIndex);
                
AcceptEntityInput(weaponIndex"Kill");
                
GivePlayerItem(client"weapon_deagle");
            }
        }
    }
}

public 
Action Event_Start(Handle eventchar[] namebool dontBroadcast)
{
for(
int i 1<= MaxClientsi++)
{
NewGuns(i);
}
}  

NewGuns(client)
{

    
int team GetClientTeam(client);
    
    if( 
team != && team == )
    {
        
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);
    } else if ( 
team != && team == 3)
    {
        
Client_GiveWeaponAndAmmo(client"weapon_m4a1"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);
    }
    


Last edited by generals; 02-12-2019 at 11:29.
generals is offline
Cruze
Veteran Member
Join Date: May 2017
Old 02-12-2019 , 11:41   Re: problem with this script (remove)
Reply With Quote #19

maybe because roundstart's function and playerspawn's function is being executed together?
__________________
Taking paid private requests! Contact me
Cruze is offline
generals
Senior Member
Join Date: Aug 2018
Old 02-12-2019 , 11:49   Re: problem with this script (remove)
Reply With Quote #20

i just want add this code :

PHP Code:
    int team GetClientTeam(client);
    
    if( 
team != && team == )
    {
        
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);
    } else if ( 
team != && team == 3)
    {
        
Client_GiveWeaponAndAmmo(client"weapon_m4a1"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);
    } 
to this script:

PHP Code:
 #pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Rowdy"
#define PLUGIN_VERSION "1.02"

#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()
{
    
HookEvent("player_spawn"OnPlayerSpawn);
}

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

public 
void ReplaceGuns(int client) {
    
int weaponIndex;
    
char weaponName[64];
    
    if ((
weaponIndex GetPlayerWeaponSlot(client1)) != -1) {
        if (
IsValidEntity(weaponIndex)) {
            
GetEntityClassname(weaponIndexweaponNamesizeof(weaponName));
            if (
StrContains(weaponName"usp"false) != -|| StrContains(weaponName"glock"false) != -1) { 
                
RemovePlayerItem(clientweaponIndex);
                
AcceptEntityInput(weaponIndex"Kill");
                
GivePlayerItem(client"weapon_deagle");
            }
        }
    }

i want add 2flashbang ..2grenade..1smoke... and 1 m4a1 for ct (ak47 for T) in every round (at spawn)

Without manipulating the original script ..how can i do?
generals 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 12:48.


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