Raised This Month: $ Target: $400
 0% 

Drop Gun


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 04-06-2009 , 13:47   Drop Gun
Reply With Quote #1

I want to do that when you get one of the gun ban, and yet another that the weapon would neimanoma from the ground like the code too gung tell ..
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-06-2009 , 13:51   Re: Drop Gun
Reply With Quote #2

What?
Maybe
For Primary
PHP Code:
client_cmd(id"slot1; drop"
For Secundary
PHP Code:
client_cmd(id"slot2; drop"
Its not the best, but i dont understand what you mean
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 04-06-2009 , 13:59   Re: Drop Gun
Reply With Quote #3

and ??
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
TitANious
Veteran Member
Join Date: Feb 2009
Location: Denmark
Old 04-06-2009 , 14:05   Re: Drop Gun
Reply With Quote #4

This is if in my plugin, you drop your gun, if you allready have one
__________________
I dislike this.

"A sneeze never comes alone!" <-- Important to remember.
TitANious is offline
Send a message via MSN to TitANious
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 04-07-2009 , 02:41   Re: Drop Gun
Reply With Quote #5

but for example: How should I save it?
cia no weapon should be the name or something? client_cmd (id, "slot1; drop")
client_cmd (id, "glock18; drop") or similar? P.S i can give me code

Last edited by ~Ice*shOt; 04-07-2009 at 02:44.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 04-07-2009 , 02:44   Re: Drop Gun
Reply With Quote #6

Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fun>
#define MAXCLASSES 5
#define PREFIX "Animal Mod"
enum {
PLAYERLEVEL_1,
PLAYERLEVEL_2,
PLAYERLEVEL_3, // How many Levels
PLAYERLEVEL_4,
PLAYERLEVEL_5,
PLAYERLEVEL_6
}
enum {
CLASS_NONE = 0,
CLASS_COW,
CLASS_HORSE, // Add your Classes there..
CLASS_CAT,
CLASS_DOG
}
new const CLASSES[MAXCLASSES][] = {
    "None",
    "Dog",
    "Cat",
    "Horse",
    "Cow"
};
new const LEVELS[6] = {
    100, 
    200, 
    400, 
    800,
    1600,
    3200
};
new PlayerXP[33], PlayerLevel[33], PlayerClass[33];
new gCvar_Kill, gCvar_Knife, gCvar_HS, gCvar_Enable, g_Vault;
public plugin_init() {
    register_plugin("XP Mod", "1.0", "fxfighter");
    register_event("DeathMsg", "eDeath", "a");
    register_event("ResetHUD", "skill", "be");
    gCvar_Enable    = register_cvar("xp_save", "1");
    gCvar_Kill    = register_cvar("xp_per_kill", "20");
    gCvar_HS    = register_cvar("xp_hs_bonus", "20");
    gCvar_Knife    = register_cvar("xp_Knife_bonus", "20");
    g_Vault        = nvault_open("animod");
    
    register_concmd("amx_take_exp", "cmd_take_exp", ADMIN_KICK, "<target> <amount>"); 
    register_concmd("amx_give_exp", "cmd_give_exp", ADMIN_KICK, "<target> <amount>");
    
    register_clcmd("say /class",    "ChangeClass");
    register_clcmd("say_team /class", "ChangeClass");
    register_clcmd("say /xp",    "ShowHud");
    register_clcmd("say_team /xp",    "ShowHud");
}
public eDeath() {
    new attacker = read_data( 1 );
    new headshot = read_data( 3 );
    new clip, ammo, weapon = get_user_weapon(attacker, clip, ammo);
    PlayerXP[attacker] += get_pcvar_num(gCvar_Kill);
    if(headshot)
        PlayerXP[attacker] += get_pcvar_num(gCvar_HS);
    if(weapon == CSW_KNIFE)
        PlayerXP[attacker] += get_pcvar_num(gCvar_Knife);
    while(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]]) {
        client_print(attacker, print_chat, "[%s] Congratulations! You are a level %i %s!", PREFIX, PlayerLevel[attacker], CLASSES[PlayerClass[attacker]]);
        PlayerLevel[attacker] += 1;
    }
    ShowHud(attacker);
    SaveData(attacker);
}
public ShowHud(id) {
    set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.0);
    show_hudmessage(id, "Level: %i^nXP: %i^nClass: %s", PlayerLevel[id], PlayerXP[id], CLASSES[PlayerClass[id]]);
}
public ChangeClass(id) {
    new menu = menu_create("Class Menu" , "Class_Handle");
    menu_additem(menu ,"Dog", "1" , 0);
    menu_additem(menu ,"Cat", "2" , 0);
    menu_additem(menu ,"Horse", "3" , 0);
    menu_additem(menu ,"Cow", "4" , 0);
    menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
    menu_display(id , menu , 0);
    return PLUGIN_CONTINUE;
}
public Class_Handle(id , menu , item)  {
    if(item == MENU_EXIT) 
        menu_destroy(menu);
    new szCommand[6] , szName[64];
    new access , callback;
    menu_item_getinfo(menu , item , access , szCommand , 5 , szName , 63 , callback);
    new i = str_to_num(szCommand);
    if(PlayerClass[id] != i) {
        PlayerClass[id] = i;
        client_print(id,print_chat,"[%s] You are now a %s", PREFIX, CLASSES[i]);
    } else
        client_print(id,print_chat,"[%s] You are already a %s", PREFIX, CLASSES[i]);
    menu_destroy(menu);
    return PLUGIN_CONTINUE;
}
public client_connect(id)
    if(get_pcvar_num(gCvar_Enable) == 1)
        LoadData(id);
