Raised This Month: $12 Target: $400
 3% 

Configurando drop


  
 
 
Thread Tools Display Modes
Author Message
ChileScripting
BANNED
Join Date: Jan 2013
Old 04-08-2013 , 20:25   Configurando drop
#1

Estaba intentando customizar el drop de las armas.

Quiero que cuando el index ejecute el comando drop: se bote el arma y que no se desaparezca en el piso.

Cuando se ejecuten alguno de estos stocks el arma desaparezca del piso...

2 Stocks:

Code:
// Drop primary/secondary weapons stock drop_weapons(id, dropwhat) {     // Get user weapons     static weapons[32], num, i, weaponid     num = 0 // reset passed weapons count (bugfix)     get_user_weapons(id, weapons, num)         // Loop through them and drop primaries or secondaries     for (i = 0; i < num; i++)     {         // Prevent re-indexing the array         weaponid = weapons[i]                 if ((dropwhat == 1 && ((1<<weaponid) & PRIMERAS)) || (dropwhat == 2 && ((1<<weaponid) & SEGUNDAS)))         {             // Get weapon entity             static wname[32], weapon_ent             get_weaponname(weaponid, wname, charsmax(wname))             weapon_ent = fm_find_ent_by_owner(-1, wname, id)                         // Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO             set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid))                         // Player drops the weapon and looses his bpammo             engclient_cmd(id, "drop", wname)             cs_set_user_bpammo(id, weaponid, 0)         }     } }

Code:
// Strip user weapons (from fakemeta_util) stock fm_strip_user_weapons(id) {     static ent     ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))     if (!pev_valid(ent)) return;             dllfunc(DLLFunc_Spawn, ent)     dllfunc(DLLFunc_Use, ent, id)     engfunc(EngFunc_RemoveEntity, ent) }

PLUGIN:

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <fakemeta> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "ChileScripting" const PRIMERAS = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90) const SEGUNDAS = (1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE) new REMOVE public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         // Add your code here...     REMOVE = register_cvar("dropped", "0")         register_forward(FM_SetModel, "fw_SetModel")     //register_clcmd("drop", "clclmd_drop") // No necesario } // Forward Set Model public fw_SetModel(entity, const model[]) {     // We don't care     if (strlen(model) < 8)         return;             // Remove weapons?     if(get_pcvar_float(REMOVE) > 0.0)     {         // Get entity's classname         static classname[10]         pev(entity, pev_classname, classname, charsmax(classname))                 // Check if it's a weapon box         if (equal(classname, "weaponbox"))         {             // They get automatically removed when thinking             set_pev(entity, pev_nextthink, get_gametime() + get_pcvar_float(REMOVE))             return;         }     } } stock drop_weapons(id, dropwhat) {     // Get user weapons     static weapons[32], num, i, weaponid     num = 0 // reset passed weapons count (bugfix)     get_user_weapons(id, weapons, num)         // Loop through them and drop primaries or secondaries     for (i = 0; i < num; i++)     {         // Prevent re-indexing the array         weaponid = weapons[i]                 if ((dropwhat == 1 && ((1<<weaponid) & PREMERAS)) || (dropwhat == 2 && ((1<<weaponid) & SEGUNDAS)))         {             // Get weapon entity             static wname[32], weapon_ent             get_weaponname(weaponid, wname, charsmax(wname))             weapon_ent = fm_find_ent_by_owner(-1, wname, id)                         // Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO             set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, cs_get_user_bpammo(id, weaponid))                         // Player drops the weapon and looses his bpammo             engclient_cmd(id, "drop", wname)             cs_set_user_bpammo(id, weaponid, 0)         }     } } // Strip user weapons (from fakemeta_util) stock fm_strip_user_weapons(id) {     static ent     ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip"))     if (!pev_valid(ent)) return;             dllfunc(DLLFunc_Spawn, ent)     dllfunc(DLLFunc_Use, ent, id)     engfunc(EngFunc_RemoveEntity, ent) }

Estube tratando de hacerlo pero por tiempo y ganas tuve que parar.

Se me ocurria darle true a una variable y chequear junto con la cvar en una condificion &&.

Ideas?

