Raised This Month: $32 Target: $400
 8% 

Solved Function to detect going into spec?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nickolay
Member
Join Date: Jan 2020
Old 09-06-2021 , 02:35   Function to detect going into spec?
Reply With Quote #1

Hi,
trying to edit a script so whenever you enter spectator, it kills the icon.
As the icon is still there when you enter spec.

Any tips/hints/howto's on how to do this?

Code:
public void RemoveIcon(int client) {
	if(g_iIcon[client] > 0 && IsValidEdict(g_iIcon[client])) {
		AcceptEntityInput(g_iIcon[client], "Kill");
		g_iIcon[client] = -1;
	}
}
__________________
Steam // Discord: Nickolay#3117

Last edited by Nickolay; 09-07-2021 at 18:01.
Nickolay is offline
BeepIsla
Member
Join Date: Mar 2020
Location: Germany
Old 09-06-2021 , 05:54   Re: Function to detect going into spec?
Reply With Quote #2

Use the "player_team" event, when a client changes team to spectator simply call that RemoveIcon function
BeepIsla is offline
Cruze
Veteran Member
Join Date: May 2017
Old 09-06-2021 , 12:06   Re: Function to detect going into spec?
Reply With Quote #3

PHP Code:
public void OnPluginStart()
{
    
HookEvent("player_team"Event_PlayerTeam);
}

public 
void Event_PlayerTeam(Event ev, const char[] namebool dbc)
{
    
int client GetClientOfUserId(ev.GetInt("userid"));
    
int team ev.GetInt("team");
    
    if(
IsPlayerAlive(client) && team == 1)
    {
        
RemoveIcon(client);
    }

__________________
Taking paid private requests! Contact me

Last edited by Cruze; 09-06-2021 at 12:06.
Cruze is offline
Nickolay
Member
Join Date: Jan 2020
Old 09-07-2021 , 01:08   Re: Function to detect going into spec?
Reply With Quote #4

Thanks for the help, though came across an issue with the RemoveIcon function.

It's not deleting the icon? Any clue why it wouldn't?
__________________
Steam // Discord: Nickolay#3117
Nickolay is offline
Cruze
Veteran Member
Join Date: May 2017
Old 09-08-2021 , 01:08   Re: Function to detect going into spec?
Reply With Quote #5

Quote:
Originally Posted by Nickolay View Post
Thanks for the help, though came across an issue with the RemoveIcon function.

It's not deleting the icon? Any clue why it wouldn't?
You gotta share more code for that
Cruze is offline
Reply


Thread Tools
Display Modes

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 00:52.


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