Raised This Month: $95 Target: $400
 23% 

[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 , 08:02   [TF2]GivePlayerItem , EquipPlayerWeapon are error.
Reply With Quote #1

PHP 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
clientteam);
#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(truetrue) - 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(client0); 
// Revolver
        
TF2_RemoveWeaponSlot(client2); // 
Knife
        TF2_RemoveWeaponSlot
(client
3); // Disguise Kit
        
TF2_RemoveWeaponSlot(client4); // Invisibility 
Watch
                                            

        
new knife=GivePlayerItem(client
"tf_weapon_knife");
        
SetEntProp(knifeProp_Send"m_iItemDefinitionIndex"
4);
        new 
level GetRandomInt(1
100);
        
SetEntProp(knifeProp_Send
"m_iEntityLevel"level);
        
SetEntProp(knifeProp_Send"m_iEntityQuality"
10);
        
SetEntProp(knifeProp_Send
"m_bInitialized"1);
        
EquipPlayerWeapon(clientknife);
        
Client_SetHideHud(client
HIDEHUD_HEALTH);
        
GiveHiddenVision(client);
    }
    
else
    {
        if 
(
TF2_GetPlayerClass(client) == 
TFClass_Spy)
        
{
            
TF2_SetPlayerClass(clientTFClass_Soldierfalse
true);
            
Client_PrintToChat(clienttrue"{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(clientTFClass_Soldierfalse
true);
            
Client_PrintToChat(clienttrue,  "{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(clientTFClass_Soldierfalse
true);
            
Client_PrintToChat(clienttrue,  "{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(clientTFClass_Soldierfalse
true);
            
Client_PrintToChat(clienttrue,  "{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 
03
++
i)
        
{
            for (new 
0TOTAL_BANNED_ITEMS
++
j)
            
{
                
//Client_GetWeaponBySlot(client, 
banned_items[i]);
                
new 
weapon GetPlayerWeaponSlot(clienti);

 
                
if (
weapon != 
-
1)
                
{
                    
new 
weapon_index GetEntProp(weaponProp_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(replacementProp_Send"m_bInitialized"
1);
                        
EquipPlayerWeapon(clientreplacement);

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

 
        
SetEntProp(clientProp_Send
"m_bGlowEnabled"1);
        
RemoveHiddenVision(client); 
    }

 
    return 
Plugin_Continue;

Hello guys
I am fixing Hidden mode .sp
But i can't fix anymore. [i am noob ]
I think GivePlayerItem , EquipPlayerWeapon are error [it's too old i must create in new]

I must use extension 'tf2items' and fix it..

I WANT YOUR HELP PLZ!
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 20:14.


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