AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   dont spawn c4 (https://forums.alliedmods.net/showthread.php?t=47898)

G u i l l e 11-29-2006 12:58

dont spawn c4
 
how can i made a plugin that block the c4, and dont allow spawn the c4


tnkz

dutchmeat 11-29-2006 13:00

Re: dont spawn c4
 
i think there's a flag, something like 'has_c4'.
find the flag, and do a remove function on the c4

Zenith77 11-29-2006 13:45

Re: dont spawn c4
 
Here is a code snippet (meaning it may not work or even compile, it's just a rough draft what you could possible do). Model name might not be right

Code:
public plugin_init() {     register_forward(FM_Spawn, "Forward_Spawn"); } public Forward_Spawn(ent) {     if (!pev_valid(ent))         return FMRES_IGNORED;     static classname[32];     static model[32];     classname[0]    = '^0';     model[0]    = '^0';     pev(ent, pev_classname, classname, 31);     pev(ent, pev_model, model, 31);         if (equal(classname, "grenade") && equal(model, "c4.mdl"))         return FMRES_SUPERCEDE;     return FMRES_IGNORED; }

dutchmeat 11-29-2006 14:05

Re: dont spawn c4
 
you could try this:

Code:


public server_frame(){
new g_iBomb = find_ent_by_class(-1,"weapon_c4");
if(g_iBomb){
remove_entity(g_iBomb);
}
}


The Specialist 11-29-2006 14:26

Re: dont spawn c4
 
dutch meets way would be the best. i would go look at the tutorial by VEN "Bomb Scripting faq " .

Orangutanz 11-29-2006 14:31

Re: dont spawn c4
 
Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN "Bomb Removal" #define VERSION "0.1" #define AUTHOR "Orangutanz" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_forward(FM_SetModel, "SetModel") } public SetModel(entity, const model[]) {     if(equal(model, "models/w_c4.mdl"))     {         engfunc(EngFunc_RemoveEntity, entity)         return FMRES_SUPERCEDE     }     return FMRES_IGNORED }

The Specialist 11-29-2006 14:57

Re: dont spawn c4
 
TOPIC HIJACK !!!! what is FM_set_model ? I know its a forward but whne is it called ? :|

Orangutanz 11-29-2006 14:59

Re: dont spawn c4
 
When a model is set, hence its name :mrgreen:

The Specialist 11-29-2006 15:05

Re: dont spawn c4
 
oh nice. ill have to use that some time thanks lol:up: ++karma

VEN 11-30-2006 10:06

Re: dont spawn c4
 
Quote:

how can i made a plugin that block the c4, and dont allow spawn the c4
Code:
#include <amxmodx> #include <fakemeta> new const g_weapon_c4[] = "weapon_c4" public plugin_init() {     register_plugin("Block weapon_c4", "0.1", "VEN")     register_forward(FM_CreateNamedEntity, "fwCreateNamedEntity") } public fwCreateNamedEntity(iClassname) {     static szClassname[sizeof g_weapon_c4 + 1]     engfunc(EngFunc_SzFromIndex, iClassname, szClassname, sizeof g_weapon_c4)     if (equal(szClassname, g_weapon_c4))         return FMRES_SUPERCEDE     return FMRES_IGNORED }
Note: this will block only the "weapon_c4" entity creation.
This will not block:
- bomb StatusIcon
- hud text "You have the bomb..."
- bomb backpack model on the player's back
- log message "... spawned with the bomb"
If you want to block all of that you can look in my CTF mod source code: http://forums.alliedmods.net/attachm...9&d=1162322381


Quote:

i think there's a flag, something like 'has_c4'
This will not help - the flag removal will not remove the actual c4 entity.


Quote:

Here is a code snippet
This will not work - Spawn is actually called only on map's entities load (at map start).


Quote:

you could try this
You should avoid StartFrame if possible to not hit the performance.


Quote:

Code:

if(equal(model, "models/w_c4.mdl"))
        engfunc(EngFunc_RemoveEntity, entity)


I don't think he meant the planted C4.


All times are GMT -4. The time now is 06:57.

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