| TitANious |
04-10-2009 07:09 |
My plugin (ScoutKnifezManager) Help pls? :)
PHP Code:
#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
#define PLUGIN "ScoutKnifeZ_Manager"
#define VERSION "0.1"
#define AUTHOR "TitANious"
new gCvarEnabled
new gCvarGravity800
new gCvarGravity600
new gCvarGravity400
new gCvarGravity200
new gCvarGravity100
new gCvarSG550
new gCvarG3SG1
new gCvarAWP
new gCvarRespawn
new gCvar_respawndelay
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /Scoutmenu","cmdScoutKnifeZMenu") ,
register_clcmd("say_team /Scoutmenu","cmdScoutKnifeZMenu")
register_plugin("Player", "Respawn", "Test")
register_event("DeathMsg", "event_deathmsg", "a")
gCvar_respawndelay = register_cvar("amx_respawndelay", "5.0") // Delay before respawning
gCvarEnabled = register_cvar("SKM_enabled", "1")
gCvarGravity800 = register_cvar("SKM_g800", "1")
gCvarGravity600 = register_cvar("SKM_g600", "1")
gCvarGravity400 = register_cvar("SKM_g400", "1")
gCvarGravity200 = register_cvar("SKM_g200", "1")
gCvarGravity100 = register_cvar("SKM_g100", "1")
gCvarSG550 = register_cvar("SKM_SG550", "1")
gCvarG3SG1 = register_cvar("SKM_G3SG1", "1")
gCvarAWP = register_cvar("SKM_AWP", "1")
gCvarRespawn = register_cvar("Respawn", "1")
}
public cmdScoutKnifeZMenu( id ) {
if(!get_pcvar_num(gCvarEnabled))
return;
new menu = menu_create ("\rMenu for ScoutKnifeZ_Manager!:", "handleScoutKnifeZMenu")
menu_additem(menu, "\wGravity800", "1", 0)
menu_additem(menu, "\wGravity600", "2", 0)
menu_additem(menu, "\wGravity400", "3", 0)
menu_additem(menu, "\wGravity200", "4", 0)
menu_additem(menu, "\wGravity100", "5", 0)
menu_additem(menu, "\wGiveSg550", "6", 0)
menu_additem(menu, "\wGiveAWP", "7", 0)
menu_additem(menu, "\wGiveG3sg1", "8", 0)
menu_display(id, menu, 0)
}
public handleScoutKnifeZMenu(id, menu, item) {
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
new key = str_to_num(data)
switch( key)
{
case 1:
{
if(get_pcvar_num(gCvarGravity800)) {
set_user_gravity(id, 1.0)
client_print(id, print_chat, "You have 800 gravity isnt that normal?")
}
}
case 2:
{
if(get_pcvar_num(gCvarGravity600)) {
set_user_gravity(id, 0.75)
client_print(id, print_chat, "600 gravity, a bit less than 800, nothing less?")
}
}
case 3:
{
if(get_pcvar_num(gCvarGravity400)) {
set_user_gravity(id, 0.5)
client_print(id, print_chat, "400, the half of normal!")
}
}
case 4:
{
if(get_pcvar_num(gCvarGravity200)) {
set_user_gravity(id, 0.25)
client_print(id, print_chat, "200, the half of 400, you jump high now")
}
}
case 5:
{
if(get_pcvar_num(gCvarGravity100)) {
set_user_gravity(id, 0.125)
client_print(id, print_chat, "100, the less in the whole server!")
}
}
case 6:
{
if(get_pcvar_num(gCvarSG550)) {
client_cmd(id, "slot1; drop")
give_item( id, "weapon_sg550" )
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
give_item( id, "ammo_556nato")
client_print(id, print_chat, "Didnt i deleted SG550?!")
}
}
case 7:
{
if(get_pcvar_num(gCvarAWP)) {
client_cmd(id, "slot1; drop")
give_item( id, "weapon_awp" )
give_item( id, "ammo_338magnum" )
give_item( id, "ammo_338magnum" )
give_item( id, "ammo_338magnum" )
give_item( id, "ammo_338magnum" )
give_item( id, "ammo_338magnum" )
client_print(id, print_chat, "Isnt a AWP forbidden?!")
}
}
case 8:
{
if(get_pcvar_num(gCvarG3SG1)) {
client_cmd(id, "slot1; drop")
give_item(id, "weapon_g3sg1" )
give_item(id, "ammo_762nato")
give_item(id, "ammo_762nato")
give_item(id, "ammo_762nato")
give_item(id, "ammo_762nato")
give_item(id, "ammo_762nato")
give_item(id, "ammo_762nato")
client_print(id, print_chat, "Did you really buy a G3SG1?!")
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public event_deathmsg(id)
{
// read_data(2) = victim
set_task(get_pcvar_float(gCvar_respawndelay), "respawn_player", read_data(2))
}
public respawn_player(id)
{
if(get_pcvar_num(gCvarRespawn))
// Disconnected, already spawned, or switched to Spectator
if (!is_user_connected(id) || is_user_alive(id) || cs_get_user_team(id) == CS_TEAM_SPECTATOR)
return;
// (Debug only)
client_print(0, print_chat, "Player %d is being respawned", id)
// Try to spawn the player setting the appropiate dead flag and forcing a think
set_pev(id, pev_deadflag, DEAD_RESPAWNABLE)
dllfunc(DLLFunc_Think, id)
// Fix for CZ Bots: DLLFunc_Think won't work on them,
// but DLLFunc_Spawn does the job without any bugs.
// (for some reason I'm not suprised...)
if (is_user_bot(id) && pev(id, pev_deadflag) == DEAD_RESPAWNABLE)
{
dllfunc(DLLFunc_Spawn, id)
}
}
I need help with:
1. When i gets weapon(Sniper) From the menu, its drop instead of equip, i know its because of client_cmd(id, "slot1; drop") , but if it isnt there it begins to pile op in the primary slot
2. When i disable, exampel AWP in pcvar, then it can still be seen in menu, but you cant take it
|