Raised This Month: $ Target: $400
 0% 

little problem item zp


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-17-2022 , 13:04   Re: little problem item zp
Reply With Quote #4

Try this:
PHP Code:
public zp_extra_item_selected(playeritemid)
{    
    if(
itemid == item_id)
    {
        return 
create_pet(player)        
    }
}


create_pet(id// Remove public
{
    if(
item_have[id])
    {
        
client_print(id,print_chat,"%L",LANG_PLAYER,"ALREADY_HAVE_BAT")
        return 
ZP_PLUGIN_HANDLED;
    }
    else if(!
is_user_alive(id))
    {
        
client_print(id,print_chat,"%L",LANG_PLAYER,"BAT_ON_NEXT_SPAWN")
        
item_at_spawn[id] = 1
        
return ZP_PLUGIN_HANDLED
    
}    
    else
    {
        
item_pet[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"))
        
set_pev(item_pet[id],pev_classname,"zp_bat")
        
        
engfunc(EngFunc_SetModel,item_pet[id],pet_model)
        
        new 
Float:origin[3]
        
pev(id,pev_origin,origin)            
        
        
set_pev(item_pet[id],pev_origin,origin)
        
set_pev(item_pet[id],pev_solid,SOLID_TRIGGER)
        
set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY)
        
set_pev(item_pet[id],pev_owner,33)
        
set_pev(item_pet[id],pev_nextthink,1.0)
        
set_pev(item_pet[id],pev_sequence,0)
        
set_pev(item_pet[id],pev_gaitsequence,0)
        
set_pev(item_pet[id],pev_framerate,1.0)
        
        
fm_set_user_gravity(id,player_gravity)        
        
        
engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds 1)],1.01.20PITCH_NORM)    
        
        
client_print(id,print_chat,"%L",LANG_PLAYER,"GIVE_BAT")        
        
        
item_have[id] = 1
    
}
    return 
PLUGIN_HANDLED

Or
PHP Code:
public zp_extra_item_selected(iditemid)
{    
    if(
itemid == item_id)
    {
        if(
item_have[id])
        {
            
client_print(id,print_chat,"%L",LANG_PLAYER,"ALREADY_HAVE_BAT")
            return 
ZP_PLUGIN_HANDLED;
        }
        else if(!
is_user_alive(id))
        {
            
client_print(id,print_chat,"%L",LANG_PLAYER,"BAT_ON_NEXT_SPAWN")
            
item_at_spawn[id] = 1
            
return ZP_PLUGIN_HANDLED
        
}    
        else
        {
            
item_pet[id] = engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString,"info_target"))
            
set_pev(item_pet[id],pev_classname,"zp_bat")
            
            
engfunc(EngFunc_SetModel,item_pet[id],pet_model)
            
            new 
Float:origin[3]
            
pev(id,pev_origin,origin)            
            
            
set_pev(item_pet[id],pev_origin,origin)
            
set_pev(item_pet[id],pev_solid,SOLID_TRIGGER)
            
set_pev(item_pet[id],pev_movetype,MOVETYPE_FLY)
            
set_pev(item_pet[id],pev_owner,33)
            
set_pev(item_pet[id],pev_nextthink,1.0)
            
set_pev(item_pet[id],pev_sequence,0)
            
set_pev(item_pet[id],pev_gaitsequence,0)
            
set_pev(item_pet[id],pev_framerate,1.0)
            
            
fm_set_user_gravity(id,player_gravity)        
            
            
engfunc(EngFunc_EmitSound,item_pet[id],CHAN_AUTO,pet_sounds[random_num(0,sizeof pet_sounds 1)],1.01.20PITCH_NORM)    
            
            
client_print(id,print_chat,"%L",LANG_PLAYER,"GIVE_BAT")        
            
            
item_have[id] = 1
        
}    
    }
    return 
PLUGIN_HANDLED    

__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline
 



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:22.


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