Raised This Month: $ Target: $400
 0% 

[HELP] My first plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Milano
Junior Member
Join Date: Oct 2009
Old 10-12-2009 , 12:06   [HELP] My first plugin
Reply With Quote #1

Hi.
First I wanna say that this my first plugin, and I new to scripting. So I was wondering if I can get help. Here is code, but I get many errors I dont know to fix. So if you can help me fix the errors, I appreciate.

PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <fun>
#include <fakemeta_util>
 
#define PLUGIN "Weaponmod"
#define VERSION "1.0"
#define AUTHOR "Milano"
 
new g_CvarOn
new szPrefix[19] = "[WM]"
new g_MaxPlayers;
 
public 
plugin_init() {
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
register_clcmd"say /weapons""MenuWeapons" )
 
register_clcmd"say_team /weapons""MenuWeapons" )
 
 
g_CvarOn register_cvar"wm_enable""1" )
 
register_cvar("wm_blockbuy""1"
 
register_cvar("wm_prefix"szPrefix)
 
 
g_MaxPlayers get_maxplayers( );
 
 
 if (
get_cvar_num("wm_blockbuy"))
 {
  
register_clcmd("buy""bblocked");
  
register_clcmd("cl_autobuy""bblocked");
  
register_clcmd("cl_rebuy""bblocked");
  
register_clcmd("cl_setautobuy""bblocked");
  
register_clcmd("cl_setrebuy""bblocked");
 
  
register_clcmd("glock""bblocked");
  
register_clcmd("usp""bblocked");
  
register_clcmd("p228""bblocked");
  
register_clcmd("deagle""bblocked");
  
register_clcmd("elites""bblocked");
  
register_clcmd("fn57""bblocked");
 
  
register_clcmd("mp5""bblocked");
  
register_clcmd("smg""bblocked");
  
register_clcmd("mac10""bblocked");
  
register_clcmd("tmp""bblocked");
  
register_clcmd("ump45""bblocked");
  
register_clcmd("p90""bblocked");
 
  
register_clcmd("m3""bblocked");
  
register_clcmd("xm1014""bblocked");
 
  
register_clcmd("famas""bblocked");
  
register_clcmd("m4a1""bblocked");
  
register_clcmd("ak47""bblocked");
  
register_clcmd("sg552""bblocked");
  
register_clcmd("galil""bblocked"); 
  
register_clcmd("aug""bblocked");
 
  
register_clcmd("scout""bblocked");
  
register_clcmd("awp""bblocked");
  
register_clcmd("sg550""bblocked");
  
register_clcmd("g3sg1""bblocked");
 
  
register_clcmd("m249""bblocked");
 
  
register_clcmd("hegren""bblocked");
  
register_clcmd("flash""bblocked");
  
register_clcmd("sgren""bblocked");
  
register_clcmd("vest""bblocked");
  
register_clcmd("vesthelm""bblocked");
  
register_clcmd("shield""bblocked");
  
register_clcmd("buyammo1""bblocked");
  
register_clcmd("buyammo1""bblocked");
  
register_clcmd("buyequip""bblocked");
 }
}
public 
MenuWeaponsid )
{
 if( 
get_user_teamid ) == CS_TEAM_CT 
 
&& get_pcvar_numg_CvarOn 
 && 
is_user_aliveid ) )
{
 new 
menu menu_create"Weapons""WeaponsHandle" )
 
 
menu_additemmenu"Rifleman""1")
 
menu_additemmenu"Support Infantry""2")
 
menu_additemmenu"Assault""3")
 
menu_additemmenu"Light Infantry""4")
 
menu_additemmenu"Sniper""5")
 
menu_additemmenu"Machine Gunner""6"
 
 
menu_setpropmenuMPROP_EXITMEXIT_NEVER ); 
 
menu_displayidmenu)
 return 
PLUGIN_HANDLED;
}
return 
PLUGIN_CONTINUE
}
public 
WeaponsHandleidmenuitem )
{
if( 
item == MENU_EXIT )
{
 
menu_destroymenu )
 return 
PLUGIN_HANDLED
}
new 
szData], szName64 ], iAccessiCallbackszWeapon33 ][ 32 ], szPrint33 ][ 32 ]
menu_item_getinfomenuitemiAccessszData5szName63iCallback )
new 
key str_to_numszData )
switch( 
key )
{
 case 
1
 {
  
szWeaponid ] = "weapon_m4a1"
  
szWeaponid ] = "weapon_usp"
  
szPrintid ] = "M4A1 & Usp"
 
}
 case 
2:
 {
  
szWeaponid ] = "weapon_m3"
  
szWeaponid ] = "weapon_deagle"
  
szPrintid ] = "M3 & Deagle"
 
}
 case 
3:
 {
  
szWeaponid ] = "weapon_famas"
  
szWeaponid ] = "weapon_glock18"
  
szPrintid ] = "Famas & Glock"
 
}
 case 
4:
 {
  
szWeaponid ] = "weapon_mp5"
  
szWeaponid ] = "weapon_usp"
  
szPrintid ] = "MP5 & Usp"
 
}
 case 
5:
 {
  
szWeaponid ] = "weapon_awp"
  
szWeaponid ] = "weapon_glock18"
  
szPrintid ] = "AWP & Glock"
 
}
 case 
6:
 {
  
szWeaponid ] = "weapon_m249"
  
szWeaponid ] = "weapon_fiveseven"
  
