AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Join spec, kill player (https://forums.alliedmods.net/showthread.php?t=232932)

Qvantry 01-06-2014 22:29

Join spec, kill player
 
Hey, when I want the player to join spectator using this:

PHP Code:

public CmdSpectator(iPlayer)
{
    
cs_set_user_team(iPlayerCS_TEAM_SPECTATOR);
    
ColorChat(iPlayerGREY"^4%s You joined ^4Spectator^1!"TAG)


But I also want to kill the player that joins spec, how do I kill him?

11922911 01-06-2014 22:33

Re: Join spec, kill player
 
Quote:

Originally Posted by Qvantry (Post 2082260)
Hey, when I want the player to join spectator using this:

PHP Code:

public CmdSpectator(iPlayer)
{
    
cs_set_user_team(iPlayerCS_TEAM_SPECTATOR);
    
ColorChat(iPlayerGREY"^4%s You joined ^4Spectator^1!"TAG)


But I also want to kill the player that joins spec, how do I kill him?

Quote:

/* Kills player. When flag is set to 1 then death won't decrase frags. */
native user_kill(index,flag=0);

Qvantry 01-07-2014 00:16

Re: Join spec, kill player
 
I don't understand what to do with that, when I write it in CmdSpectator I get errors, and when I write the native outside of it and just write user_kill inside CmdSpectator I also get errors.

11922911 01-07-2014 00:35

Re: Join spec, kill player
 
Try:
PHP Code:

public CmdSpectator(iPlayer)
{
    
user_kill(iPlayer0);
    
cs_set_user_team(iPlayerCS_TEAM_SPECTATOR);
    
ColorChat(iPlayerGREY"^4%s You joined ^4Spectator^1!"TAG);


Use user_kill(iPlayer, 1) If you don't want to lose frags.

Qvantry 01-07-2014 11:36

Re: Join spec, kill player
 
Quote:

Originally Posted by 11922911 (Post 2082294)
Try:
PHP Code:

public CmdSpectator(iPlayer)
{
    
user_kill(iPlayer0);
    
cs_set_user_team(iPlayerCS_TEAM_SPECTATOR);
    
ColorChat(iPlayerGREY"^4%s You joined ^4Spectator^1!"TAG);


Use user_kill(iPlayer, 1) If you don't want to lose frags.

Thanks, works perfectly :)


All times are GMT -4. The time now is 10:09.

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