Raised This Month: $ Target: $400
 0% 

Spawning Pets via Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 07-20-2014 , 15:30   Re: Spawning Pets via Menu
Reply With Quote #1

Try adding more prints to debug

PHP Code:
public PetMenuHandleridmenuitem )
{
    if ( 
item == MENU_EXIT )
        return 
PLUGIN_HANDLED;
    
    new 
szCommand] , szName64 ];
    new 
access callback;
    
    
menu_item_getinfomenuitemaccessszCommandcharsmaxszCommand ), szNamecharsmaxszName ), callback );
    
    new 
str_to_numszCommand );
    
client_print(idprint_chat"[DEBUG] You chose %s."pet_name[i])
    
    
pet_cmd_handleid);
    
    return 
PLUGIN_HANDLED;

PHP Code:
public pet_cmd_handle(id,num)
{
    if(
pet[id])
    {
        
client_print(idprint_chat"You already have a Pet.")
        
handle_DeathMsg(id)
    }
    
    
client_print(idprint_chat"You do not have a pet.")
    
pet[id] = engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))

    
client_print(idprint_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(idprint_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(idprint_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(idprint_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_Spawnpet[id])
engfunc(EngFunc_SetSizepet[id], Float:{-6.0,-6.0,-6.0}, Float:{6.0,6.0,6.0}) 
__________________
Hey ^_^
NikKOo31 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 21:10.


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