Jump to content

Helping New Players


cecurity

Recommended Posts

I don't see there being any difference between using the binds listed above or coding individual commands into the plug-in... you're going to keybind it anyways!

 

Cept !molly takes care of any lag that happens under the other bind. or !cracker actually gives you a cracker rather than propane. So there is a difference. Though the system now is fine even if lag messes the intended buy sometimes.

Link to comment
Share on other sites

You can relatively easily allow players to either buy items through menu navigation, or immediately on the spot.

 

Take the code below, for instance. you can type !buy to open the menu and navigate, or !buy rifle_ak47 to purchase an ak47 immediatly (if you have the points) or one of the other commands in the list.

 

public Commands_OnPluginStart()
{
RegConsoleCmd("up", Command_OpenMenu);
RegConsoleCmd("usepoints", Command_OpenMenu);
RegConsoleCmd("buy", Command_OpenMenu);
}
public Action:Command_OpenMenu(client, args)
{
// At some point, when the RPG Module is created, I'll update this section.
// Until then we'll just go ahead and fast-forward to the usepoints menu.
if (args < 1 || GetClientTeam(client) != TEAM_SURVIVORS)
{
 if (GetClientTeam(client) == TEAM_SURVIVORS) SendPanelToClient(Points_SurvivorMenu(client), client, Points_SurvivorMenu_Init, MENU_TIME_FOREVER);
 else if (GetClientTeam(client) == TEAM_INFECTED) SendPanelToClient(Points_InfectedMenu(client), client, Points_InfectedMenu_Init, MENU_TIME_FOREVER);
}
else
{
 decl String:CMD[128];
 GetCmdArg(1, CMD, sizeof(CMD));
 if (GetClientTeam(client) == 2)
 {
  ItemName[client] = CMD;
  if (StrEqual(CMD, "help"))
  {
   PrintToChat(client, "%s - \x01Commands have been printed to your console.", INFO_GENERAL);
   PrintToConsole(client, "rifle_ak47 , rifle_m60 , grenade_launcher , chainsaw");	  // purchase item = 0;
   PrintToConsole(client, "bloat_ammo , blind_ammo , slowmo_ammo , beanbag_ammo , spatial_ammo");  // purchase item = 1;
   PrintToConsole(client, "health , adrenaline , first_aid_kit , pain_pills");	   // purchase item = 2;
   PrintToConsole(client, "molotov , vomitjar , pipe_bomb");		   // purchase item = 3;
  }
  else if (StrEqual(CMD, "rifle_ak47") || StrEqual(CMD, "rifle_m60") || StrEqual(CMD, "grenade_launcher") || StrEqual(CMD, "chainsaw")) PurchaseItem[client] = 0;
  else if (StrEqual(CMD, "bloat_ammo") || StrEqual(CMD, "blind_ammo") || StrEqual(CMD, "slowmo_ammo") || StrEqual(CMD, "beanbag_ammo") || StrEqual(CMD, "spatial_ammo")) PurchaseItem[client] = 1;
  else if (StrEqual(CMD, "health") || StrEqual(CMD, "adrenaline") || StrEqual(CMD, "first_aid_kit") || StrEqual(CMD, "pain_pills")) PurchaseItem[client] = 2;
  else if (StrEqual(CMD, "molotov") || StrEqual(CMD, "vomitjar") || StrEqual(CMD, "pipe_bomb")) PurchaseItem[client] = 3;
  if (!StrEqual(CMD, "help")) SurvivorPurchaseFunc(client);
 }
}
}

  • Like 1
Link to comment
Share on other sites

Unfortunately, plugins are written in a variant of the pawn language. Eventually, the new language that's being written, Knight, will take over (not sure when, exactly)

 

That, above, is an excerpt from one version of a buy plugin I wrote.

There are many ways to do it (and several ways that are better for representing strings than that) but it's just a quick sample.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...