Raised This Month: $89 Target: $400
 22% 

Block team move while alive


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TrullSin
Senior Member
Join Date: Jun 2018
Old 08-29-2018 , 01:31   Block team move while alive
Reply With Quote #1

Hi, can someone make me a plugin that blocks team change when you are alive, you can only change when you are alive and give message in chat if you try to move when alive.
TrullSin is offline
dustinandband
Senior Member
Join Date: May 2015
Old 08-29-2018 , 03:07   Re: Block team move while alive
Reply With Quote #2

What Game is it? Does this work?

PHP Code:
#include <sourcemod>

public Plugin:myinfo =
{
    
name "block team change",
    
author "dustin",
    
description "blocks team change command when players are alive",
    
version "1.0",
    
url "",
};

public 
OnPluginStart()
{
    
AddCommandListener(CommandJoinTeam"jointeam");
}

public 
Action CommandJoinTeam(client, const char[] commandargs)
{
    if (
IsPlayerAlive(client))
    {
        
ReplyToCommand(client"You Can't Use this command while alive.")
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;

dustinandband is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 08-29-2018 , 15:07   Re: Block team move while alive
Reply With Quote #3

Quote:
Originally Posted by dustinandband View Post
What Game is it? Does this work?

PHP Code:
#include <sourcemod>

public Plugin:myinfo =
{
    
name "block team change",
    
author "dustin",
    
description "blocks team change command when players are alive",
    
version "1.0",
    
url "",
};

public 
OnPluginStart()
{
    
AddCommandListener(CommandJoinTeam"jointeam");
}

public 
Action CommandJoinTeam(client, const char[] commandargs)
{
    if (
IsPlayerAlive(client))
    {
        
ReplyToCommand(client"You Can't Use this command while alive.")
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;

You should check first if the client != 0 and if the client is in game.
Ilusion9 is offline
TrullSin
Senior Member
Join Date: Jun 2018
Old 08-29-2018 , 18:28   Re: Block team move while alive
Reply With Quote #4

It is for CS:GO
TrullSin is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 08-30-2018 , 09:33   Re: Block team move while alive
Reply With Quote #5

PHP Code:

#include <sourcemod> 

public Plugin:myinfo 

    
name "block team change"
    
author "dustin"
    
description "blocks team change command when players are alive"
    
version "1.0"
    
url ""
}; 

public 
OnPluginStart() 

    
AddCommandListener(CommandJoinTeam"jointeam"); 


public 
Action CommandJoinTeam(client, const char[] commandargs

    if (
client)
    {
        if (
IsClientInGame(client))
        {
            if (
IsPlayerAlive(client)) 
            { 
                
ReplyToCommand(client"You cannot use this command while alive."
                return 
Plugin_Handled
            } 
        }
    }

    return 
Plugin_Continue

Ilusion9 is offline
potatoz
AlliedModders Donor
Join Date: Nov 2016
Old 09-03-2018 , 10:00   Re: Block team move while alive
Reply With Quote #6

Both of these codes use a messy mix of old and new syntax and has uncompleted code (";") They do however have the basis down, try this;

PHP Code:
#include <sourcemod>
#pragma semicolon 1

#define VERSION "1.0"

public Plugin:myinfo =
{
    
name "block team change",
    
author "potatoz",
    
description "blocks team changes whilst client is alive",
    
version VERSION,
    
url ""
};

public 
OnPluginStart()
{
    
AddCommandListener(Command_JoinTeam"jointeam");    
}

public 
Action Command_JoinTeam(int clientchar[] commandint args)
{
    if(!
client || !IsClientInGame(client) || IsFakeClient(client))
        return 
Plugin_Continue;
        
    if(
IsPlayerAlive(client))
    {
        
ReplyToCommand(client" \x07You may not switch team whilst alive")  
        return 
Plugin_Handled;  
    }
    
    return 
Plugin_Continue;

Attached Files
File Type: sp Get Plugin or Get Source (blockteamchange.sp - 50 views - 684 Bytes)
__________________
potatoz is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 09-04-2018 , 13:16   Re: Block team move while alive
Reply With Quote #7

He can fix some ';', and that ',' at the end of the url (i just copied it).
Also why you check if the client is fake? Lets talk about basis.
Ilusion9 is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 09-06-2018 , 13:21   Re: Block team move while alive
Reply With Quote #8

Quote:
Originally Posted by potatoz View Post
Both of these codes use a messy mix of old and new syntax and has uncompleted code (";") They do however have the basis down
ironically that your edit still had missing parts of transitional syntax , so here:

PHP Code:
#include <sourcemod>

#pragma newdecls required //Force (basics) of Transitional Syntax

public Plugin myinfo =
{
    
name "block team change",
    
author "potatoz",
    
description "blocks team changes whilst client is alive",
    
version "1.0",
    
url ""
};

public 
void OnPluginStart()
{
    
AddCommandListener(Command_JoinTeam"jointeam");
}

public 
Action Command_JoinTeam(int clientchar[] commandint args)
{
    if(
<= client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client))
    {
        
ReplyToCommand(client" \x07You may not switch team whilst alive");
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;

__________________
xines is offline
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 09-06-2018 , 14:15   Re: Block team move while alive
Reply With Quote #9

Quote:
Originally Posted by xines View Post
ironically that your edit still had missing parts of transitional syntax , so here:
what edit?
Ilusion9 is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 09-06-2018 , 14:32   Re: Block team move while alive
Reply With Quote #10

Quote:
Originally Posted by Ilusion9 View Post
what edit?
potatoz "script" is a edit of the first script posted, as it's not entirely equal to either your edit or the first base script post...
__________________
xines 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 17:15.


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