public client_disconnect(id) {
    if(get_pcvar_num(gCvar_Enable) == 1)
        SaveData(id);
    PlayerXP[id]    = 0;
    PlayerLevel[id]    = 0;
    PlayerClass[id]    = 0;
}
public SaveData(id) {
    new AuthID[35];
    get_user_authid(id, AuthID, 34);
    
    new vaultkey[64], vaultdata[256];
    format(vaultkey, 63, "%s-Mod", AuthID);
    format(vaultdata, 255, "%i#%i#", PlayerXP[id], PlayerLevel[id]);
    nvault_set(g_Vault, vaultkey, vaultdata);
    return PLUGIN_CONTINUE;
}
public LoadData(id) {
    new AuthID[35];
    get_user_authid(id,AuthID,34);
    
    new vaultkey[64], vaultdata[256];
    format(vaultkey, 63, "%s-Mod", AuthID);
    format(vaultdata, 255, "%i#%i#", PlayerXP[id], PlayerLevel[id]);
    nvault_get(g_Vault, vaultkey, vaultdata,255);
    replace_all(vaultdata, 255, "#", " ");
    new playerxp[32], playerlevel[32];
    parse(vaultdata, playerxp, 31, playerlevel, 31);
    PlayerXP[id] = str_to_num(playerxp);
    PlayerLevel[id] = str_to_num(playerlevel);
    return PLUGIN_CONTINUE;
}
// Give/Take XP addaon by [X]-RayCat
public cmd_give_exp( id, level,cid ) {
    if( ! cmd_access ( id, level, cid, 3 ) )
        return PLUGIN_HANDLED;
    new target[32], amount[21], reason[21];
    read_argv( 1, target, 31 );
    read_argv(2, amount, 20 );
    read_argv( 3, reason, 20 );
    new player = cmd_target( id, target, 8 );
    if( ! player ) 
        return PLUGIN_HANDLED;
    new admin_name[32], player_name[32];
    get_user_name( id, admin_name, 31 );
    get_user_name( player, player_name, 31 );
    new expnum = str_to_num( amount );
    PlayerXP[player] += expnum;
    switch( get_cvar_num ( "amx_show_activity" ) ) {
        case 1: client_print( 0, print_chat, "ADMIN: gave %i points for %s.", expnum, player_name );
        case 2: client_print( 0, print_chat, "ADMIN %s: gave %i points for %s.", admin_name, expnum, player_name );
    }
    client_print( player, print_chat, "[%s] You received %i points. (Total: %d)", PREFIX, expnum, PlayerXP[player] );
    SaveData( id );
    return PLUGIN_CONTINUE;
}
 
public cmd_take_exp( id, level,cid ) {
    if( ! cmd_access ( id, level, cid, 3 ) )
       return PLUGIN_HANDLED;
    new target[32], amount[21], reason[21];
    read_argv( 1, target, 31 );
    read_argv( 2, amount, 20 );
    read_argv( 3, reason, 20 );
    new player = cmd_target( id, target, 8 );
    if( ! player ) 
       return PLUGIN_HANDLED;
    new admin_name[32], player_name[32];
    get_user_name( id, admin_name, 31 );
    get_user_name( player, player_name, 31 );
    new expnum = str_to_num( amount );
    PlayerXP[player] -= expnum;
    switch(get_cvar_num("amx_show_activity")){
        case 1: client_print( 0, print_chat, "ADMIN: took %i points from %s.", expnum, player_name );
        case 2: client_print( 0, print_chat, "ADMIN %s: took %i points from %s.", admin_name, expnum, player_name );
    }
    client_print( player, print_chat, "[%s] You lost %i points. (Total: %d)", PREFIX, expnum, PlayerXP[player] );
    SaveData( id );
    return PLUGIN_CONTINUE;
}
public skill(id)
{
    if(PlayerLevel[id] == 1) // Checks level.
    {
        give_item(id,"weapon_glock18"); // Give yourself glock18 at level 1
    }
    if(PlayerLevel[id] == 2) // Checks level.
    {
        give_item(id,"weapon_usp"); // Give yourself usp at level 2
    }
    if(PlayerLevel[id] == 3) // Checks level.
    {
        give_item(id,"weapon_p228"); // Give yourself p228 at level 3
    }
    if(PlayerLevel[id] == 4) // Checks level.
    {
        give_item(id,"weapon_fiveseven"); // Give yourself fiveseven at level 4
    }
    if(PlayerLevel[id] == 5) // Checks level.
    {
        give_item(id,"weapon_tmp"); // Give yourself tmp at level 5
    }
    if(PlayerLevel[id] == 6) // Checks level.
    {
        give_item(id,"weapon_mp5"); // Give yourself mp5 at level 6
    }
}
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 04-07-2009 , 03:12   Re: Drop Gun
Reply With Quote #7

Quote:
but for example: How should I save it?
cia no weapon should be the name or something? client_cmd (id, "slot1; drop")
client_cmd (id, "glock18; drop") or similar? P.S i can give me code
PHP Code:
engclient_cmd id"drop""weapon_glock18" // ..will drop glock18.. 
TheRadiance is offline
Send a message via ICQ to TheRadiance
Old 04-07-2009, 03:22
TitANious
This message has been deleted by TitANious.
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-07-2009 , 03:22   Re: Drop Gun
Reply With Quote #9

if(get_player_weapon == CSW_"Weapon name" ( like AWP)

full code :

if("get_player_weapon" == CSW_AWP)
{
client_cmd(id,"slot1,drop")
}
if(same code == CSW_GLOCK1
{
client_cmd(id, "slot2_drop")
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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 02:22.


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