AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Zombie Mod - Weapon Remove (https://forums.alliedmods.net/showthread.php?t=55206)

Ithron 05-16-2007 10:02

Zombie Mod - Weapon Remove
 
Hi..

i work on a zombie mod plugin by hawk552... now i want to remove the weapons of a zombie... like strip_user_weapons()..

but this bad, because in the next round you can't pick up weapons or use any weapons..


so i have asked in the german forum for help.. i became this hint:

Quote:

Originally Posted by mogel (Post 476554)
Code:

#define MAXWEAPONS 31
new weapon[MAXWEAPONS][] = {
    "",
    "p228",
    "",
    "scout",
    "hegrenade",
    "xm1014",
    "c4",
    "mac10",
    "aug",
    "smokegrenade",
    "elite",
    "fiveseven",
    "ump45",
    "sg550",
    "galil",
    "famas",
    "usp",
    "glock18",
    "awp",
    "mp5navy",
    "m249",
    "m3",
    "m4a1",
    "tmp",
    "g3sg1",
    "flashbang",
    "deagle",
    "sg552",
    "ak47",
    "knife",
    "p90"
}

public DropWeapon(player, weaponid) {
    new weaponname[20]
    format(weaponname, 19, "weapon_%s", weapon[weaponid])
    fm_strip_user_gun(player, weaponid, weaponname) // fakemeta_util.inc
}

public StripAllWeapons(player) {
    for(new i = 1; i < MAXWEAPONS; i++)
    {
        if ((i == CSW_C4) || (i == CSW_KNIFE)) continue
        if (user_has_weapon(player, i)) DropWeapon(player, i)
    }
}

public GiveWeapon(player, weaponid) {
    new weaponname[20]
    format(weaponname, 19, "weapon_%s", weapon[weaponid])
    give_item(player, weaponname)
    //cs_set_user_bpammo(player, weaponid, maxammo[weaponid] + spieler[player][PLY_DOUBLEAMMO] * maxammo[weaponid])
}

don't forget
Code:

#include "include/fakemeta_util.inc"


this doesn't work.. if i start a the game and the round start the game shut down without any errors... no logfiles or anythink...


here you can see the code:
www.ithron.srv4.hostingwerk.de/zombie_strike.sma


can you help me, pls? =)

cYa..


[€dit]
i already have downloaded the fakemeta_util.inc
that's not the problem...

mogel 05-16-2007 10:37

Re: Zombie Mod - Weapon Remove
 
Moin,

Quote:

but this bad, because in the next round you can't pick up weapons or use any weapons
Code:

public plugin_init() {
    register_touch("weaponbox", "player", "PlayerPickup")
}
public PlayerPickup(entity, player) {
    if (is_user_zombie(player) || (roundstatus != RS_RUNNING))
    {
        new modelname[33]
        entity_get_string(entity, EV_SZ_model, modelname, 32)
        if (!equal(modelname, "models/w_backpack.mdl")) return PLUGIN_HANDLED
    }
   
    return PLUGIN_CONTINUE;
}

hand, mogel

Ithron 05-16-2007 10:53

Re: Zombie Mod - Weapon Remove
 
hmm.. danke schonmal (zum zweiten mal ;) )

aber was soll ich für roundstatus einsetzen? wie les aus ob die runde noch an ist oder nicht?

und brauch ich noch den teil, den du oben gepostet hast? oder ist das was unabhängiges?
dort werden ja keine waffen gedropt...

mogel 05-16-2007 11:06

Re: Zombie Mod - Weapon Remove
 
Moin,

Quote:

Originally Posted by Ithron (Post 477277)
hmm.. danke schonmal (zum zweiten mal ;) ) ... [...]

please in english in this forum-part :wink:

u can full block the pickup for every player with

Code:

public PlayerPickup(entity, player) {
    return PLUGIN_HANDLED
}

my posted function is only a way ... this will not correct work on your plugin ... my function will block to pickup the weapons for zombies every time and block the pickup for the humans after round end

i use roundstatus to detect if the round is running or not (i mean between roundstart-event and roundend-event) ... this var will set on the corresponding event's

