AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Mix Selection 1.0 (https://forums.alliedmods.net/showthread.php?t=154943)

mohammadhitman 05-29-2011 04:49

Re: Mix Selection 1.0
 
i said when leader of 1st team selected player , will join to teem
and then leader of 2nd team select players , will not to the team.


it,s my plugin code :
Quote:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <fun>
#include <fakemeta>

#define PLUGIN "Mix"
#define VERSION "1.0"
#define AUTHOR "HitMaN"


// Vars
new CapitanCT[33], CapitanTT[33], MS_tag[20], SelectionON,
RoundKnife, CTsCount, TTsCount, g_iMaxplayers, g_iMsgMoney

// Pcvars
new cvar_tag, cvar_ms_enabled, cvar_MinPlayers

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)

register_clcmd("say /mix", "sayCut")
register_clcmd("say /public", "sayPublic")

register_concmd("jointeam", "BlockFuction")

register_dictionary("Mix.txt")

register_event( "Money", "EventMoney", "b" )

RegisterHam(Ham_Spawn, "player", "fw_playerspawn", 1)
RegisterHam(Ham_Killed, "player", "fw_PlayerKilled")

register_cvar("Mix Sarter v1.0" , AUTHOR , FCVAR_SERVER | FCVAR_PROTECTED)

cvar_tag = register_cvar("ms_tag", "Mix")
cvar_ms_enabled = register_cvar("ms_enable", "1")
cvar_MinPlayers = register_cvar("ms_min_players", "10")

get_pcvar_string(cvar_tag, MS_tag, charsmax(MS_tag))

g_iMaxplayers = get_maxplayers()
g_iMsgMoney = get_user_msgid("Money")
}

