Raised This Month: $ Target: $400
 0% 

My plugin (ScoutKnifezManager) Help pls? :)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-10-2009 , 07:09   My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #1

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(PLUGINVERSIONAUTHOR)  
    
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 
cmdScoutKnifeZMenuid ) { 
    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(idmenu0)  
}  

public 
handleScoutKnifeZMenu(idmenuitem)  { 
    if (
item == MENU_EXIT)  
    {  
        
menu_destroy(menu)  
        return 
PLUGIN_HANDLED  
    
}  
    new 
data[6], iName[64]  
    new 
accesscallback  
     
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)  
    new 
key str_to_num(data)  
     
    switch( 
key
    { 
        case 
1:  
        {  
    if(
get_pcvar_num(gCvarGravity800)) { 
                
set_user_gravity(id1.0)  
                
client_print(idprint_chat"You have 800 gravity isnt that normal?"
            } 
        }  
        case 
2:  
        { 
    if(
get_pcvar_num(gCvarGravity600)) { 
                
set_user_gravity(id0.75)  
                
client_print(idprint_chat"600 gravity, a bit less than 800, nothing less?")  
            } 
        }  
        case 
3:  
        {  
    if(
get_pcvar_num(gCvarGravity400)) { 
                
set_user_gravity(id0.5)  
                
client_print(idprint_chat"400, the half of normal!")  
            } 
        }  
        case 
4:  
        {  
    if(
get_pcvar_num(gCvarGravity200)) { 
                
set_user_gravity(id0.25)  
                
client_print(idprint_chat"200, the half of 400, you jump high now"
            } 
        }  
        case 
5:  
        {  
    if(
get_pcvar_num(gCvarGravity100)) { 
                
set_user_gravity(id0.125)  
                
client_print(idprint_chat"100, the less in the whole server!")  
            } 
        }  
        case 
6:  
        {  
    if(
get_pcvar_num(gCvarSG550)) { 
                
client_cmd(id"slot1; drop")  
                
give_itemid"weapon_sg550" 
                
give_itemid"ammo_556nato")  
                
give_itemid"ammo_556nato")  
                
give_itemid"ammo_556nato")  
                
give_itemid"ammo_556nato")  
                
give_itemid"ammo_556nato")  
                
client_print(idprint_chat"Didnt i deleted SG550?!")  
            } 
        }  
        case 
7:  
        {  
    if(
get_pcvar_num(gCvarAWP)) { 
                
client_cmd(id"slot1; drop")  
                
give_itemid"weapon_awp" )  
                
give_itemid"ammo_338magnum" )  
                
give_itemid"ammo_338magnum" )  
                
give_itemid"ammo_338magnum" )  
                
give_itemid"ammo_338magnum" )  
                
give_itemid"ammo_338magnum" )  
                
client_print(idprint_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(idprint_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(0print_chat"Player %d is being respawned"id
     
    
// Try to spawn the player setting the appropiate dead flag and forcing a think 
    
set_pev(idpev_deadflagDEAD_RESPAWNABLE
    
dllfunc(DLLFunc_Thinkid
     
    
// 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(idpev_deadflag) == DEAD_RESPAWNABLE
    { 
        
dllfunc(DLLFunc_Spawnid
    } 

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
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
glorian
BANNED
Join Date: Mar 2009
Location: Surfplace.se
Old 04-10-2009 , 07:11   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #2

Ask Hunter-Digital he know i think.
glorian is offline
Send a message via MSN to glorian
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-10-2009 , 07:12   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #3

Well there are many there dont help in PM And here i get more sides of the case, so i can take the best
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 04-11-2009 , 19:03   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #4

remind tommorow.
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-11-2009 , 19:06   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #5

Thanks
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-11-2009 , 21:32   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #6

Quote:
Originally Posted by TitANious View Post
2. When i disable, exampel AWP in pcvar, then it can still be seen in menu, but you cant take it
Check the cvar when creating the menu and if it's not zero then add the item.

PHP Code:
if(get_pcvar_num(mycvarpointer))
{
    
menu_additem/* .... */)

Don't change any data or the handler.
__________________
fysiks is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-12-2009 , 04:39   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #7

I dont have?
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-12-2009 , 13:13   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #8

Like this?
PHP Code:
    new menu menu_create ("\rMenu for ScoutKnifeZ_Manager!:""handleScoutKnifeZMenu")  
           if(
get_pcvar_num(gCvarGravity600)) { 
    {
    
menu_additem(menu"\wGravity800""1"0)  
   }
  }
       if(
get_pcvar_num(gCvarGravity600)) { 
    {
    
menu_additem(menu"\wGravity600""2"0)  
   }
  }
       if(
get_pcvar_num(gCvarGravity400)) { 
   {
    
menu_additem(menu"\wGravity400""3"0)  
   }
  }
       if(
get_pcvar_num(gCvarGravity200)) { 
    {
    
menu_additem(menu"\wGravity200""4"0)  
   }
  }
       if(
get_pcvar_num(gCvarGravity100)) { 
  {
    
menu_additem(menu"\wGravity100""5"0)  
   }
  }
       if(
get_pcvar_num(gCvarSG550)) { 
    {
    
menu_additem(menu"\wGiveSg550""6"0)  
   }
  }
      if(
get_pcvar_num(gCvarAWP)) { 
   {
    
menu_additem(menu"\wGiveAWP""7"0)  
   }
  }    if(
get_pcvar_num(gCvarG3SG1)) { 
   
    {
    
menu_additem(menu"\wGiveG3sg1""8"0)  
   }
  }
   
menu_display(idmenu0
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-12-2009 , 16:07   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #9

That is what I was saying. But, you have tooooooooo many braces. Also, learn to indent correctly, it hurts my eyes to read that.

And, I didn't realize, at the time, that you had cvar checks in the handler. You can get rid of those because if the options won't be in the menu then you won't ever get to that case anyways.
__________________
fysiks is offline
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-12-2009 , 16:20   Re: My plugin (ScoutKnifezManager) Help pls? :)
Reply With Quote #10

Could this be an example?
PHP Code:
    {
    if(
get_pcvar_num(gCvarGravity800)) { 
    
menu_additem(menu"\wGravity800""1"0)  

__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
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 02:23.


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