the is_user_zombie() function checks if a player on the zombie-side ... this side will change on every new map on my server

hand, mogel

Silencer123 05-16-2007 11:08

Re: Zombie Mod - Weapon Remove
 
German:
Hi, les dir einfach mal hier den neusten Kommentar durch:
http://www.amxmodx.org/funcwiki.php?...vent&go=search
Ich denke, du bist inder Lage, dass mit einer globalen Variable auszunutzen.
;)

English:
Hello, just read through the newest comment from here:
http://www.amxmodx.org/funcwiki.php?...vent&go=search
I think you are smart enough to make use of this with a global variable.
;)

mogel 05-16-2007 11:17

Re: Zombie Mod - Weapon Remove
 
Hi,

Quote:

Originally Posted by Silencer123 (Post 477284)

:mrgreen: ... don't think - just copy ... to simple :lol:

hand, mogel

Ithron 05-16-2007 11:34

Re: Zombie Mod - Weapon Remove
 
hmm.. i see^^

also i have to replace "roundstatus != RS_RUNNING" with "g_bRoundEnded == true "

because my roundstatus event is:
g_bRoundEnded


but i have to replace PlayerPickup(entity, player) etc.. with PlayerPickup(entity, id).. or? i have only worked with id ^^


and what's with the ct... the ct's aren't allowed to pickup weapons, too... or? and what's with buying? will this event forbid buying for zombies (or humans)?
how i can set this event only for zombies.. i think it's now set for all players.. register_touch("weaponbox", "player", "PlayerPickup")
will it work if i copy this line to the zombie block?
oh.. and what's "weaponbox"? it's not defined.. or?

o.O... i have to learn amxx coding xD
k.. i'll do it^^


cYa =)

mogel 05-16-2007 13:52

Re: Zombie Mod - Weapon Remove
 
Hi,

Quote:

Originally Posted by Ithron (Post 477305)
but i have to replace PlayerPickup(entity, player) etc.. with PlayerPickup(entity, id).. or? i have only worked with id ^^

that's simply a var-name ... u can name it as StupidVarWithAVeryVeryLongName

Quote:

and what's with the ct... the ct's aren't allowed to pickup weapons, too... or? and what's with buying? will this event forbid buying for zombies (or humans)?
this will not block the buy from weapons ... this will block the pickup of weapons

Quote:

how i can set this event only for zombies..
check the player-side (cs_get_user_team) in this event and then block or don't block the weapon pickup

Quote:

will it work if i copy this line to the zombie block?
try it

hand, mogel

Ithron 05-16-2007 14:49

Re: Zombie Mod - Weapon Remove
 
hi...

i'm a newb... >.<

Code:

switch(g_iZombie[id])
        {
                case TRANSFORMING :
                {
                        PlayerPickup(entity, id)
                        entity_set_string(id, EV_SZ_viewmodel, "")
                        entity_set_string(id, EV_SZ_weaponmodel, "")
                       
                        set_user_maxspeed(id,get_pcvar_float(g_pSpeed / 2) )
                }
                case ZOMBIE :
                {
                        PlayerPickup(entity, id)
                        entity_set_string(id, EV_SZ_viewmodel, "")
                        entity_set_string(id, EV_SZ_weaponmodel, "")
                        give_item(id,"CSW_KNIFE")
                       
                        set_user_maxspeed(id,get_pcvar_float(g_pSpeed))
                }
                case HUMAN:
                {
                        new iClip,iAmmo,iWeap = get_user_weapon(id,iClip,iAmmo)
                        if(iWeap == CSW_C4)
                                //DropWeapon(id, CSW_C4)
                                client_cmd(id,"drop")
                }
        }

then i get this error:
Error: Undefined symbol "entity"

i have no idea what i have to do... define entity.. ok.. but what's that? :D

and how i can forbid buying for people? exist a plugin for this? i'll search...^^

thank you for your patience ;-)

cYa...

mogel 05-16-2007 18:21

Re: Zombie Mod - Weapon Remove
 
Omg,

you have problems with event based programming ... you dont need to call this function ... the system (amxx) call this function, if a player run over the weapon

hand, mogel


All times are GMT -4. The time now is 10:42.

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