Last edited by ChileScripting; 04-10-2013 at 19:32. Reason: fix2
ChileScripting is offline
Fuck_You
Senior Member
Join Date: Dec 2011
Location: return city[id];
Old 04-08-2013 , 21:17   Re: Configurando drop
#2

forward setmodel ahí se checkea y se elimina el model fíjate en el hns de exolent
__________________

Last edited by Fuck_You; 04-08-2013 at 21:18.
Fuck_You is offline
ChileScripting
BANNED
Join Date: Jan 2013
Old 04-08-2013 , 21:32   Re: Configurando drop
#3

Quote:
Originally Posted by Fuck_You View Post
forward setmodel ahí se checkea y se elimina el model fíjate en el hns de exolent
Lee... Analiza... Después comenta, gracias.

edit: quiero dar una propiedad solo cuando se ejecuten algunos de estos stocks y luego chequear si la tiene y proseguir con el code de FM_Setmodel...

Last edited by ChileScripting; 04-08-2013 at 21:33. Reason: fix1
ChileScripting is offline
DJHD!
Veteran Member
Join Date: Dec 2009
Location: Santiago, Chile
Old 04-09-2013 , 00:09   Re: Configurando drop
#4

Tengo una duda quieres que se elimine del suelo las armas solamente cuando el zombie es convertido o en algún otro caso si es que no usas zp pero que no se eliminen cuando eliges alguna opción que te fuerce a botar el arma si no me equivoco o no?
__________________
Quote:
Originally Posted by XINLEI View Post
Porque rocccos trata de ser el metalicross que nunca va a poder ser.
DJHD! is offline
Send a message via MSN to DJHD!
ChileScripting
BANNED
Join Date: Jan 2013
Old 04-09-2013 , 00:30   Re: Configurando drop
#5

Que queden botadas solo cuando se ejecuta el drop del index. Nada mas
ChileScripting is offline
DJHD!
Veteran Member
Join Date: Dec 2009
Location: Santiago, Chile
Old 04-09-2013 , 00:52   Re: Configurando drop
#6

Quote:
Originally Posted by ChileScripting View Post
Que queden botadas solo cuando se ejecuta el drop del index. Nada mas
Exacto eso es lo que te pregunté, Voy a ver que puedo hacer con tu code.
__________________
Quote:
Originally Posted by XINLEI View Post
Porque rocccos trata de ser el metalicross que nunca va a poder ser.
DJHD! is offline
Send a message via MSN to DJHD!
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 04-09-2013 , 09:49   Re: Configurando drop
#7

PHP Code:
// Strip user weapons (from fakemeta_util)
stock fm_strip_user_weapons(id)
{
    static 
ent
    ent 
engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"player_weaponstrip"))
    if (!
pev_valid(ent)) return;
    
    
dllfunc(DLLFunc_Spawnent)
    
dllfunc(DLLFunc_Useentid)
    
engfunc(EngFunc_RemoveEntityent// ya la estás removiendo

Y en el otro stock simplemente es añadir
PHP Code:
engfunc(EngFunc_RemoveEntityweapon_ent

Last edited by baneado; 04-09-2013 at 09:54.
baneado is offline
ChileScripting
BANNED
Join Date: Jan 2013
Old 04-09-2013 , 14:30   Re: Configurando drop
#8

Necesito ayuda .____. eso no me sirve XD
ChileScripting is offline
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 04-09-2013 , 14:37   Re: Configurando drop
#9

no entendi bien, a vos te pasa que el usuario tira el arma y le desaparece, vos queres que suceda solo si se ejecutan alguno de esos stocks?
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 04-10-2013 , 12:14   Re: Configurando drop
#10

Aquí mi idea que ahora la probaré con un mod mío:

1- creas una variable o bool para la entidad new g_ent_drop[256]
2- cuando ejecutes el stock se lo pones en true
3- en el fw_setmodel sería así
PHP Code:
// Check if it's a weapon box
if (equal(classname"weaponbox") && g_ent_drop[entity])
{
     
// They get automatically removed when thinking
     
set_pev(entitypev_nextthinkget_gametime() + 0.01)
     
g_ent_drop[entity] = false


Last edited by baneado; 04-10-2013 at 12:18.
baneado is offline
 



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 17:06.


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