Raised This Month: $51 Target: $400
 12% 

[TF2]GIVE MONEY MENU?(solved)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Poheart
Member
Join Date: Mar 2009
Old 03-26-2011 , 16:08   [TF2]GIVE MONEY MENU?(solved)
Reply With Quote #1

so the following code is give money menu on TF2 FW mod,actually the function work fine,
but i try to add "Confirm Menu"(GiveMMenu4),and it doesn't work now,
this plugin mainly link to other plugin with exist cmd "sm_gm",on my server,
player can donate their money with using sm_gm "money" "name",so this is the menu version of it,the point is,i try to make 'Action Confirm Menu'but it doesn't work because i don't know how to transfer the value(amount of money ,GiveMMenu2) to next menu,please help
PHP Code:
removed due to problem solved 
__________________
Administrator of HoursPlayed Inc.(www.HoursPlayed.net) Gaming Community.

Last edited by Poheart; 03-27-2011 at 02:53.
Poheart is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-26-2011 , 17:26   Re: [TF2]GIVE MONEY MENU?(with code)
Reply With Quote #2

Did you bother to read the errors/warnings when compiling?

Duplicate function:

public GiveMMenu3(Handle:menu, MenuAction:action, param1, param2)



Anyway "to transfer the value(amount of money ,GiveMMenu2) to next menu" in this case I think you'll have to store that value in a global array.
__________________
Silvers is offline
Poheart
Member
Join Date: Mar 2009
Old 03-27-2011 , 00:34   Re: [TF2]GIVE MONEY MENU?(with code)
Reply With Quote #3

ehh,sorry,actually it should be like this
PHP Code:
removed due to problem solved 
__________________
Administrator of HoursPlayed Inc.(www.HoursPlayed.net) Gaming Community.

Last edited by Poheart; 03-27-2011 at 02:53.
Poheart is offline
alexip121093
Senior Member
Join Date: Dec 2009
Location: Hong Kong
Old 03-27-2011 , 02:22   Re: [TF2]GIVE MONEY MENU?(with code)
Reply With Quote #4

