Raised This Month: $ Target: $400
 0% 

Custom Weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 03-21-2017 , 20:56   Re: Custom Weapon
Reply With Quote #1

Quote:
Originally Posted by Depresie View Post
use a bool to tell who has the weapon ( to who these changes should apply )
Storing it for player is a bad way, better store it inside weapon entity.
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
PartialCloning
Senior Member
Join Date: Dec 2015
Old 03-21-2017 , 21:42   Re: Custom Weapon
Reply With Quote #2

Quote:
Originally Posted by PRoSToTeM@ View Post
Storing it for player is a bad way, better store it inside weapon entity.
Are weapon entities destroyed at any point other than being killed? When you pickup a weapon is the weapon inside the weaponbox destroyed and a new one created or is it the same entity but set to follow you? Likewise when you drop a weapon or at any point after the creation of the weapon entity.
PartialCloning is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 03-21-2017 , 22:34   Re: Custom Weapon
Reply With Quote #3

Quote:
Originally Posted by PRoSToTeM@ View Post
Storing it for player is a bad way, better store it inside weapon entity.
That doesn't look like a bad idea, but still, pev_iuser fields aren't that many, tho i don't think it should be called "a bad way" using a simple Array =/

Btw, pev_iuser fields are cleared when the entity is deleted right ?

@PartialCloning

From what i remember, if i am not mistaken, the weaponbox entity (1) is holding an entity inside (2) but the player recieves a new entity (3) - the weapon... and entity (1 and 2 are getting removed )

Or the weaponbox entity (1) when picked is removed and creates another entity (2) - the weapon

Either way, the weaponbox entity is not the same with the weapon entity the player recieves...
__________________

Last edited by Depresie; 03-21-2017 at 22:40.
Depresie is offline
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 03-22-2017 , 16:12   Re: Custom Weapon
Reply With Quote #4

Quote:
Originally Posted by Depresie View Post
Either way, the weaponbox entity is not the same with the weapon entity the player recieves...
The weapon entity stored in the weaponbox entity is the same with the weapon entity the player receives (or drops).
Quote:
Originally Posted by Depresie View Post
That doesn't look like a bad idea, but still, pev_iuser fields aren't that many, tho i don't think it should be called "a bad way" using a simple Array =/
You can also use array for weapon entity or use Klippy's module https://forums.alliedmods.net/showthread.php?t=294188. The main idea is to associate it with weapon entity, not with player.
__________________

Last edited by PRoSToTeM@; 03-22-2017 at 16:22.
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-22-2017 , 13:27   Re: Custom Weapon
Reply With Quote #5

BTW i know the replacing method, i just thought i can add a custom weapon since i read the csx include file and found these natives and forwards in the csx include file >>

PHP Code:
*
 * 
Forwards
 
*/

/* Function is called after player to player attacks ,
* if players were damaged by teammate TA is set to 1 */
forward client_damage(attacker,victim,damage,wpnindex,hitplace,TA);

/* Function is called after player death ,
* if player was killed by teammate TK is set to 1 */
forward client_death(killer,victim,wpnindex,hitplace,TK);

/************* Shared Natives Start ********************************/

/* Custom Weapon Support */
/* function will return index of new weapon */
native custom_weapon_add( const wpnname[],melee 0,const logname[]="" ); 
/* Function will pass damage done by this custom weapon to stats module and other plugins */
native custom_weapon_dmgweaponattvicdamagehitplace=); 
/* Function will pass info about custom weapon shot to stats module */
native custom_weapon_shotweapon,index ); // weapon id , player id

/* function will return 1 if true */
native xmod_is_melee_wpn(wpnindex);

/* Returns weapon name. */
native xmod_get_wpnname(wpnindex,name[],len);

/* Returns weapon logname. */
native xmod_get_wpnlogname(wpnindex,name[],len);

/* Returns weapons array size */
native xmod_get_maxweapons();

/* Returns stats array size */
native xmod_get_stats_size();

/************* Shared Natives End ********************************/ 
but like i failed giving the weapon and so on the models of the weapon....

ithink i can make the weapon model using the ham pdata & FM_SetMOdel forward... and hook drop and create the wpn..
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-22-2017 at 13:30.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Depresie
Veteran Member
Join Date: Nov 2013
Old 03-22-2017 , 15:37   Re: Custom Weapon
Reply With Quote #6

Nvm, i should pay more attention while reading..

Idk about those natives, but since no one is using them, there must be a reason
__________________

Last edited by Depresie; 03-22-2017 at 15:43.
Depresie 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 17:59.


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