Raised This Month: $ Target: $400
 0% 

Help with plugin


Post New Thread Reply   
 
Thread Tools Display Modes
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 06-06-2017 , 21:15   Re: Help with plugin
Reply With Quote #11

Quote:
Originally Posted by dzinks2009 View Post
how am i supposed to know if a player spawned tho?
hook player_spawn and check if player is alive
if alive and kill is true then forceplayersuicidie
8guawong is offline
dzinks2009
Junior Member
Join Date: Dec 2015
Old 06-06-2017 , 22:19   Re: Help with plugin
Reply With Quote #12

Quote:
Originally Posted by 8guawong View Post
hook player_spawn and check if player is alive
if alive and kill is true then forceplayersuicidie
I hooked up playerspawn but how do i use it now? Sorry, Im kind of new in c++
dzinks2009 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 06-06-2017 , 23:12   Re: Help with plugin
Reply With Quote #13

Quote:
Originally Posted by dzinks2009 View Post
I hooked up playerspawn but how do i use it now? Sorry, Im kind of new in c++
PHP Code:
#include <sdktools>

public OnPluginStart()
{
    
HookEvent("player_spawn"Action:Event_PlayerSpawn);
}
public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (
IsPlayerAlive(client) && g_bKill)
        
ForcePlayerSuicide(client);


Last edited by 8guawong; 06-06-2017 at 23:13.
8guawong is offline
dzinks2009
Junior Member
Join Date: Dec 2015
Old 06-07-2017 , 00:15   Re: Help with plugin
Reply With Quote #14

Like I said before,
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
new bool:Kill false;

public 
OnPluginStart()
{
    
CreateConVar("sm_cannounce_version"VERSION"Anti-Reconnecting"FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
HookEvent("round_start"Event_RoundStart);
    
HookEvent("round_end"Event_RoundEnd);
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
Float:Time float(30);
    new 
client     GetClientOfUserId(GetEventInt(event"userid"));
    
Kill false;
    
TimerRawr CreateTimer(TimeKillingclient);
}

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

    
Kill false;
}

public 
Action:Killing(Handle:timerany:client)
{
    
Kill true;
}

public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (!
client)
    {
        return;    
    }
        
    if(
IsClientInGame(client) && IsPlayerAlive(client)){
        if(
Kill){
            
ForcePlayerSuicide(client);
            
PrintToChat(client"[Late Spawn] You have been slayed for spawning late!");
        }
    }

I want this to work.

The broken part is Event_PlayerSpawn because when someone joins server, they get slayed when they didnt even get to pick the team.

Last edited by dzinks2009; 06-07-2017 at 00:16.
dzinks2009 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 06-07-2017 , 03:51   Re: Help with plugin
Reply With Quote #15

Quote:
Originally Posted by dzinks2009 View Post
Like I said before,
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
new bool:Kill false;

public 
OnPluginStart()
{
    
CreateConVar("sm_cannounce_version"VERSION"Anti-Reconnecting"FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
HookEvent("round_start"Event_RoundStart);
    
HookEvent("round_end"Event_RoundEnd);
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
Float:Time float(30);
    new 
client     GetClientOfUserId(GetEventInt(event"userid"));
    
Kill false;
    
TimerRawr CreateTimer(TimeKillingclient);
}

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

    
Kill false;
}

public 
Action:Killing(Handle:timerany:client)
{
    
Kill true;
}

public 
Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(event"userid"));
    if (!
client)
    {
        return;    
    }
        
    if(
IsClientInGame(client) && IsPlayerAlive(client)){
        if(
Kill){
            
ForcePlayerSuicide(client);
            
PrintToChat(client"[Late Spawn] You have been slayed for spawning late!");
        }
    }

I want this to work.

The broken part is Event_PlayerSpawn because when someone joins server, they get slayed when they didnt even get to pick the team.
i'm not sure how that is possible
you have to be in a team to be alive
8guawong is offline
dzinks2009
Junior Member
Join Date: Dec 2015
Old 06-07-2017 , 10:29   Re: Help with plugin
Reply With Quote #16

Quote:
Originally Posted by 8guawong View Post
i'm not sure how that is possible
you have to be in a team to be alive

That's the thing, I don't know myself. When the player connects(not ingame yet), it says the message already. In the code, there's IsPlayerAlive and all the other checks but for some reason it skips them.
dzinks2009 is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 06-07-2017 , 11:16   Re: Help with plugin
Reply With Quote #17

Check players team?
midnight9 is offline
dzinks2009
Junior Member
Join Date: Dec 2015
Old 06-07-2017 , 18:50   Re: Help with plugin
Reply With Quote #18

Quote:
Originally Posted by midnight9 View Post
Check players team?

How would I check it ?

int iTeam = GetClientTeam(client);

?
dzinks2009 is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 06-07-2017 , 20:29   Re: Help with plugin
Reply With Quote #19

if (GetClientTeam(client) > 1)

Last edited by 8guawong; 06-07-2017 at 20:29.
8guawong 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 03:38.


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