Raised This Month: $ Target: $400
 0% 

Alter this plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FuZ!on
Senior Member
Join Date: Aug 2007
Old 02-10-2008 , 14:15   Alter this plugin
Reply With Quote #1

Can anybody help me make this so that it strips your weapons on spawn everytime and gives the weapons that are specified in the cvar.

Not just the starting weapons, I want you to never spawn with a glock/usp and if you survive the round, when you spawn, the weapons are stripped and given again.

http://forums.alliedmods.net/showthr...arting+weapons

That is the link.

Thanks.
FuZ!on is offline
oRNY
Member
Join Date: Feb 2008
Location: Israel
Old 02-10-2008 , 14:22   Re: Alter this plugin
Reply With Quote #2

Quote:
Note that placing "strip" somewhere among the items will first make a player be stripped off of ALL his weapons. If you don't add "strip"
they will still have knife and glock/usp beside the other stuff you add.
oRNY is offline
FuZ!on
Senior Member
Join Date: Aug 2007
Old 02-10-2008 , 14:34   Re: Alter this plugin
Reply With Quote #3

I know this but, it doesn't give the weapon on each spawn, if you don't die and then you spawn, you don't get a new gun which in some cases, if you don't die for several rounds, you will run out of ammo.
FuZ!on is offline
oRNY
Member
Join Date: Feb 2008
Location: Israel
Old 02-10-2008 , 14:54   Re: Alter this plugin
Reply With Quote #4

Here you go:
PHP Code:
#define PLUGINNAME    "Starting weapon"
#define VERSION        "0.2"
#define AUTHOR        "JGHG"
/*
Copyleft 2005
Plugin topic: http://www.amxmodx.org/forums/viewtopic.php?p=95649


STARTING WEAPONS
================
REQUIRED MODULES: CSTRIKE, FUN, ENGINE

Two cvars: startingweapons_t and startingweapons_ct.
Define them like this:
startingweapons_t "weapon_famas ammo556nato weapon_knife"
startingweapons_ct "strip weapon_scout ammo_762nato"

...or any other way you like. Just make sure to use quotes around the stuff and delimit each item with a space. Consult the following list
for valid names, and what ammo goes with what gun. If you set the cvars empty, players won't even have a knife.
Note that placing "strip" somewhere among the items will first make a player be stripped off of ALL his weapons. If you don't add "strip"
they will still have knife and glock/usp beside the other stuff you add.

Besides weapons you can also give items like the shield, c4, nvg, etc.

Default stuff for both teams is: "strip weapon_knife weapon_elite ammo_9mm"

    "weapon_p228",            ammo_357sig
    "weapon_shield",
    "weapon_scout",            ammo_762nato
    "weapon_hegrenade",
    "weapon_xm1014",        ammo_buckshot
    "weapon_c4",
    "weapon_mac10",            ammo_45acp
    "weapon_aug",            ammo_556nato
    "weapon_smokegrenade",
    "weapon_elite",            ammo_9mm
    "weapon_fiveseven"        ammo_57mm
    "weapon_ump45",            ammo_45acp
    "weapon_sg550",            ammo_556nato
    "weapon_galil",            ammo_556nato
    "weapon_famas",            ammo_556nato
    "weapon_usp",            ammo_45acp
    "weapon_glock18",        ammo_9mm
    "weapon_awp",            ammo_338magnum
    "weapon_mp5navy",        ammo_9mm
    "weapon_m249",            ammo_556natobox
    "weapon_m3",            ammo_buckshot
    "weapon_m4a1",            ammo_556nato
    "weapon_tmp",            ammo_9mm
    "weapon_g3sg1",            ammo_762nato
    "weapon_flashbang",
    "weapon_deagle",        ammo_50ae
    "weapon_sg552",            ammo_556nato
    "weapon_ak47",            ammo_762nato
    "weapon_knife",            // the butterknife
    "weapon_p90",            ammo_57mm
    "item_kevlar",            // armor w/out helmet
    "item_assaultsuit",        // armor w/ helmet
    "item_thighpack"        // defuse kit
    "item_nvg"                // night-vision goggles

/JGHG

VERSIONS
========
050226    0.2    Fixed stuff :-) Stripping was probably not working. Now you can also give multiple grenades.
050226    0.1    First version
*/

#include <amxmodx>
#include <fun>
#include <engine>
#include <cstrike>

#define TEAM_T            1
#define TEAM_CT            2
#define CVAR_DEFAULT_T    "startingweapons_t"
#define CVAR_DEFAULT_CT    "startingweapons_ct"


public plugin_modules() {
    
require_module("fun")
    
require_module("engine")
    
require_module("cstrike")
}



