|
Senior Member
Join Date: May 2013
Location: Home
|

07-20-2014
, 15:30
Re: Spawning Pets via Menu
|
#1
|
Try adding more prints to debug
PHP Code:
public PetMenuHandler( id, menu, item )
{
if ( item == MENU_EXIT )
return PLUGIN_HANDLED;
new szCommand[ 6 ] , szName[ 64 ];
new access , callback;
menu_item_getinfo( menu, item, access, szCommand, charsmax( szCommand ), szName, charsmax( szName ), callback );
new i = str_to_num( szCommand );
client_print(id, print_chat, "[DEBUG] You chose %s.", pet_name[i])
pet_cmd_handle( id, i );
return PLUGIN_HANDLED;
}
PHP Code:
public pet_cmd_handle(id,num)
{
if(pet[id])
{
client_print(id, print_chat, "You already have a Pet.")
handle_DeathMsg(id)
}
client_print(id, print_chat, "You do not have a pet.")
pet[id] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
client_print(id, print_chat, "[DEBUG] Your pet id: %d.", pet[id])
set_pev(pet[id],pev_classname,"GHW_Pet")
pettype[id] = num
engfunc(EngFunc_SetModel,pet[id],pet_models[pettype[id]])
new Float:origin[3]
pev(id,pev_origin,origin)
client_print(id, print_chat, "[DEBUG] Your origin: %.1f %.1f %.1f.", origin[0], origin[1], origin[2])
if(is_user_crouching(id))
origin[2] -= pet_minus_z_crouching[pettype[id]]
else
origin[2] -= pet_minus_z_standing[pettype[id]]
set_pev(pet[id],pev_origin,origin)
client_print(id, print_chat, "[DEBUG] Your pet origin: %.1f %.1f %.1f.", origin[0], origin[1], origin[2])
set_pev(pet[id],pev_solid,SOLID_NOT)
set_pev(pet[id],pev_movetype,MOVETYPE_FLY)
set_pev(pet[id],pev_owner,33)
set_pev(pet[id],pev_nextthink,1.0)
set_pev(pet[id],pev_sequence,0)
set_pev(pet[id],pev_gaitsequence,0)
set_pev(pet[id],pev_framerate,1.0)
client_print(id, print_chat, "You should have one now.")
}
Also (I've been told several times that is not necesary, but had to use it many times):
PHP Code:
dllfunc(DLLFunc_Spawn, pet[id])
engfunc(EngFunc_SetSize, pet[id], Float:{-6.0,-6.0,-6.0}, Float:{6.0,6.0,6.0})
__________________
Hey ^_^
|
|