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

[L4D] give player weapon


Post New Thread Reply   
 
Thread Tools Display Modes
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 02-26-2009 , 16:45   Re: [L4D] give player weapon
Reply With Quote #11

ah once again your awsome and thanks for the help ill name my first born after you! and then give him or her to YOU!

if anyone needs a list of guns they are

Code:
] give ammo
] give autoshotgun
] give first_aid_kit
] give health
] give pipe_bomb
] give molotov
] give rifle
] give smg
] give hunting_rifle
] give pain_pills
] give pistol
] give pumpshotgun
] give ammo
__________________

Last edited by {7~11} TROLL; 02-26-2009 at 16:52.
{7~11} TROLL is offline
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 02-26-2009 , 16:55   Re: [L4D] give player weapon
Reply With Quote #12

crap i forgot to ask you this do i need to add for each menu item after one before the next else if?
__________________
{7~11} TROLL is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 02-26-2009 , 16:58   Re: [L4D] give player weapon
Reply With Quote #13

I reread that question 6 times and still cant figure out what your asking. But you have to setup each one in a seperate if statement like the example I posted. After the first if you will need to have an else in front of each one following it.
__________________
CrimsonGT is offline
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 02-26-2009 , 17:00   Re: [L4D] give player weapon
Reply With Quote #14

Quote:
Originally Posted by CrimsonGT View Post
I reread that question 6 times and still cant figure out what your asking. But you have to setup each one in a seperate if statement like the example I posted. After the first if you will need to have an else in front of each one following it.
what i was asking is....

when i add more menu items i need to do the following...