public 
event_spawn(id) {
    if (!
is_user_alive(id))
        return 
PLUGIN_CONTINUE


    
new team get_user_team(id)
    if (
team != TEAM_T && team != TEAM_CT)
        return 
PLUGIN_CONTINUE

    
new params[2]
    
params[0] = id

    
switch (team) {
        case 
TEAM_Tparams[1] = true
        
case TEAM_CTparams[1] = false
    
}
    
set_task(0.1"givedefault"0params2)

    return 
PLUGIN_CONTINUE
}

public 
givedefault(params[2]) {
    new 
id params[0]
    new 
terrorist params[1]
    new 
bool:hasBomb false


    
new stuff[256]
    
get_cvar_string(terrorist CVAR_DEFAULT_T CVAR_DEFAULT_CTstuff255)

    if (
containi(stuff"strip") != -1) {
        if (
terrorist) {
            new 
c4 0
            
while ((c4 find_ent_by_class(c4"weapon_c4"))) {
                if (
entity_get_edict(c4EV_ENT_owner) == id) {
                    
hasBomb true
                    
break
                }
            }
        }

        
strip_user_weapons(id)
        if (
hasBomb) {
            
give_item(id"weapon_c4")
            
cs_set_user_plant(id)
        }
        
replace(stuff255"strip""")
    }
    
// startingweapons_t "strip weapon_c4 weapon_c4 weapon_flashbang weapon_flashbang weapon_flashbang weapon_hegrenade weapon_hegrenade weapon_smokegrenade weapon_smokegrenade"
    
new parsedParamsarg[256], flashies 0hes 0smokies 0c4s hasBomb 0
    
do {
        
parsedParams parse(stuffarg255)
        if (
parsedParams == 1) {
            
replace(stuff255arg"")
            if (
containi(arg"item_thighpack") != -1)
                
cs_set_user_defuse(id)
            else if (
containi(arg"item_nvg") != -1)
                
cs_set_user_nvg(id)
            else if (
containi(arg"weapon_c4") != -1) {
                
cs_set_user_plant(id)
                if (
hasBomb)
                    
hasBomb false
                
else if (++c4s == 1)
                    
give_item(id"weapon_c4")
                else
                    
cs_set_user_bpammo(idCSW_C4c4s)
            }
            else if (
containi(arg"weapon_hegrenade") != -1) {
                if (++
hes == 1)
                    
give_item(id"weapon_hegrenade")
                else
                    
cs_set_user_bpammo(idCSW_HEGRENADEhes)
            }
            else if (
containi(arg"weapon_flashbang") != -1) {
                if (++
flashies == 1)
                    
give_item(id"weapon_flashbang")
                else
                    
cs_set_user_bpammo(idCSW_FLASHBANGflashies)
            }
            else if (
containi(arg"weapon_smokegrenade") != -1) {
                if (++
smokies == 1)
                    
give_item(id"weapon_smokegrenade")
                else
                    
cs_set_user_bpammo(idCSW_SMOKEGRENADEsmokies)
            }
            else
                
give_item(idarg)
        }
        else
            return
    } while (
parsedParams == 1)
}

public 
plugin_init() {
    
register_plugin(PLUGINNAMEVERSIONAUTHOR)

    
register_cvar(CVAR_DEFAULT_T"strip weapon_knife weapon_elite ammo_9mm")
    
register_cvar(CVAR_DEFAULT_CT"strip weapon_knife weapon_elite ammo_9mm")

    
register_event("ResetHUD""event_spawn""b")
    
register_event("DeathMsg""event_death""a")
    
register_event("TextMsg""event_restart""a""2&#Game_C""2&#Game_w")
    
register_event("TextMsg""event_restart""a""2&#Game_will_restart_in")

oRNY is offline
FuZ!on
Senior Member
Join Date: Aug 2007
Old 02-10-2008 , 15:18   Re: Alter this plugin
Reply With Quote #5

Doesn't work. When you survive the round, you don't get a new set or weapons. You still have the same weapons with the same ammo. I want the player to spawn with a fresh set of weapons every round. So their ammo doesn't run out.
FuZ!on is offline
oRNY
Member
Join Date: Feb 2008
Location: Israel
Old 02-10-2008 , 15:27   Re: Alter this plugin
Reply With Quote #6

Maybe you are running the wrong code.
oRNY is offline
FuZ!on
Senior Member
Join Date: Aug 2007
Old 02-10-2008 , 19:57   Re: Alter this plugin
Reply With Quote #7

Nevermind, it works now. Thanks for your help.
FuZ!on 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 23:40.


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