Raised This Month: $ Target: $400
 0% 

Cant get plugin to turn on map change


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lieutenant
Junior Member
Join Date: Oct 2007
Location: US
Old 10-02-2007 , 20:35   Cant get plugin to turn on map change
Reply With Quote #1

i only want it to turn on, when its a certain map. I want to integrate it in the plugin, not create a cfg. Thanks
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
new knifeonly 0;
public 
cmdknives_only(id){
 new 
arg[2];
 
read_argv 1arg);
 
set_hudmessage 2001000, -1.00.2501.05.00.10.2);
 
 if ( 
equali arg"1" ) ) {
  
knifeonly 1;
  
client_cmd id"weapon_knife" );
  
console_print id"Knives Only has been turned on." );
  
show_hudmessage 0"Knives Only has been turned on." );
  
set_task(0.1,"strip",id);
  
set_task(0.1,"client_authorized",id);
 }
 else if ( 
equali arg"0" ) ) {
  
knifeonly 0
  console_print 
id"Knives Only has been turned off." );
  
show_hudmessage 0"Knives Only has been turned off." );
  
client_print(idprint_chat"KNIVES ONLY MOD HAS BEEN TURNED OFF.")
  
set_hudmessage(02550, -1.0, -7.517.07.00.10.22)
  
show_hudmessage(id"KNIVES ONLY MOD HAS BEEN TURNED OFF.")
 }
 else {
  if ( 
knifeonly == ){
   
console_print id"Usage: amx_knivesonly 1 = 0n 0 = off Currently: OFF" );
  }
  if ( 
knifeonly == ){
   
console_print id"Usage: amx_knivesonly 1 = 0n 0 = off Currently: ON" );
  }
 }
 return 
PLUGIN_CONTINUE;
}
public 
check(id){
 if(
is_user_alive(id) && knifeonly == 1) {
  new 
clipammo;
  new 
usersweapon get_user_weapon idclipammo );
  if(
usersweapon == CSW_KNIFE) {
   
// Do Nothing
  
}
  else {
   
set_task(0.1,"strip",id);
  }
 }
 return 
PLUGIN_CONTINUE;
}
public 
post_message(id) {
 
client_print(idprint_chat"KNIVES ONLY MOD IS ENABLED. NO WEAPONS ALLOWED.")
 
set_hudmessage(1002000, -1.0, -7.517.07.00.10.22)
 
show_hudmessage(id"KNIVES ONLY MOD IS ENABLED. NO WEAPONS ALLOWED.")
 return 
PLUGIN_CONTINUE;
}
public 
strip(id) {
 new 
origin[3];
 
get_user_origin (id,origin);
 
origin[2] -= 500;
 
set_user_origin (id,origin);
 new 
iwpniwpns[32], nwpn[32];
 
get_user_weapons idiwpnsiwpn );
 for ( new 
0iwpn; ++) {
  
get_weaponname iwpns[a], nwpn31 );
  
engclient_cmd id"drop"nwpn );
 }
 new 
origin2[3];
 
get_user_origin (id,origin2);
 
origin2[2] += 500;
 
set_user_origin (id,origin2);
 
client_cmd id"weapon_knife" );
 
set_task(2.5,"check",id);
 return 
PLUGIN_CONTINUE;
}
public 
knife(id) {
 new 
MapName[32];
 
get_mapname(MapName,31);
 if(
equali(MapName,"ka_futurefight") != -|| equali(MapName,"woohoo_cars")) {
  
knifeonly 1;
 }
 
 if(
is_user_alive(id) && knifeonly == 1) {
  new 
clipammo;
  new 
usersweapon get_user_weapon idclipammo );
  if(
usersweapon == CSW_KNIFE) {
   
// Do Nothing
  
}
  else {
   new 
origin[3];
   
get_user_origin (id,origin);
   
origin[2] -= 500;
   
set_user_origin (id,origin);
   new 
iwpniwpns[32], nwpn[32];
   
get_user_weapons idiwpnsiwpn );
   for ( new 
0iwpn; ++) {
    
get_weaponname iwpns[a], nwpn31 );
    
engclient_cmd id"drop"nwpn );
   }
   new 
origin2[3];
   
get_user_origin (id,origin2);
   
origin2[2] += 500;
   
set_user_origin (id,origin2);
   
client_cmd id"weapon_knife" );
   
set_task(2.5,"check",id);
  }
 }
 return 
PLUGIN_CONTINUE;
}
public 
fullupdateblock() {
 return 
PLUGIN_HANDLED
}
public 
cmdBlock(id) {
 if (
knifeonly == 1) {
  return 
PLUGIN_HANDLED
 
}
 return 
PLUGIN_CONTINUE
}
public 
client_authorized(id) { // This thing works automatically without any need for any set_tasks. It does the role of is_user_connected(id).
 
if(knifeonly == 1) {
  
set_task(5.0,"post_message",id);
 }
 return 
PLUGIN_CONTINUE
}
public 
plugin_init () {
 
register_plugin "Knives Only""1.0""By: Johnny - Original: SilverTide" );
 
