BANNED
Join Date: Jul 2007
Location: (#504434)
|
08-06-2007
, 14:39
Bury/Strip - KnifeOnly
|
#1
|
***This tutorial consists of two main codes***
- Strip all weapons, and allow knife only on everybody
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fun>
new knifeonly = 0;
public plugin_init() { register_plugin("Strip/Bury KnifeOnly", "1.0", "X-Script") register_concmd ( "amx_knivesonly", "onlyknife", ADMIN_LEVEL_A, "- Turns on or off Knives Only." ); register_event ( "CurWeapon", "knife", "b" ); }
public onlyknife ( id ) { new arg[2]; read_argv ( 1, arg, 1 ); set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 ); if ( equal ( 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" ); } else if ( equal ( arg, "0" ) ) { knifeonly = 0 console_print ( id, "Knife Only has been turned OFF" ); show_hudmessage ( 0, "Knife Only has been turned OFF" ); } else { if ( knifeonly == 0 ){ console_print ( id, "[Knife Only] Plugin Status: OFF" ); } if ( knifeonly == 1 ){ console_print ( id, "[Knife Only] Plugin Status: ON" ); } } return PLUGIN_CONTINUE; }
public knife ( id ) { if ( knifeonly == 0 ) { } if ( knifeonly == 1 ) { new clip, ammo; new usersweapon = get_user_weapon ( id, clip, ammo ); if ( usersweapon == CSW_KNIFE ) { } else { new iwpn, iwpns[32], nwpn[32]; get_user_weapons ( id, iwpns, iwpn ); for ( new a = 0; a < iwpn; ++a ) { get_weaponname ( iwpns[a], nwpn, 31 ); engclient_cmd ( id, "drop", nwpn ); } client_cmd ( id, "weapon_knife" ); } } return PLUGIN_HANDLED; }
- Bury everyone, strip all weapons, unbury everyone, allow knife only
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fun>
new knifeonly = 0;
public plugin_init() { register_plugin("Strip/Bury KnifeOnly", "1.0", "X-Script") register_concmd ( "amx_knivesonly", "onlyknife", ADMIN_LEVEL_A, "- Turns on or off Knives Only." ); register_event ( "CurWeapon", "knife", "b" ); }
public onlyknife ( id ) { new arg[2]; read_argv ( 1, arg, 1 ); set_hudmessage ( 200, 100, 0, -1.0, 0.25, 0, 1.0, 5.0, 0.1, 0.2, 2 ); if ( equal ( 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" ); } else if ( equal ( arg, "0" ) ) { knifeonly = 0 console_print ( id, "Knife Only has been turned OFF" ); show_hudmessage ( 0, "Knife Only has been turned OFF" ); } else { if ( knifeonly == 0 ){ console_print ( id, "[Knife Only] Plugin Status: OFF" ); } if ( knifeonly == 1 ){ console_print ( id, "[Knife Only] Plugin Status: ON" ); } } return PLUGIN_CONTINUE; }
public knife ( id ) { if ( knifeonly == 0 ) { } if ( knifeonly == 1 ) { new clip, ammo; new usersweapon = get_user_weapon ( id, clip, ammo ); if ( usersweapon == CSW_KNIFE ) { } else { new origin[3]; get_user_origin ( id, origin ); origin[2] -= 500; set_user_origin ( id, origin ); new iwpn, iwpns[32], nwpn[32]; get_user_weapons ( id, iwpns, iwpn ); for ( new a = 0; a < iwpn; ++a ) { get_weaponname ( iwpns[a], nwpn, 31 ); 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" ); } } return PLUGIN_HANDLED; }
Both codes will display a chat and hudmessage telling the user knife only is either on or off. In the first code all players will only be stripped of all weapons and be given a knife to only to a knife battle with everyone that is still alive. In the second code all players will be buried, stripped of all weapons and then unburied after this happens everyone will only be allowed a knife to battle it out. I used origins to place the user into the ground and then bring him up out of the ground . I haven't tried to compile the plugin to see if it even compiles but I do know the code works and it's helpful.
|
|