Code:
#include <sourcemod>
#include <sdktools>
new target1[MAXPLAYERS+1];
new xxxxx[MAXPLAYERS+1];
new String:money[MAXPLAYERS+1][64];
new money1[MAXPLAYERS+1];
public Plugin:myinfo =
{
 name = "TF2 Money give",
 author = "Tom1314",
 description = "Player can send money via menu",
 version = "",
 url = "www.POHEART.COM"
}
public OnPluginStart()
{
 RegConsoleCmd("sm_gmm", CmdGiveMoneyMenu);
 RegConsoleCmd("sm_gm", CmdGiveMoney);
}
public Action:CmdGiveMoney(client, args)
{
 //Player:
 new Player;
 //Default:
 if(args < 2) return;
 
 //Player:
 else
 {
  //Retrieve Arguments:
  decl MaxClients;
  decl String:ArgumentName[32], String:PlayerName[32];
  //Initialize:
  MaxClients = GetMaxClients();
  GetCmdArg(1, ArgumentName, sizeof(ArgumentName));
  //Find:
  for(new X = 1; X <= MaxClients; X++)
  {
   //Invalid:
   if(!IsClientConnected(X)) continue;
   //Initialize:
   GetClientName(X, PlayerName, sizeof(PlayerName));
   //Compare:
   if(StrContains(PlayerName, ArgumentName, false) != -1) Player = X;
  }
 }
 if(!IsClientConnected(Player)) return;
 new String:aaa[32];
 GetCmdArg(2, aaa, sizeof(aaa));
 new b = StringToInt(aaa);
 xxxxx[Player] =xxxxx[Player] + b;
 return;    
}
public Action:CmdGiveMoneyMenu(client, args)
{
 GiveMMenu(client);
}
public GiveMMenu(client)
{
 decl String:name[256], String:number[32];
 // Take client number and put it into g_Selector
 // Create the menu
 new Handle:menu = CreateMenu(GiveMMenu1);
 SetMenuTitle(menu, "Send Money to Player:");
 for (new i=1; i<=MaxClients; i++)
 {
  if (!IsClientInGame(i)) continue; //not ingame? skip
  Format(name, sizeof(name), "%N", i);
  Format(number, sizeof(number), "%i", i);
  AddMenuItem(menu, number, name);
 }
 SetMenuExitButton(menu, true);
 DisplayMenu(menu, client, 60);
 return Plugin_Handled;
}
public GiveMMenu1(Handle:menu, MenuAction:action, param1, param2)
{
 // if a player was selected
 if (action == MenuAction_Select)
 {
  decl String:item[256], String:display[256];
  GetMenuItem(menu, param2, item, sizeof(item), _, display, sizeof(display));
  new target = StringToInt(item);
  if (target == 0)
  {
   target = 1;
  }
  target1[param1]=target;
  GiveMMenu2(param1);
 }
 else if (action == MenuAction_Cancel)
 {
 }
 else if (action == MenuAction_End)
 {
  CloseHandle(menu);
 }
}
public GiveMMenu2(client)
{
 new Handle:menu = CreateMenu(GiveMMenu3);
 SetMenuTitle(menu, "Please Select Amount");
 AddMenuItem(menu, "500", "$500[Min]");
 AddMenuItem(menu, "1000", "$1000");
 AddMenuItem(menu, "1500", "$1500");
 AddMenuItem(menu, "2000", "$2000");
 AddMenuItem(menu, "1500", "$2500");
 AddMenuItem(menu, "2000", "$3000");
 AddMenuItem(menu, "2000", "$5000");
 SetMenuExitButton(menu, true);
 DisplayMenu(menu, client, 60);
}
public GiveMMenu3(Handle:menu, MenuAction:action, param1, param2)
{
 // if a player was selected
 if (action == MenuAction_Select)
 {
  decl String:item[256], String:display[256];
  
  GetMenuItem(menu, param2, item, sizeof(item), _, display, sizeof(display));
  new target = StringToInt(item);
  Format(money[param1], 64, display);
  money1[param1]=target;
  GiveMMenu4(param1);
 }
 else if (action == MenuAction_Cancel)
 {
 }
 else if (action == MenuAction_End)
 {
  CloseHandle(menu);
 }
}
public GiveMMenu4(client)
{
 new Handle:menu = CreateMenu(GiveMMenu5);
 decl String:name[64];
 GetClientName( target1[client], name, 64); 
 SetMenuTitle(menu, "Are you sure you gonna give money to %s?\nThis action cannot be undone once confirmed.", name);
 
 AddMenuItem(menu, money1[client], money[client]);
 AddMenuItem(menu, "-1", "No");
 SetMenuExitButton(menu, true);
 DisplayMenu(menu, client, 60);
}
public GiveMMenu5(Handle:menu, MenuAction:action, param1, param2)
{
 // if a player was selected
 if (action == MenuAction_Select)
 {
  decl String:item[256], String:display[256];
  GetMenuItem(menu, param2, item, sizeof(item), _, display, sizeof(display));
  new x = StringToInt(item);
  if (x !=-1)
  {
  decl String:name[64];
  GetClientName( target1[param1], name, 64); // get client username
  FakeClientCommand(param1, "sm_gm \"%d\" \"%s\"",x,name);
  }
 }
 else if (action == MenuAction_Cancel)
 {
 }
 else if (action == MenuAction_End)
 {
  CloseHandle(menu);
 }
}
__________________
alexip121093 is offline
Send a message via MSN to alexip121093
Poheart
Member
Join Date: Mar 2009
Old 03-27-2011 , 02:29   Re: [TF2]GIVE MONEY MENU?(with code)
Reply With Quote #5

Thank you,Problem solved.
__________________
Administrator of HoursPlayed Inc.(www.HoursPlayed.net) Gaming Community.
Poheart is offline
Samantha
SourceMod Donor
Join Date: Feb 2010
Location: Madagascar
Old 03-29-2011 , 06:57   Re: [TF2]GIVE MONEY MENU?(solved)
Reply With Quote #6

Why would you remove everything? What if someone had the same problem and decided to look here, but you removed everything?
__________________
"I give sopport and knolage in making extractions"
"MASTER(D) - dun0: are you mocing me?" -Master the grate

Plugins
Godmode Until Attack | No Block Team Filter
Extensions
Rcon Hooks
Samantha 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 15:05.


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