Cześć. Jak zrobić vote w pluginie ??
18 kwiecień 2010 - 21:33:
Da rade wogóle to zrobic?
Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Jak zrobic
Temat rozp.
Monsulito
, 18.04.2010 13:19
2 odpowiedzi w tym temacie
#1
Napisano 18.04.2010 13:19
RPG MOD - [||||||||||] 5%
#3
Napisano 18.04.2010 21:44
dzięki Wielki + Dla ciebie
Ale jeszcze 1 pytanko. Mam takie cos:
Jak zrobic zeby jak wyjdzie funkcja "Tak"
bylo blockBuy(); ??
Ale jeszcze 1 pytanko. Mam takie cos:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fun>
new bool:isrestart = false
//This will hold the VoteMenu
new gVoteMenu;
//This will hold the votes for each option
new gVotes[2];
//This determines if a vote is already happening
new gVoting;
public plugin_init(){
register_clcmd("say /free","freerun")
//Register a way to get to your vote...
}
public ButtonUse(ent, id){
if (get_user_team(id)==1) return HAM_SUPERCEDE
return PLUGIN_HANDLED
}
public blockBuy(){
register_clcmd("buy","block")
register_clcmd("p228","block")
register_clcmd("228compact","block")
register_clcmd("shield","block")
register_clcmd("scout","block")
register_clcmd("hegren","block")
register_clcmd("xm1014","block")
register_clcmd("autoshotgun","block")
register_clcmd("mac10","block")
register_clcmd("aug","block")
register_clcmd("bullpup","block")
register_clcmd("sgren","block")
register_clcmd("elites","block")
register_clcmd("fn57","block")
register_clcmd("fiveseven","block")
register_clcmd("ump45","block")
register_clcmd("sg550","block")
register_clcmd("krieg550","block")
register_clcmd("galil","block")
register_clcmd("defender","block")
register_clcmd("famas","block")
register_clcmd("clarion","block")
register_clcmd("usp","block")
register_clcmd("km45","block")
register_clcmd("glock","block")
register_clcmd("9x19mm","block")
register_clcmd("awp","block")
register_clcmd("magnum","block")
register_clcmd("mp5","block")
register_clcmd("smg","block")
register_clcmd("m249","block")
register_clcmd("m3","block")
register_clcmd("12gauge","block")
register_clcmd("m4a1","block")
register_clcmd("tmp","block")
register_clcmd("mp","block")
register_clcmd("g3sg1","block")
register_clcmd("d3au1","block")
register_clcmd("flash","block")
register_clcmd("deagle","block")
register_clcmd("nighthawk","block")
register_clcmd("sg552","block")
register_clcmd("krieg552","block")
register_clcmd("ak47","block")
register_clcmd("cv47","block")
register_clcmd("p90","block")
register_clcmd("c90","block")
register_clcmd("primammo","block")
register_clcmd("secammo","block")
register_clcmd("vest","block")
register_clcmd("vesthelm","block")
register_clcmd("nvgs","block")
RegisterHam(Ham_Use, "func_button", "ButtonUse");
return PLUGIN_HANDLED
}
public block(id)
{
if(isrestart)
return PLUGIN_HANDLED
return PLUGIN_CONTINUE
}
public freerun(id)
{
if( get_user_team( id ) == 1 )
StartVote(id)
else
client_print(id, print_chat, "Ta komenda jest tylko dostepna dla Terrorysty!")
}
public StartVote(id)
{
//If there is already a vote, don't start another
if( gVoting )
{
client_print(id, print_chat, "There is already a vote going.");
//We return PLUGIN_HANDLED so the person does not get Unknown Command in console
return PLUGIN_HANDLED;
}
//Store the menu in the global
gVoteMenu = menu_create("\rCT chce free?!:", "menu_handler");
//Add some vote options
menu_additem(gVoteMenu, "Tak", "0", 0);
menu_additem(gVoteMenu, "Nie", "1", 0);
//We will need to create some variables so we can loop through all the players
new players[32], pnum, tempid;
//Fill players with available players
get_players(players, pnum);
//Start looping through all players to show the vote to
for( new i; i<pnum; i++ )
{
//Save a tempid so we do not re-index
tempid = players[i];
//Show the vote to this player
menu_display(tempid, gVoteMenu, 0);
//Increase how many players are voting
gVoting++;
}
//End the vote in 10 seconds
set_task(10.0, "EndVote");
return PLUGIN_HANDLED;
}
public menu_handler(id, menu, item)
{
//If the menu was exited or if there is not a vote
if( item == MENU_EXIT || !gVoting )
{
//Note were not destroying the menu
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
//Get the id of the player that was selected
new voteid = str_to_num(data);
//Increase the votes for what they selected
gVotes[voteid]++;
//Note were not destroying the menu
return PLUGIN_HANDLED;
}
public EndVote()
{
//If the first option recieved the most votes
if( gVotes[0] > gVotes[1] )
client_print(0, print_chat, "CT Chce Free, wszystkie bronie i pulapki zablokowane !", gVotes[0] )
//Else if the second option recieved the most votes
else if( gVotes[0] > gVotes[1] )
client_print(0, print_chat, "CT Nie chce Free, gramy normalnie dalej !", gVotes[1] );
//Otherwise the vote tied
else
client_print(0, print_chat, "CT Nie chce Free, gramy normalnie dalej !", gVotes[0] );
//Don't forget to destroy the menu now that we are completely done with it
menu_destroy(gVoteMenu);
//Reset that no players are voting
gVoting = 0;
if( gVotes[0] > gVotes[1] )
blockBuy();
}
Jak zrobic zeby jak wyjdzie funkcja "Tak"
bylo blockBuy(); ??
Użytkownik Monsulito edytował ten post 18.04.2010 22:09
RPG MOD - [||||||||||] 5%
Użytkownicy przeglądający ten temat: 1
0 użytkowników, 1 gości, 0 anonimowych