PHP Code:
    if (strcmp(info,"option1") == ) {
    {
        
//Give the player a rifle
        
FakeClientCommand(client"give rifle");
    }
    else if ( 
strcmp(info,"option2") == ) {
    {
        
//Give the player a pipe_bomb
        
FakeClientCommand(client"give smg");
    }
    else if ( 
strcmp(info,"option3") == ) {
    {
        
FakeClientCommand(client"give rifle");
    }
    else if ( 
strcmp(info,"option2") == ) {
    {
        
FakeClientCommand(client"give ammo");
    }
//ect...? 
__________________
{7~11} TROLL is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 02-26-2009 , 17:07   Re: [L4D] give player weapon
Reply With Quote #15

Yup. Just for future reference, using a switch instead of a bunch of if's is more efficient, but in your case this is fine.
__________________
CrimsonGT is offline
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 02-26-2009 , 17:08   Re: [L4D] give player weapon
Reply With Quote #16

kk ty
__________________
{7~11} TROLL is offline
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 02-26-2009 , 17:17   Re: [L4D] give player weapon
Reply With Quote #17

ok im getting some wird errors i dont know what they mean

Code:
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(75) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(75) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(75) : error 001: expected token: ";", but found "if"
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(80) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(80) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(80) : error 001: expected token: ";", but found "if"
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(85) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(85) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(85) : error 001: expected token: ";", but found "if"
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(90) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(90) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(90) : error 001: expected token: ";", but found "if"
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(95) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(95) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(95) : error 001: expected token: ";", but found "if"
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(100) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(100) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(100) : error 001: expected token: ";", but found "if"
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(105) : error 029: invalid expression, assumed zero
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(105) : warning 215: expression has no effect
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(105) : error 001: expected token: ";", but found "if"
/home/groups/sourcemod/upload_tmp/textGG1FKm.sp(112) : error 030: compound statement not closed at the end of file (started at line 106)

15 Errors.
PHP Code:
/***************GUNS***************
] give ammo - not included
] give autoshotgun
] give first_aid_kit - not included
] give health - not included
] give pipe_bomb
] give molotov
] give rifle
] give smg
] give hunting_rifle
] give pain_pills
] give pistol
] give pumpshotgun
************END LIST***************/
/**********Thanks To**************
 * CrimsonGt - helped me with give player item issues
*********************************/
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "1.0.0"
public Plugin:myinfo 
{
 
name "[L4D] Tank Buster Wepons Menu",
 
author "{7~11} TROLL",
 
description "Gives Clients Gun Menu Incase There Out Of Ammo",
 
version PLUGIN_VERSION,
 
url "www.711clan.net"
}
public 
OnPluginStart()
{
 
//tank buster weapons menu cvar
 
RegConsoleCmd("tankbuster"TankBusterMenu);
 
//plugin version
 
CreateConVar("tank_buster_version"PLUGIN_VERSION"Tank_Buster_Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}
public 
Action:TankBusterMenu(client,args)
{
 
TankBuster(client);
}
public 
Action:TankBuster(clientId) {
 new 
Handle:menu CreateMenu(TankBusterMenuHandler);
 
SetMenuTitle(menu"Tank Buster Weapons Menu");
 
AddMenuItem(menu"option1""Shotgun");
 
AddMenuItem(menu"option2""SMG");
 
AddMenuItem(menu"option3""Rifle");
 
AddMenuItem(menu"option4""Hunting Rifle");
 
AddMenuItem(menu"option5""Auto Shotgun");
 
AddMenuItem(menu"option6""Pipe Bomb");
 
AddMenuItem(menu"option7""Molotov");
 
AddMenuItem(menu"option8""Dual Pistols");
 
SetMenuExitButton(menutrue);
 
DisplayMenu(menuclientIdMENU_TIME_FOREVER);
 
 return 
Plugin_Handled;
}
public 
TankBusterMenuHandler(Handle:menuMenuAction:actionclientitemNum)
{
 
//Strip the CHEAT flag off of the "give" command
 
new flags GetCommandFlags("give");
 
SetCommandFlags("give"flags & ~FCVAR_CHEAT);
 
 if ( 
action == MenuAction_Select ) {
  new 
String:info[32];
  
  if (
strcmp(info,"option1") == ) {
   {
    
//Give the player a rifle
    
FakeClientCommand(client"give rifle");
   }
   else if ( 
strcmp(info,"option2") == ) {
    {
     
//Give the player a smg
     
FakeClientCommand(client"give smg");
    }
    else if ( 
strcmp(info,"option3") == ) {
     {
      
//Give the player a rifle
      
FakeClientCommand(client"give rifle");
     }
     else if ( 
strcmp(info,"option4") == ) {
      {
       
//Give the player a rifle
       
FakeClientCommand(client"give hunting_rifle");
      }
      else if ( 
strcmp(info,"option5") == ) {
       {
        
//Give the player a rifle
        
FakeClientCommand(client"give autoshotgun");
       }
       else if ( 
strcmp(info,"option6") == ) {
        {
         
//Give the player a rifle
         
FakeClientCommand(client"give pipe_bomb");
        }
        else if ( 
strcmp(info,"option7") == ) {
         {
          
//Give the player a rifle
          
FakeClientCommand(client"give molotov");
         }
         else if ( 
strcmp(info,"option8") == ) {
          {
           
//Give the player a rifle
           
FakeClientCommand(client"give pistol");
          }
          
//Add the CHEAT flag back to "give" command
          
SetCommandFlags("give"flags|FCVAR_CHEAT); 
__________________
{7~11} TROLL is offline
CrimsonGT
Veteran Member
Join Date: Oct 2007
Location: Gainesville, FL
Old 02-26-2009 , 17:28   Re: [L4D] give player weapon
Reply With Quote #18

Your not closing a bunch of if statements. Are you writing in Notepad or something? You need to grab an IDE (it tells you when your opening and closing brackets) and a lot of other stuff that makes this very easy. I would recommend Pawn Studio.
__________________
CrimsonGT is offline
{7~11} TROLL
Senior Member
Join Date: Oct 2008
Location: Atlanta,Georgia
Old 02-26-2009 , 18:15   Re: [L4D] give player weapon
Reply With Quote #19

i use pawn they all looked closed to me, also whats ide?
__________________

Last edited by {7~11} TROLL; 02-26-2009 at 18:19.
{7~11} TROLL is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 02-26-2009 , 18:21   Re: [L4D] give player weapon
Reply With Quote #20

Then you didn't give all the code.

See the missing ones at the end? It just sorta stops. The outter if isn't finished and the function isn't finished.

Also

PHP Code:
  if (strcmp(info,"option1") == ) {
   { 
has two "{"

As do a lot of other of your ifs.

PHP Code:
/***************GUNS***************
] give ammo - not included
] give autoshotgun
] give first_aid_kit - not included
] give health - not included
] give pipe_bomb
] give molotov
] give rifle
] give smg
] give hunting_rifle
] give pain_pills
] give pistol
] give pumpshotgun
************END LIST***************/

/**********Thanks To**************
 * CrimsonGt - helped me with give player item issues
*********************************/

#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "1.0.0"

public Plugin:myinfo 
{
    
name "[L4D] Tank Buster Wepons Menu",
    
author "{7~11} TROLL",
    
description "Gives Clients Gun Menu Incase There Out Of Ammo",
    
version PLUGIN_VERSION,
    
url "www.711clan.net"
}

public 
OnPluginStart()
{
    
//tank buster weapons menu cvar
    
RegConsoleCmd("tankbuster"TankBusterMenu);
    
//plugin version
    
CreateConVar("tank_buster_version"PLUGIN_VERSION"Tank_Buster_Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
}

public 
Action:TankBusterMenu(client,args)
{
    
TankBuster(client);
}

public 
Action:TankBuster(clientId)
{
    new 
Handle:menu CreateMenu(TankBusterMenuHandler);
    
SetMenuTitle(menu"Tank Buster Weapons Menu");
    
AddMenuItem(menu"option1""Shotgun");
    
AddMenuItem(menu"option2""SMG");
    
AddMenuItem(menu"option3""Rifle");
    
AddMenuItem(menu"option4""Hunting Rifle");
    
AddMenuItem(menu"option5""Auto Shotgun");
    
AddMenuItem(menu"option6""Pipe Bomb");
    
AddMenuItem(menu"option7""Molotov");
    
AddMenuItem(menu"option8""Dual Pistols");
    
SetMenuExitButton(menutrue);
    
DisplayMenu(menuclientIdMENU_TIME_FOREVER);

    return 
Plugin_Handled;
}

public 
TankBusterMenuHandler(Handle:menuMenuAction:actionclientitemNum)
{
    
//Strip the CHEAT flag off of the "give" command
    
new flags GetCommandFlags("give");
    
SetCommandFlags("give"flags & ~FCVAR_CHEAT);

    if ( 
action == MenuAction_Select ) {
        new 
String:info[32];

        if (
strcmp(info,"option1") == ) {
        {
            
//Give the player a rifle
            
FakeClientCommand(client"give rifle");
        }
        else if ( 
strcmp(info,"option2") == ) {
        {
            
//Give the player a smg
            
FakeClientCommand(client"give smg");
        }
        else if ( 
strcmp(info,"option3") == ) {
        {
            
//Give the player a rifle
            
FakeClientCommand(client"give rifle");
        }
        else if ( 
strcmp(info,"option4") == ) {
        {
            
//Give the player a rifle
            
FakeClientCommand(client"give hunting_rifle");
        }
        else if ( 
strcmp(info,"option5") == ) {
        {
            
//Give the player a rifle
            
FakeClientCommand(client"give autoshotgun");
        }
        else if ( 
strcmp(info,"option6") == ) {
        {
            
//Give the player a rifle
            
FakeClientCommand(client"give pipe_bomb");
        }
        else if ( 
strcmp(info,"option7") == ) {
        {
            
//Give the player a rifle
            
FakeClientCommand(client"give molotov");
        }
        else if ( 
strcmp(info,"option8") == ) {
        {
            
//Give the player a rifle
            
FakeClientCommand(client"give pistol");
        }

        
//Add the CHEAT flag back to "give" command
        
SetCommandFlags("give"flags|FCVAR_CHEAT); 
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)

Last edited by Lebson506th; 02-26-2009 at 18:24.
Lebson506th 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 20:09.


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