szPrintid ] = "Para & Fiveseven"
 
}
 
 
strip_user_weaponsid )
 
give_itemidszWeaponid ] )
 
client_printidprint_chat"You now have %s"szPrint )
 
 
menu_destroymenu )
 return 
PLUGIN_HANDLED;
}  
public 
MenuWeapons1id )
{
 if( 
get_user_teamid ) == CS_TEAM_T 
 
&& get_pcvar_numg_CvarOn 
 && 
is_user_aliveid ) )
{
 new 
menu menu_create"Weapons""WeaponsHandle1" )
 
 
menu_additemmenu"Rifleman""1")
 
menu_additemmenu"Support Infantry""2")
 
menu_additemmenu"Assault""3")
 
menu_additemmenu"Light Infantry""4")
 
menu_additemmenu"Sniper""5")
 
menu_additemmenu"Machine Gunner""6"
 
 
menu_setpropmenuMPROP_EXITMEXIT_NEVER ); 
 
menu_displayidmenu)
 return 
PLUGIN_HANDLED;
}
return 
PLUGIN_CONTINUE
}
public 
WeaponsHandle1idmenuitem )
{
if( 
item == MENU_EXIT )
{
 
menu_destroymenu )
 return 
PLUGIN_HANDLED
}
new 
szData], szName64 ], iAccessiCallbackszWeapon33 ][ 32 ], szPrint33 ][ 32 ]
menu_item_getinfomenuitemiAccessszData5szName63iCallback )
new 
key str_to_numszData )
switch( 
key )
{
 case 
1
 {
  
szWeaponid ] = "weapon_AK47"
  
szWeaponid ] = "weapon_glock18"
  
szPrintid ] = "AK47 & Glock"
 
}
 case 
2:
 {
  
szWeaponid ] = "weapon_xm1014"
  
szWeaponid ] = "weapon_deagle"
  
szPrintid ] = "XM1014 & Deagle"
 
}
 case 
3:
 {
  
szWeaponid ] = "weapon_galil"
  
szWeaponid ] = "weapon_fiveseven"
  
szPrintid ] = "Galil & Fiveseven"
 
}
 case 
4:
 {
  
szWeaponid ] = "weapon_ump45"
  
szWeaponid ] = "weapon_elite"
  
szPrintid ] = "UMP45 & Dualies"
 
}
 case 
5:
 {
  
szWeaponid ] = "weapon_awp"
  
szWeaponid ] = "weapon_usp"
  
szPrintid ] = "AWP & Usp"
 
}
 case 
6:
 {
  
szWeaponid ] = "weapon_m249"
  
szWeaponid ] = "weapon_p228"
  
szPrintid ] = "Para & P228"
 
}
 
 
strip_user_weaponsid )
 
give_itemidszWeaponid ] )
 
client_printidprint_chat"You now have %s"szPrint )
 
 
menu_destroymenu )
 return 
PLUGIN_HANDLED;
}  
public 
bblocked(id)
{
 
show_motd(id,GREEN"%L"id"%s Buy and Buy Bind's are Blocked."szPrefix);
 return 
PLUGIN_HANDLED

I want weaponshandle1 and menuweapons1 to be for Terrorist only, and WeaponsHandle and menuweapons to be for CT only. And I want to disable buy command. Please help, sorry for bad english.
Milano is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-12-2009 , 12:15   Re: [HELP] My first plugin
Reply With Quote #2

If you coded all this (probably not) then you would easily know how to fix errors.
__________________
xPaw is offline
Milano
Junior Member
Join Date: Oct 2009
Old 10-12-2009 , 12:17   Re: [HELP] My first plugin
Reply With Quote #3

I code mostly all myself, I saw on others how they do, and I do myself. I just copy the stuff to block buy command, rest I make by tutorials and look on other plugins.

I see on errors I get when compile, but I dont understand how fix them.
Milano is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 10-12-2009 , 12:23   Re: [HELP] My first plugin
Reply With Quote #4

get_user_team -> cs_get_user_team

You forget to add } line 147 & 225
Code:
 case 6:  {   szWeapon[ id ] = "weapon_m249"   szWeapon[ id ] = "weapon_fiveseven"   szPrint[ id ] = "Para & Fiveseven"  } }  strip_user_weapons( id )

Why you're doing show_motd ? Maybe you wanted to do ColorChat?
__________________
xPaw is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 10-12-2009 , 12:23   Re: [HELP] My first plugin
Reply With Quote #5

Don't bother xPaw.
He obviously can't listen anyone or fix the errors even they are told to him. http://forums.alliedmods.net/showthread.php?t=106211
SnoW is offline
Send a message via MSN to SnoW
Milano
Junior Member
Join Date: Oct 2009
Old 10-12-2009 , 12:26   Re: [HELP] My first plugin
Reply With Quote #6

I did what you tell me snow, but it still has errors.
Milano is offline
OneMoreLevel
Senior Member
Join Date: Aug 2009
Location: Look behind you... Very
Old 10-12-2009 , 16:21   Re: [HELP] My first plugin
Reply With Quote #7

Try Ctrl-I, your code doesnt look indented.
__________________
60/100 60%
[||||||||||||||||||||]
Project: Warfighter mod
Blog:
http://sites.google.com/site/dailymultitasker/
PHP Code:
   if ( i_help_you "Yes" ) == )
    
set_user_karma(onemorelevel,add,+1
OneMoreLevel is offline
Reply


Thread Tools
Display Modes

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 22:36.


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