Raised This Month: $ Target: $400
 0% 

The Speicialists NPC


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kimler
Junior Member
Join Date: Nov 2006
Old 11-23-2006 , 16:33   The Speicialists NPC
Reply With Quote #1

I done a search on this forum, google, and amx mod sites for this but can only find the odd file which wont compile when I download it, and I dont think the file was even what I was looking for. I tried Suzukas Perfect NPC tutorial which didnt work. I want to add an NPC onto my TSRP server, when you type /jobmenu infront of him a job menu will come up and give you can choose a job. Im not to concerned about the jobmenu at the moment, I just want to know how to add an NPC into my server, at the moment I have only added an NPC on the NPC part of the Economy SQL. If you can help me create a NPC I would be very grateful, if you feel bored and want to explain/supply a jobmenu for me I would be estatic.

Thanks
Kimler is offline
Venny
Member
Join Date: Nov 2006
Old 11-27-2006 , 00:43   Re: The Speicialists NPC
Reply With Quote #2

Heres what I did, I take no credit for this as I just edited it. I added some comments for you.
Code:
#include <amxmodx>
#include <engine>
new val
public plugin_init()
{
register_plugin( "AUTHOR", "1.0", "PLUGIN" );
 
}
public plugin_precache()
{
precache_model( "models/player/JobMenuGuy/JobMenuGuy.mdl" ) // Replace with the location of the model you are using
}
stock create_npc( model[], Float:origin[3], Float:angle = 0.0 )
{
new ent = create_entity("info_target")
 
entity_set_origin(ent,origin)
 
entity_set_string(ent,EV_SZ_classname,"ts_model");
entity_set_model(ent,model);
entity_set_int(ent,EV_INT_solid, 2)
 
entity_set_byte(ent,EV_BYTE_controller1,125);
entity_set_byte(ent,EV_BYTE_controller2,125);
entity_set_byte(ent,EV_BYTE_controller3,125);
entity_set_byte(ent,EV_BYTE_controller4,125);
 
new Float:maxs[3] = {16.0,16.0,30.0}
new Float:mins[3] = {-16.0,-16.0,-30.0}
new Float:angles[3] = { 0.0, 0.0, 0.0 }
angles[1] = angle
entity_set_size(ent,mins,maxs)
entity_set_vector( ent, EV_VEC_angles, angles )
 
entity_set_float(ent,EV_FL_animtime,2.0) 
entity_set_float(ent,EV_FL_framerate,1.0) 
entity_set_int(ent,EV_INT_sequence,1); 
 
return PLUGIN_HANDLED
}
public client_putinserver( id )
{
if( val ) return PLUGIN_HANDLED
val = 1
new calc = get_maxplayers()
 
// Model NPC
new Float:npc_origin[3] = { 336.0, 679.0, -411.0 } // teh location of the NPC
 
//
create_npc( "models/player/JobMenuGuy/JobMenuGuy.mdl", npc_origin, 147.0) // origin = which way he is facing, and before that is the model dir
 
return PLUGIN_HANDLED
}
public set_entity_health(door,Float:hp)
{
if(hp == -1.0) {
entity_set_float(door,EV_FL_max_health,2000.0) // Self explanitory from here on
entity_set_float(door,EV_FL_health,2000.0)
entity_set_float(door,EV_FL_dmg,0.0)
entity_set_float(door,EV_FL_takedamage,0.0)
return 1
}
entity_set_float(door,EV_FL_max_health,hp)
entity_set_float(door,EV_FL_health,hp)
return 1
}
__________________

Venny is offline
Send a message via AIM to Venny Send a message via Skype™ to Venny
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 06:51.


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