top

Plugin arme ! (tutorial)

 
Creaza un subiect nou   Raspunde la subiect    Pagina de start a forumului football-club.MyForum.ro -> Tutoriale Counter-Strike
Autor Mesaj
GORILA
*Administrator*
*Administrator*
GORILA

Data inscrierii: 19/Mai/2007
Mesaje: 396
Localitate: Barlad

MesajTrimis: 01/05/2008 16:32    Titlul subiectului: Plugin arme ! (tutorial) Raspunde cu citat (quote)

First of all u need to download your custom weapon model(includes C4 and NO CUSTOM HANDS MODEL!!!).Good place where u can find some models is here:FPS Banana

After u downloaded the model unzip it and make a new .sma and rename it to anything u like.
I will use: custom_P90.sma because my tip is this: Image

Open your .sma and write:
Code:
#include <amxmodx>
#include <fakemeta>

to "declare" all of your included .inc files

The write:
Code:
#define V_MODEL "models/v_new_p90.mdl"
#define W_MODEL "models/w_new_p90.mdl"
#define P_MODEL "models/p_new_p90.mdl"

where:
Code:
V_MODEL "models/v_new_p90.mdl"

has in " " the location and name and extension of your v_ model
this is for what the player sees when he is holding the gun

Code:
W_MODEL "models/w_new_p90.mdl"

has in " " the location and name and extension of your w_ model
this is for what the player sees the gun on the ground

Code:
P_MODEL "models/p_new_p90.mdl"

has in " " the location and name and extension of your p_ model
this is for what the player sees when another players hold that gun

Code:
#define P90_W_MODEL "models/w_p90.mdl"
this is the old name for the old model

Code:
public plugin_init()
{
register_plugin("Custom P90","1.0","Hack")

// HL Event CurWeapon
register_event("CurWeapon", "Event_CurWeapon", "be","1=1");

// FM_SetModel Fakemeta forward
register_forward(FM_SetModel,"fw_setmodel"/*,1*/);
}

Declare the plugin and leave unchanged except:
Code:
register_plugin("Custom P90","1.0","Hack")

where u type between brackets the Name,version,author of this plugin

Code:
public plugin_precache()
{
// precache the required models
engfunc(EngFunc_PrecacheModel,V_MODEL);
engfunc(EngFunc_PrecacheModel,P_MODEL);
engfunc(EngFunc_PrecacheModel,W_MODEL);
}

Precache the usefull models for this plugin leave unchanged

Code:
public Event_CurWeapon(id)
{
new weaponID = read_data(2);

if(weaponID != CSW_P90)
return PLUGIN_CONTINUE;

set_pev(id, pev_viewmodel2, V_MODEL);
set_pev(id, pev_weaponmodel2, P_MODEL);

return PLUGIN_CONTINUE;
}

If u only have/want a view model delete the line
Code:
set_pev(id, pev_weaponmodel2, P_MODEL);
and skip the next step!
change this line:
Code:
if(weaponID != CSW_P90)

to
Code:
if(weaponID != CSW_WEAPON_NAME)

the CSW_WEAPON_NAME represents the weapon id and can be found here

Code:
public fw_setmodel(ent,const model[])
{
// if isn't w_p90 model
if(strcmp(P90_W_MODEL,model) )
return FMRES_IGNORED;

// get ent classname
static classname[32]
pev(ent,pev_classname,classname,31);


if(!strcmp(classname, "weaponbox") || !strcmp(classname, "armoury_entity") || !strcmp(classname, "grenade"))
{
// set model
engfunc(EngFunc_SetModel, ent, W_MODEL);
return FMRES_SUPERCEDE;
}

return FMRES_IGNORED;
}

change only the P90_
Code:
if(strcmp(P90_W_MODEL,model) )

with the name that u used here:
Code:
#define P90_W_MODEL "models/w_p90.mdl"
_________________
Plugin arme ! (tutorial) Plugin arme ! (tutorial)


Ultima modificare efectuata GORILA la 20/05/2008 11:39, modificat de 3 ori in total
Sus
Vezi profilul utilizatorului Trimite mesaj privat
GORILA
*Administrator*
*Administrator*
GORILA

Data inscrierii: 19/Mai/2007
Mesaje: 396
Localitate: Barlad

MesajTrimis: 03/05/2008 13:36    Titlul subiectului: Raspunde cu citat (quote)

Am incercat sa fac o arma pt acest tutorial dar nu cred ca mere ... am facut pluginul .

Arma care am incercat sa o fac este aceasta.

Plugin arme ! (tutorial) Plugin arme ! (tutorial)





care vrea pluginul si .mdl atingere at vlad_cristyan.[/img]
Sus
Vezi profilul utilizatorului Trimite mesaj privat
Afiseaza mesajele pentru a le previzualiza:    Subiectul anterior : Subiectul urmator  
Creaza un subiect nou   Raspunde la subiect    Pagina de start a forumului football-club.MyForum.ro -> Tutoriale Counter-Strike Ora este GMT + 3 ore
Pagina 1 din 1

 
Mergi direct la:  
Nu puteti crea un subiect nou in acest forum
Nu puteti raspunde in subiectele acestui forum
Nu puteti modifica mesajele proprii din acest forum
Nu puteti sterge mesajele proprii din acest forum
Nu puteti vota in chestionarele din acest forum

Fa-ti si tu propriul forum GRATUIT, pe www.myforum.ro