AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   Block team move while alive (https://forums.alliedmods.net/showthread.php?t=310308)

TrullSin 08-29-2018 01:31

Block team move while alive
 
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.

dustinandband 08-29-2018 03:07

Re: Block team move while alive
 
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;



Ilusion9 08-29-2018 15:07

Re: Block team move while alive
 
Quote:

Originally Posted by dustinandband (Post 2612681)
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.

TrullSin 08-29-2018 18:28

Re: Block team move while alive
 
It is for CS:GO

Ilusion9 08-30-2018 09:33

Re: Block team move while alive
 
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



potatoz 09-03-2018 10:00

Re: Block team move while alive
 
1 Attachment(s)
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;



Ilusion9 09-04-2018 13:16

Re: Block team move while alive
 
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.

xines 09-06-2018 13:21

Re: Block team move while alive
 
Quote:

Originally Posted by potatoz (Post 2613504)
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 :lol:, 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;



Ilusion9 09-06-2018 14:15

Re: Block team move while alive
 
Quote:

Originally Posted by xines (Post 2614035)
ironically that your edit still had missing parts of transitional syntax :lol:, so here:

what edit?

xines 09-06-2018 14:32

Re: Block team move while alive
 
Quote:

Originally Posted by Ilusion9 (Post 2614040)
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...


All times are GMT -4. The time now is 13:22.

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