Raised This Month: $73 Target: $400
 18% 

[TF2]GivePlayerItem , EquipPlayerWeapon are error.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
koscar12
Member
Join Date: Jan 2014
Old 01-27-2014 , 06:42   [TF2]GivePlayerItem , EquipPlayerWeapon are error.
Reply With Quote #1

Code:
public Action:player_spawn(
    Handle:event, const 
String:name[],  bool:dontBroadcast)
{
    new client = 
 GetClientOfUserId(GetEventInt(event, "userid"));
    new 
HTeam:team =  HTeam:GetEventInt(event, "team");

 


 
#if DEBUG_LOGGING
    PrintToServer("[%s] @player_spawn 
client:%N  team:%d",
        PLUGIN_NAME, 
client, team);
#endif

 


 
    if (client != 0)
    
{
        if (team == 
HTeam_Iris)
        
{
            if 
(client == 
hidden)
            
{
                
ChangeClientTeam(client, 
_:HTeam_Hidden);
            
}
        
}
        else if (team == 
HTeam_Hidden)
        
{
            if 
 (client != 
hidden)
            
{
                
ChangeClientTeam(client, 
 _:HTeam_Iris);
            
}
        
}
        else if (client && 
IsFakeClient(client))
        
{
            
ChangeClientTeam(client, 
_:HTeam_Spectator);
        
}
        

else
        
{
            
ChangeClientTeam(client, 
 _:HTeam_Iris);
        }

 


 
    }
    else if (client != 
0)
    {
        
current_pool[client] =  0;
        
RemoveHiddenVision(client); 
        
ChangeClientTeam(client,  _:HTeam_Spectator);
    }

 


 
    if (client == hidden)
    
{
        game_defined_hidden_max_health 
 = 
HIDDEN_MAX_HEALTH
            
+ ((Client_GetCount(true, true) - 1) * 
 HIDDEN_HP_PER_PLAYER);
        hidden_hp 
=  game_defined_hidden_max_health;
        
heal_per_second = 0;
        
amount_yet_to_heal = 0;
        
hidden_boo_charge = 100.0;

 


 
        hidden_stamina = 
HIDDEN_STAMINA_TIME;
        hidden_stuck 
=  false;
        hidden_jump = 0.0;

 


 
        display_hidden_hud_tip = true;

 


 
        TF2_RemoveWeaponSlot(client, 0); 
// Revolver
        
TF2_RemoveWeaponSlot(client, 2); // 
Knife
        TF2_RemoveWeaponSlot(client, 
3); // Disguise Kit
        
TF2_RemoveWeaponSlot(client, 4); // Invisibility 
 Watch
                                            

        new  knife=GivePlayerItem(client, 
"tf_weapon_knife");
        
SetEntProp(knife,  Prop_Send, "m_iItemDefinitionIndex", 
4);
        new level = GetRandomInt(1, 
 100);
        SetEntProp(knife, 
Prop_Send, "m_iEntityLevel", 
 level);
        SetEntProp(knife, 
Prop_Send, "m_iEntityQuality", 
 10);
        SetEntProp(knife, Prop_Send, 
"m_bInitialized", 1);
        
 EquipPlayerWeapon(client, knife);
        
Client_SetHideHud(client, 
 HIDEHUD_HEALTH);
        
GiveHiddenVision(client);
    }
    
else
    {
        if 
(TF2_GetPlayerClass(client) == 
 TFClass_Spy)
        
{
            
TF2_SetPlayerClass(client,  TFClass_Soldier, false, 
true);
            
Client_PrintToChat(client, true,  "{G}[%s] {N}You 
\
                    
cannot play {B}Spy {N}on the {R}Red  {N}team 
\
                    
in this game mode.", 
 PLUGIN_NAME);
            
TF2_RespawnPlayer(client);
        
}
        if 
(((TF2_GetPlayerClass(client)) == 
TFClass_Pyro)
            
&& 
(!GetConVarBool(cv_allow_pyro)))
        
{
            
TF2_SetPlayerClass(client, TFClass_Soldier, false, 
true);
            
Client_PrintToChat(client, true,  "{G}[%s] {N}You were 
\
                
spawned as a {R}Soldier {N}because {R}Pyro {N}is 
\
                
currently  {L}disabled{N}.", 
PLUGIN_NAME);
            
TF2_RespawnPlayer(client);
        
}
        if 
 (((TF2_GetPlayerClass(client)) == 
TFClass_Engineer)
            
&& 
(!GetConVarBool(cv_allow_engy)))
        
{
            
TF2_SetPlayerClass(client, TFClass_Soldier, false, 
true);
            
Client_PrintToChat(client, true,  "{G}[%s] {N}You were 
\
                
spawned as a {R}Soldier {N}because {R}Engineer 
\
                
{N}is  currently {L}disabled{N}.", 
PLUGIN_NAME);
            
TF2_RespawnPlayer(client);
        
}
        if 
 (((TF2_GetPlayerClass(client)) == 
TFClass_Sniper)
            
&& 
(!GetConVarBool(cv_allow_sniper)))
        
{
            
TF2_SetPlayerClass(client, TFClass_Soldier, false, 
true);
            
Client_PrintToChat(client, true,  "{G}[%s] {N}You were 
\
                
spawned as a {R}Soldier {N}because {R}Sniper 
\
                
{N}is  currently {L}disabled{N}.", 
PLUGIN_NAME);
            
TF2_RespawnPlayer(client);
        }

 


 
        for (new i = 0; i < 3; 
++i)
        
{
            for (new 
j  = 0; j < TOTAL_BANNED_ITEMS; 
++j)
            
{
                
//Client_GetWeaponBySlot(client, 
banned_items[i]);
                
new weapon  = GetPlayerWeaponSlot(client, i);

 


 
                
if (weapon != 
-1)
                
{
                    
new weapon_index = GetEntProp(weapon, Prop_Send, 
 "m_iItemDefinitionIndex");
                    
if (weapon_index == 
 banned_items[j])
                    
{
                        
TF2_RemoveWeaponSlot(client, 
i);
                        
new replacement =  GivePlayerItem(client, 
replacement_items[j]);
                        
SetEntProp(replacement, 
Prop_Send,
                            
"m_iItemDefinitionIndex", 
 replacement_items_index[j]);
                        
SetEntProp(replacement,  Prop_Send, "m_bInitialized", 
1);
                        
EquipPlayerWeapon(client, replacement);

 


 
                        
new Handle:pack = 
 CreateDataPack();
                        
CreateTimer(float(i),  Timer_InformPlayerAboutBan, 
pack);
                        
WritePackCell(pack, 
client);
                        
WritePackString(pack, 
 banned_items_names[j]);
                    
}
                
}
            
}
        }

 


 
        SetEntProp(client, Prop_Send, 
"m_bGlowEnabled", 1);
        
RemoveHiddenVision(client); 
    }

 


 
    return Plugin_Continue;
}
This is my hidden mode plugin .sp file
and it is crashing on my server so i fix .sp
and i found that GivePlayerItem , EquipPlayerWeapon are old function.
so i want to use 'tf2items' extension and make it.

