Raised This Month: $ Target: $400
 0% 

Just... how to make this toggleable


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bonkorn
Senior Member
Join Date: Jul 2015
Old 08-31-2017 , 02:42   Just... how to make this toggleable
Reply With Quote #1

Title says all.
PHP Code:
public OnPluginStart() 

    
RegAdminCmd("sm_head"ResizeHeadADMFLAG_CUSTOM5""); 


public 
Action:ResizeHead(clientargs)
{
    if()
    {
        
ServerCommand("sm_resizehead #%i 3"GetClientUserId(client)); 
        
ReplyToCommand(client"[SM] Head size resized to big!");
    }
    else
    {
        
ServerCommand("sm_resizehead #%i 1"GetClientUserId(client)); 
        
ReplyToCommand(client"[SM] Head size returned to normal!");
    }
    return 
Plugin_Handled;

Bonkorn is offline
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 08-31-2017 , 03:20   Re: Just... how to make this toggleable
Reply With Quote #2

You mean add convar?
ItsExTacY is offline
Bonkorn
Senior Member
Join Date: Jul 2015
Old 08-31-2017 , 04:02   Re: Just... how to make this toggleable
Reply With Quote #3

Not sure what is convar but maybe not since it execute server command instead of changing convar on client.
I used this as reference:
PHP Code:
public Action:CmdBhopToggle(clientargs)
{    
    if(
bBhopLazyModes[client])
    {
        
bBhopLazyModes[client] = false;
        
ReplyToCommand(client"[SM] Bunnyhop disabled.");
    }
    else
    {
        
bBhopLazyModes[client] = true;
        
ReplyToCommand(client"[SM] Bunnyhop enabled. Hold jump to bunnyhop!");
    }
    return 
Plugin_Handled;

Try not complicated as possible, i just want when player type !head on first, server will execute sm_resizehead PLAYER 3. second execute of !head, server will execute sm_resizehead PLAYER 1. third execute of !head, server will execute sm_resizehead PLAYER 3.

Last edited by Bonkorn; 08-31-2017 at 04:03.
Bonkorn is offline
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 08-31-2017 , 04:03   Re: Just... how to make this toggleable
Reply With Quote #4

can you send me the full code of the code above me?
ItsExTacY is offline
Bonkorn
Senior Member
Join Date: Jul 2015
Old 08-31-2017 , 04:11   Re: Just... how to make this toggleable
Reply With Quote #5

...

Last edited by Bonkorn; 08-31-2017 at 04:18. Reason: solved
Bonkorn is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 08-31-2017 , 04:24   Re: Just... how to make this toggleable
Reply With Quote #6

Bonkorn, if you let everyone know how you solved the problem, it'd help others who may stumble upon the same issue.

Here's the source he edited out
Spoiler

Last edited by headline; 08-31-2017 at 04:27.
headline is offline
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 08-31-2017 , 04:28   Re: Just... how to make this toggleable
Reply With Quote #7

Quote:
Originally Posted by Headline View Post
Bonkorn, if you let everyone know how you solved the problem, it'd help others who may stumble upon the same issue.

Here's the source he edited out
Spoiler
Thanks

Last edited by ItsExTacY; 08-31-2017 at 04:29.
ItsExTacY is offline
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 08-31-2017 , 04:31   Re: Just... how to make this toggleable
Reply With Quote #8

Quote:
Originally Posted by Bonkorn View Post
Title says all.
PHP Code:
public OnPluginStart() 

    
RegAdminCmd("sm_head"ResizeHeadADMFLAG_CUSTOM5""); 


public 
Action:ResizeHead(clientargs)
{
    if()
    {
        
ServerCommand("sm_resizehead #%i 3"GetClientUserId(client)); 
        
ReplyToCommand(client"[SM] Head size resized to big!");
    }
    else
    {
        
ServerCommand("sm_resizehead #%i 1"GetClientUserId(client)); 
        
ReplyToCommand(client"[SM] Head size returned to normal!");
    }
    return 
Plugin_Handled;

Sorry but i dont know how can i help you
ItsExTacY is offline
Bonkorn
Senior Member
Join Date: Jul 2015
Old 08-31-2017 , 04:48   Re: Just... how to make this toggleable
Reply With Quote #9

PHP Code:
#include <sourcemod>

new bool:ResizeHeadHandle[MAXPLAYERS+1];

public 
Plugin:myinfo 
{
    
name "Big Head",
    
author "Bonkorn",
    
description ""
}

public 
OnPluginStart() 

    
RegAdminCmd("sm_head"ResizeHeadADMFLAG_CUSTOM5""); 



public 
OnClientConnected(client)
{
    
ResizeHeadHandle[client] = false;
}

public 
Action:ResizeHead(clientargs)
{
    
ResizeHeadHandle[client] = !ResizeHeadHandle[client];
    
    if(
ResizeHeadHandle[client])
    {
        
ServerCommand("sm_resizehead #%i 3"GetClientUserId(client)); 
        
ReplyToCommand(client"[SM] Head size resized to big!");
    }
    else
    {
        
ServerCommand("sm_resizehead #%i 1"GetClientUserId(client)); 
        
ReplyToCommand(client"[SM] Head size returned to normal!");
    }
    return 
Plugin_Handled;

Reference from:
https://forums.alliedmods.net/showthread.php?t=289075

Last edited by Bonkorn; 08-31-2017 at 04:49.
Bonkorn is offline
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 08-31-2017 , 05:15   Re: Just... how to make this toggleable
Reply With Quote #10

There is Servercommand called resizehead in tf2?
ItsExTacY 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 23:28.


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