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

First player to connect receive slay


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
qTupeu
Junior Member
Join Date: Jun 2018
Old 08-07-2018 , 05:50   First player to connect receive slay
Reply With Quote #1

Hello,

I really REALLY need a plugin for this.
How can I make so that only the first player to connect to the server will get slain?
qTupeu is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-09-2018 , 17:28   Re: First player to connect receive slay
Reply With Quote #2

Lol. Seems a strange request.

You're best to post the in the requests forum.

Please dont make a new thread. I've reported this one asking it be moved
__________________
Neuro Toxin is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 08-09-2018 , 19:24   Re: First player to connect receive slay
Reply With Quote #3

PHP Code:
#include <sourcemod>

#pragma semicolon 1

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

public 
Action Event_Spawn(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    for (
int i 1MaxClientsi++)
        if (
GetAlivePlayers() == 1)
                
SetEntityHealth(i0);
}

public 
int GetAlivePlayers()
{
    
int iCount;
    
    for (
int i 1MaxClientsi++)
        if (
MaxClients && IsClientInGame(i))
            if (
IsPlayerAlive(i))
                
iCount++;
    
    return 
iCount;

mug1wara is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 08-09-2018 , 22:50   Re: First player to connect receive slay
Reply With Quote #4

Quote:
Originally Posted by mug1wara View Post
PHP Code:
#include <sourcemod>

#pragma semicolon 1

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

public 
Action Event_Spawn(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    for (
int i 1MaxClientsi++)
        if (
GetAlivePlayers() == 1)
                
SetEntityHealth(i0);
}

public 
int GetAlivePlayers()
{
    
int iCount;
    
    for (
int i 1MaxClientsi++)
        if (
MaxClients && IsClientInGame(i))
            if (
IsPlayerAlive(i))
                
iCount++;
    
    return 
iCount;

Why not just use GetClientCount() along with ForcePlayerSuicide() rather than creating a public function (that doesn't even need to be public) and setting the health to 0?

PHP Code:
if (GetClientCount(true) == && IsPlayerAlive(client))
{
     
ForcePlayerSuicide(client);

__________________

Last edited by Psyk0tik; 08-09-2018 at 22:51.
Psyk0tik is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 08-10-2018 , 01:50   Re: First player to connect receive slay
Reply With Quote #5

Because I wasn't thinking about ForcePlayerSuicide() & GetClientCount(true)...
mug1wara 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 04:34.


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