I WANT YOUR HELP !
koscar12 is offline
DoPe^
Veteran Member
Join Date: Jul 2008
Location: Denmark / Copenhagen
Old 01-27-2014 , 07:17   Re: [TF2]GivePlayerItem , EquipPlayerWeapon are error.
Reply With Quote #2

Why not just keep it all to 1 topic? you keep making a new. And not only do you make 1 topic when you create one, you create 2 of the same every single time.
__________________
DoPe^ is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-27-2014 , 08:14   Re: [TF2]GivePlayerItem , EquipPlayerWeapon are error.
Reply With Quote #3

Use the hidden thread....
__________________
Profile - Steam Group - Plugins - Blog - Donate
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
koscar12
Member
Join Date: Jan 2014
Old 01-27-2014 , 08:26   Re: [TF2]GivePlayerItem , EquipPlayerWeapon are error.
Reply With Quote #4

Quote:
Originally Posted by friagram View Post
Use the hidden thread....
This is a hidden mode's piece.
I already used it, but it crash everytimes.
so i want to fix this mode.
koscar12 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-27-2014 , 09:56   Re: [TF2]GivePlayerItem , EquipPlayerWeapon are error.
Reply With Quote #5

Is this even code? like how would this even compile right.
__________________
Mitchell is offline
koscar12
Member
Join Date: Jan 2014
Old 01-27-2014 , 17:39   Re: [TF2]GivePlayerItem , EquipPlayerWeapon are error.
Reply With Quote #6

Quote:
Originally Posted by Mitchell View Post
Is this even code? like how would this even compile right.
It is a one of the piece of hidden.sp
Hidden.sp is more more long code.
And it is a error script that i think
koscar12 is offline
Reply


Thread Tools
Display Modes

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 17:35.


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