AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   extra Weapon (https://forums.alliedmods.net/showthread.php?t=245401)

Gian_Yagami 08-01-2014 11:27

extra Weapon
 
hello, how are you :)
I am thinking about add weapon without replace. I got native get_weaponname, how does it work? The syntax is written as:
Code:

get_weaponname ( id, weapon[], len )
anyone can explain to me how to use this code?

Eagle07 08-01-2014 11:50

Re: extra Weapon
 
i think , ex :
Quote:

get_weaponname(id,"weapon_deagle",32);

NikKOo31 08-01-2014 12:34

Re: extra Weapon
 
Quote:

Originally Posted by Eagle07 (Post 2177379)
i think , ex :

No

Quote:

Originally Posted by Gian_Yagami (Post 2177354)
hello, how are you :)
I am thinking about add weapon without replace. I got native get_weaponname, how does it work? The syntax is written as:
Code:

get_weaponname ( id, weapon[], len )
anyone can explain to me how to use this code?

PHP Code:

    new id CSW_KNIFE
    
new weaponname[20]
    
get_weaponname(idweaponnamecharsmax(weaponname))
    
    
//output:
    //weaponname[] = "weapon_knife" 


Gian_Yagami 08-01-2014 19:46

Re: extra Weapon
 
I always get problem with native with have index id. Does index id can be added new id?

mottzi 08-01-2014 21:25

Re: extra Weapon
 
What?

HamletEagle 08-02-2014 03:18

Re: extra Weapon
 
In most situations, you need to pass the id param into the function header.

Gian_Yagami 08-02-2014 07:32

Re: extra Weapon
 
Quote:

Originally Posted by HamletEagle (Post 2177714)
In most situations, you need to pass the id param into the function header.

does that difficult?

HamletEagle 08-03-2014 05:48

Re: extra Weapon
 
public something ( id )
{

}

This seems hard ?

Gian_Yagami 08-04-2014 06:48

Re: extra Weapon
 
Quote:

Originally Posted by HamletEagle (Post 2178220)
public something ( id )
{

}

This seems hard ?

Just that?
I am not sure because my friend said weapon can't add more. Just replace it witch variable ID.
ex: I'd like to add nitestick as mele in cs. so, I must replace Knife with nitestick skin and edit weapon value (damage, speed, etc)

DavidJr 08-04-2014 09:49

Re: extra Weapon
 
He's right. What's so hard? I have commented each line

PHP Code:

new gKnife[33]; //declare new variable

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
RegisterHam(Ham_Item_Deploy"weapon_knife""OnCBase_Item_Deploy"); //item deploy native
    
    
register_clcmd("give_knife""ClCmd_Knife"); //register the clcmd to buy the knife
}

public 
plugin_precache()
{
    
precache_model("models/v_knife2.mdl"); //custom knife must be precached
}

public 
ClCmd_Knife(iIndex)
{
    
gKnife[iIndex] = 1//user has knife
}

public 
OnCBase_Item_Deploy(iEnt)
{
    new 
iIndex get_pdata_cbase(iEntm_pPlayerXTRA_OFS_PLAYER);
    
    if (
gKnife[iIndex]) Set_Knife(iIndex); //when player deploys a knife and he has bought the new knife, set the new knife skin
}

Set_Knife(iIndex)
{
    if (!
gKnife[iIndex]) return;
    
    
set_pev(iIndexpev_viewmodel2"models/v_knife2.mdl"); //set the model




All times are GMT -4. The time now is 13:04.

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