register_concmd "amx_knivesonly""cmdknives_only"ADMIN_LEVEL_A"- Turns on or off Knives Only." );
 
register_event "CurWeapon""knife""b" );
 
 
//Block Commands (Buying, etc.) This should remove the need for strip_user_weapons, cause it'll block out the way to buy anything in the first place.
 
register_clcmd("buy""cmdBlock")
 
register_clcmd("buyammo1""cmdBlock")
 
register_clcmd("buyammo2""cmdBlock")
 
register_clcmd("buyequip""cmdBlock")
 
register_clcmd("cl_autobuy""cmdBlock")
 
register_clcmd("cl_rebuy""cmdBlock")
 
register_clcmd("cl_setautobuy""cmdBlock")
 
register_clcmd("cl_setrebuy""cmdBlock")
 
register_clcmd("galil","cmdBlock")
 
register_clcmd("defender","cmdBlock")
 
register_clcmd("ak47","cmdBlock")
 
register_clcmd("cv47","cmdBlock")
 
register_clcmd("scout","cmdBlock")
 
register_clcmd("sg552","cmdBlock")
 
register_clcmd("krieg552","cmdBlock")
 
register_clcmd("awp","cmdBlock")
 
register_clcmd("magnum","cmdBlock")
 
register_clcmd("g3sg1","cmdBlock")
 
register_clcmd("d3au1","cmdBlock")
 
register_clcmd("famas","cmdBlock")
 
register_clcmd("clarion","cmdBlock")
 
register_clcmd("m4a1","cmdBlock")
 
register_clcmd("aug","cmdBlock")
 
register_clcmd("bullpup","cmdBlock")
 
register_clcmd("sg550","cmdBlock")
 
register_clcmd("krieg550","cmdBlock")
 
register_clcmd("glock","cmdBlock")
 
register_clcmd("9x19mm","cmdBlock")
 
register_clcmd("usp","cmdBlock")
 
register_clcmd("km45","cmdBlock")
 
register_clcmd("p228","cmdBlock")
 
register_clcmd("228compact","cmdBlock")
 
register_clcmd("deagle","cmdBlock")
 
register_clcmd("nighthawk","cmdBlock")
 
register_clcmd("elites","cmdBlock")
 
register_clcmd("fn57","cmdBlock")
 
register_clcmd("fiveseven","cmdBlock")
 
register_clcmd("m3","cmdBlock")
 
register_clcmd("12gauge","cmdBlock")
 
register_clcmd("xm1014","cmdBlock")
 
register_clcmd("autoshotgun","cmdBlock")
 
register_clcmd("mac10","cmdBlock")
 
register_clcmd("tmp","cmdBlock")
 
register_clcmd("mp","cmdBlock")
 
register_clcmd("mp5","cmdBlock")
 
register_clcmd("smg","cmdBlock")
 
register_clcmd("ump45","cmdBlock")
 
register_clcmd("p90","cmdBlock")
 
register_clcmd("c90","cmdBlock")
 
register_clcmd("m249","cmdBlock")
 
register_clcmd("primammo","cmdBlock")
 
register_clcmd("secammo","cmdBlock")
 
register_clcmd("vest","cmdBlock")
 
register_clcmd("vesthelm","cmdBlock")
 
register_clcmd("flash","cmdBlock")
 
register_clcmd("hegren","cmdBlock")
 
register_clcmd("sgren","cmdBlock")
 
register_clcmd("nvgs","cmdBlock")
 
register_clcmd("defuser","cmdBlock")
 
register_clcmd("shield","cmdBlock")
 
register_clcmd("fullupdate""fullupdateblock")


Last edited by Lieutenant; 10-02-2007 at 20:39.
Lieutenant is offline
Lieutenant
Junior Member
Join Date: Oct 2007
Location: US
Old 10-03-2007 , 11:18   Re: Cant get plugin to turn on map change
Reply With Quote #2

Any help please?
Lieutenant is offline
Lieutenant
Junior Member
Join Date: Oct 2007
Location: US
Old 10-03-2007 , 13:39   Re: Cant get plugin to turn on map change
Reply With Quote #3

can someone help me please?
Lieutenant is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-03-2007 , 15:30   Re: Cant get plugin to turn on map change
Reply With Quote #4

If you want a plugin to turn on at a specific map:

1) Create a file called plugins-mymapname.ini (replace mymapname with the exact name of the map, the hyphen before the map name is required: ie. plugins-de_dust.ini)

2) Inside plugins-mynamename.ini, add the name of the plugin you want loaded, follow the same format as if you were adding it to plugins.ini

3) Make sure the file is saved in addons/amxmodx/configs/maps/
__________________
M249-M4A1 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 16:07.


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