public sayPublic(id)
{
if(!SelectionON)
{
ChatColor(id, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_ALREADYPUBLIC")
return PLUGIN_HANDLED
}

if(get_user_flags(id) & ADMIN_KICK)
{
new players[32], pnum, tempid

get_players(players, pnum)

for( new i; i<pnum; i++ )
{
tempid = players[i]
CapitanCT[tempid] = false
CapitanTT[tempid] = false
}

RoundKnife = 0
SelectionON = 0
server_cmd("sv_restart 1")

ChatColor(0, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_PUBLIC")
}

else
{
ChatColor(id, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_NOT_ACCES")
return PLUGIN_HANDLED
}

return PLUGIN_HANDLED
}

public sayCut(id)
{
if(!get_pcvar_num(cvar_ms_enabled))
{
ChatColor(id, "!g[%s] !y%s %L", MS_tag, PLUGIN, LANG_PLAYER, "MS_NOT_ENABLED")
return PLUGIN_HANDLED
}

new PlayersON

for(new i = 1; i <= g_iMaxplayers; i++)
{
if(is_user_connected(i))
PlayersON++
}

if(PlayersON < get_pcvar_num(cvar_MinPlayers))
{
ChatColor(id, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_MIN_PLAYERS", get_pcvar_num(cvar_MinPlayers))
return PLUGIN_HANDLED
}

if(get_user_flags(id) & ADMIN_KICK)
{
if(SelectionON)
{
ChatColor(id, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_ALREADYON", PLUGIN, VERSION)
return PLUGIN_HANDLED
}

new players[32], num
get_players(players, num)

new player
for(new i = 0; i < num; i++)
{
player = players[i]

user_kill(player, 1)
cs_set_user_team(player, CS_TEAM_SPECTATOR)
}

ChatColor(0, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_SELECT_CAPITAN")

set_task(3.0, "menuCapCT", id)
SelectionON = 1
}

else
{
ChatColor(id, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_NOT_ACCES")
return PLUGIN_HANDLED
}

return PLUGIN_HANDLED
}

public client_putinserver(id)
{
if(SelectionON)
set_task(5.0, "TranferSpect", id)

CapitanCT[id] = false
CapitanTT[id] = false

set_task(4.0, "WelcomeMessage", id)
}

public TranferSpect(id)
{
user_kill(id, 1)
cs_set_user_team(id, CS_TEAM_SPECTATOR)
}

public WelcomeMessage(id)
ChatColor(id, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_WELCOME", PLUGIN, AUTHOR)

public menuCapCT(id)
{
new data[128], players[32], pnum, tempid, szName[33], szTempid[10]

formatex(data, charsmax(data), "\y%s^n\wVersion: \r%s^n^n\w%L", PLUGIN, VERSION, LANG_PLAYER, "MS_SELECT_CAP_CT")
new Menu = menu_create(data, "Show_CapCT")

get_players(players, pnum)

for( new i; i<pnum; i++ )
{
tempid = players[i]

get_user_name(tempid, szName, charsmax(szName))
num_to_str(tempid, szTempid, charsmax(szTempid))
menu_additem(Menu, szName, szTempid, 0)
}

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_NEXT_PAGE")
menu_setprop(Menu,MPROP_NEXTNAME, data)

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_BACK_PAGE")
menu_setprop(Menu,MPROP_BACKNAME, data)

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_EXIT")
menu_setprop(Menu,MPROP_EXITNAME, data)
menu_display(id, Menu, 0)
}

public Show_CapCT(id, Menu, item)
{
new data[6], iName[64]
new access, callback
menu_item_getinfo(Menu, item, access, data,5, iName, 63, callback)

new tempid = str_to_num(data)


cs_set_user_team(tempid, CS_TEAM_CT)
CapitanCT[tempid] = true
ChatColor(0, "!g[%s] !team%s %L", MS_tag, iName, LANG_PLAYER, "MS_CAPCT_SELECTED")
menuCapTT(id)

menu_destroy(Menu)
return PLUGIN_HANDLED
}

public menuCapTT(id)
{
new data[128], players[32], pnum, tempid, szName[33], szTempid[10]

formatex(data, charsmax(data), "\y%s^n\wVersion: \r%s^n^n\w%L", PLUGIN, VERSION, LANG_PLAYER, "MS_SELECT_CAP_TT")
new Menu = menu_create(data, "Show_CapTT")

get_players(players, pnum)

for( new i; i<pnum; i++ )
{
tempid = players[i]

if(!CapitanCT[tempid])
{
get_user_name(tempid, szName, charsmax(szName))
num_to_str(tempid, szTempid, charsmax(szTempid))
menu_additem(Menu, szName, szTempid, 0)
}
}

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_NEXT_PAGE")
menu_setprop(Menu,MPROP_NEXTNAME, data)

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_BACK_PAGE")
menu_setprop(Menu,MPROP_BACKNAME, data)

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_EXIT")
menu_setprop(Menu,MPROP_EXITNAME, data)
menu_display(id, Menu, 0)
}

public Show_CapTT(id, Menu, item)
{
new data[6], iName[64]
new access, callback
menu_item_getinfo(Menu, item, access, data,5, iName, 63, callback)

new tempid = str_to_num(data)
new uName[33]
get_user_name(tempid, uName, charsmax(uName))

if(cs_get_user_team(tempid) == CS_TEAM_CT)
{
ChatColor(id, "!g[%s] !team%s %L", MS_tag, uName, LANG_PLAYER, "MS_SELECT_OTHER")
menuCapTT(id)
}

else
{
cs_set_user_team(tempid, CS_TEAM_T)
CapitanTT[tempid] = true
ChatColor(0, "!g[%s] !team%s %L", MS_tag, uName, LANG_PLAYER, "MS_CAPTT_SELECTED")
server_cmd("sv_restart 5")
set_task(4.0, "StartRoundKnife")
}

menu_destroy(Menu)
return PLUGIN_HANDLED
}

public StartRoundKnife()
{
ChatColor(0, "!g[%s] !y%L", MS_tag, LANG_PLAYER, "MS_KNIFE_START")
RoundKnife = 1
}

public fw_playerspawn(id)
{
if(RoundKnife && is_user_alive(id))
{
fm_strip_user_weapons(id)
give_item(id, "weapon_knife")
}
}

public EventMoney(id)
{
if(RoundKnife && is_user_alive(id))
{
set_pdata_int(id, 115, 0)
message_begin( MSG_ONE_UNRELIABLE, g_iMsgMoney, _, id )
write_long (0)
write_byte (1)
message_end()
}
}

public fw_PlayerKilled(victim, attacker, shouldgib)
{
if(RoundKnife && is_user_alive(attacker))
{
new CapitanAttacker = get_user_team(attacker)
new CapitanVictim = get_user_team(victim)

new atName[33]
get_user_name(attacker, atName, charsmax(atName))

if(CapitanAttacker == 2 && CapitanVictim == 1)
{
ChatColor(0, "!g[%s] !team%s %L", MS_tag, atName, LANG_PLAYER, "MS_CAPCT_WIN")
set_task(5.0, "SelectCT", attacker)
}

else if(CapitanAttacker == 1 && CapitanVictim == 2)
{
ChatColor(0, "!g[%s] !team%s %L", MS_tag, atName, LANG_PLAYER, "MS_CAPTT_WIN")
set_task(5.0, "SelectTT", attacker)
}

RoundKnife = 0
}
}

public SelectTT(id)
{
new data[128], players[32], pnum, tempid, szName[33], szTempid[10]

formatex(data, charsmax(data), "\y%s^n\wVersion: \r%s^n^n\w%L", PLUGIN, VERSION, LANG_PLAYER, "MS_SELECT_TEAMMATES")
new Menu = menu_create(data, "Show_PlayersTT")

get_players(players, pnum)

for( new i; i<pnum; i++ )
{
tempid = players[i]

if(get_user_team(tempid) == 3)
{
get_user_name(tempid, szName, charsmax(szName))
num_to_str(tempid, szTempid, charsmax(szTempid))
menu_additem(Menu, szName, szTempid, 0)
}
}

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_NEXT_PAGE")
menu_setprop(Menu,MPROP_NEXTNAME, data)

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_BACK_PAGE")
menu_setprop(Menu,MPROP_BACKNAME, data)

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_EXIT")
menu_setprop(Menu,MPROP_EXITNAME, data)
menu_display(id, Menu, 0)
}

public Show_PlayersTT(id, Menu, item)
{
new data[6], iName[64]
new iaccess, callback
menu_item_getinfo(Menu, item, iaccess, data,5, iName, 63, callback)

new tempid = str_to_num(data)
new uName[33]
get_user_name(tempid, uName, charsmax(uName))


if(CapitanTT[id])
{
cs_set_user_team(tempid, CS_TEAM_T)
ChatColor(0, "!g[%s] !team%s %L", MS_tag, uName, LANG_PLAYER, "MS_TT_SELECTED")
TTsCount++

for(new i=1; i<=g_iMaxplayers; i++)
{
if(CapitanCT[i])
{
if((CTsCount + TTsCount) < 10)
{
SelectCT(i)
break
}
}
}
}

SelectionFinish()


menu_destroy(Menu)
return PLUGIN_HANDLED
}

public SelectCT(id)
{
new data[128], players[32], pnum, tempid, szName[33], szTempid[10]

formatex(data, charsmax(data), "\y%s^n\wVersion: \r%s^n^n\w%L", PLUGIN, VERSION, LANG_PLAYER, "MS_SELECT_TEAMMATES")
new Menu = menu_create(data, "Show_PlayersCT")

get_players(players, pnum)

for( new i; i<pnum; i++ )
{
tempid = players[i]

if(get_user_team(tempid) == 3)
{
get_user_name(tempid, szName, charsmax(szName))
num_to_str(tempid, szTempid, charsmax(szTempid))
menu_additem(Menu, szName, szTempid, 0)
}
}

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_NEXT_PAGE")
menu_setprop(Menu,MPROP_NEXTNAME, data)

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_BACK_PAGE")
menu_setprop(Menu,MPROP_BACKNAME, data)

formatex(data, charsmax(data), "%L", LANG_PLAYER, "MS_EXIT")
menu_setprop(Menu,MPROP_EXITNAME, data)
menu_display(id, Menu, 0)
}

public Show_PlayersCT(id, Menu, item)
{
new data[6], iName[64]
new access, callback
menu_item_getinfo(Menu, item, access, data,5, iName, 63, callback)

new tempid = str_to_num(data)
new uName[33]
get_user_name(tempid, uName, charsmax(uName))

if(CapitanCT[id])
{
cs_set_user_team(tempid, CS_TEAM_CT)
ChatColor(0, "!g[%s] !team%s %L", MS_tag, uName, LANG_PLAYER, "MS_CT_SELECTED")
CTsCount++

for(new i=1; i<=g_iMaxplayers; i++)
{
if( CapitanTT[i] )
{
if((CTsCount + TTsCount) < 10)
{
SelectCT(i)
break
}
}
}
}

SelectionFinish()


menu_destroy(Menu)
return PLUGIN_HANDLED
}

public SelectionFinish()
{
if((CTsCount + TTsCount) == 8)
{
ChatColor(0, "!g[%s] %L", MS_tag, LANG_PLAYER, "MS_END")
SelectionON = 0
server_cmd("sv_restart 5")
}
}

public BlockFuction(id)
{
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR && SelectionON)
{
cs_set_user_team(id, CS_TEAM_SPECTATOR)
return PLUGIN_HANDLED
}

return PLUGIN_CONTINUE
}

stock fm_strip_user_weapons(id)
{
static ent
ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))
if (!pev_valid(ent)) return;

dllfunc(DLLFunc_Spawn, ent)
dllfunc(DLLFunc_Use, ent, id)
engfunc(EngFunc_RemoveEntity, ent)
}

stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
replace_all(msg, 190, "!team2", "^0") // Team2 Color

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2058\\ f0\\ fs16 \n\\ par }
*/

mohammadhitman 05-29-2011 06:36

Re: Mix Selection 1.0
 
And this show in my console, After i add "debug" witch out "" plugin name in plugins.ini :
Quote:

L 05/29/2011 - 02:57:53: String formatted incorrectly - parameter 8 (total 7)
L 05/29/2011 - 02:57:53: [AMXX] Displaying debug trace (plugin "MixStarter.amxx"
)
L 05/29/2011 - 02:57:53: [AMXX] Run time error 25: parameter error
L 05/29/2011 - 02:57:53: [AMXX] [0] MixStarter.sma::ChatColor (line 495)
L 05/29/2011 - 02:57:53: [AMXX] [1] MixStarter.sma::WelcomeMessage (line 159)

mohammadhitman 05-29-2011 06:47

Re: Mix Selection 1.0
 
And one idea : this plugin commands just work for admins not all of players!

howluen 06-04-2011 00:33

Re: Mix Selection 1.0
 
When will the ver1.1 release? I can't wait it!

FOUTA 06-06-2011 08:07

Re: Mix Selection 1.0
 
Yeah when?? Really loking forward to it

Neeeeeeeeeel.- 06-09-2011 12:48

Re: Mix Selection 1.0
 
If i have time next week i will restart working on it... and i will realse it soon.

@Off
@FOUTA
Why do you think all those plugins are yours? (In your signature)

FOUTA 06-14-2011 14:54

Re: Mix Selection 1.0
 
Quote:

Originally Posted by Neeeeeeeeeel.- (Post 1484450)
If i have time next week i will restart working on it... and i will realse it soon.

@Off
@FOUTA
Why do you think all those plugins are yours? (In your signature)

You know it's just a joke right?

howluen 07-28-2011 01:06

Re: Mix Selection 1.0
 
Ah~ no more update?

search4theyeti 08-10-2011 14:30

Re: Mix Selection 1.0
 
Is there anyway to get a verison of this plugin that dose not have the knife fight in it and whoever dose not get the first pick gets the next two. The knife fight seems to mess up other mods when used together. Thanks!

zannatti 08-11-2011 13:41

Re: Mix Selection 1.0
 
Set a cvar to remove knife round.


All times are GMT -4. The time now is 05:50.

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