Raised This Month: $ Target: $400
 0% 

transfer plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 06-15-2021 , 14:53   Re: transfer plugin
Reply With Quote #1

In a very basic way you would do this, or you can save the amount of player team changes in a Trie that is cleared at every map change, good luck.

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike > 

new g_movelimit
new iTransferTimes[33]

public 
plugin_init()
{
       
register_plugin("Players transfer""1.9.0.5271""")

       
register_clcmd("say /spec","spec")
       
register_clcmd("say_team /spec","spec")
       
register_clcmd("say /ct","ct")
       
register_clcmd("say_team /ct","ct")
       
register_clcmd("say /t","t")
       
register_clcmd("say_team /t","t")

       
g_movelimit register_cvar("move_limit""3")
}

public 
client_connect(id)
{
        
iTransferTimes[id] = 0
}

public 
spec(id)
{     
        
iTransferTimes[id] += 1
       
if(iTransferTimes[id] >= get_pcvar_num(g_movelimit))
       {
        
color_chat(id"^4%s^3 This command can be used only^4 3 times per map")
        return 
PLUGIN_HANDLED
       
}    
 
       
cs_set_user_team(id,CS_TEAM_SPECTATOR)

       if(
is_user_alive(id))
       
user_silentkill(id)

       return 
PLUGIN_HANDLED     
}

public 
ct(id)
{
       
cs_set_user_team(id,CS_TEAM_CT)
       
user_silentkill(id)

       return 
PLUGIN_HANDLED
}

public 
t(id)
{
       
cs_set_user_team(id,CS_TEAM_T)
       
user_silentkill(id)

       return 
PLUGIN_HANDLED
}

stock color_chat(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // Green Color
    
replace_all(msg190"!y""^1"); // Default Color
    
replace_all(msg190"!team""^3"); // Team Color
    
replace_all(msg190"!team2""^0"); // Team2 Color
        
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

__________________


Quote:
Originally Posted by fysiks View Post
Please stop trying to help. You appear to just be posting random stuff. Wait until you actually understand more about AMX Mod X and how the game works.
https://iceeedr.com.br/

Last edited by iceeedr; 06-15-2021 at 14:54.
iceeedr is offline
Send a message via Skype™ to iceeedr
giumbalau
Member
Join Date: Jan 2021
Old 06-15-2021 , 15:11   Re: transfer plugin
Reply With Quote #2

Quote:
Originally Posted by iceeedr View Post
In a very basic way you would do this, or you can save the amount of player team changes in a Trie that is cleared at every map change, good luck.

PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike > 

new g_movelimit
new iTransferTimes[33]

public 
plugin_init()
{
       
register_plugin("Players transfer""1.9.0.5271""")

       
register_clcmd("say /spec","spec")
       
register_clcmd("say_team /spec","spec")
       
register_clcmd("say /ct","ct")
       
register_clcmd("say_team /ct","ct")
       
register_clcmd("say /t","t")
       
register_clcmd("say_team /t","t")

       
g_movelimit register_cvar("move_limit""3")
}

public 
client_connect(id)
{
        
iTransferTimes[id] = 0
}

public 
spec(id)
{     
        
iTransferTimes[id] += 1
       
if(iTransferTimes[id] >= get_pcvar_num(g_movelimit))
       {
        
color_chat(id"^4%s^3 This command can be used only^4 3 times per map")
        return 
PLUGIN_HANDLED
       
}    
 
       
cs_set_user_team(id,CS_TEAM_SPECTATOR)

       if(
is_user_alive(id))
       
user_silentkill(id)

       return 
PLUGIN_HANDLED     
}

public 
ct(id)
{
       
cs_set_user_team(id,CS_TEAM_CT)
       
user_silentkill(id)

       return 
PLUGIN_HANDLED
}

public 
t(id)
{
       
cs_set_user_team(id,CS_TEAM_T)
       
user_silentkill(id)

       return 
PLUGIN_HANDLED
}

stock color_chat(const id, const input[], any:...)
{
    new 
count 1players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // Green Color
    
replace_all(msg190"!y""^1"); // Default Color
    
replace_all(msg190"!team""^3"); // Team Color
    
replace_all(msg190"!team2""^0"); // Team2 Color
        
    
if (idplayers[0] = id; else get_players(playerscount"ch");
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }

Thank you very much
giumbalau 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 19:54.


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