Raised This Month: $209 Target: $400
 52% 

[TF2]give weapon when spawn script...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
koscar12
Member
Join Date: Jan 2014
Old 01-26-2014 , 06:50   [TF2]give weapon when spawn script...
Reply With Quote #1

Hi guys
I want to open tf2 Hidden mod , but i can not open.
it was crashing everytime.
so i asked to my friend and he say
'public Action:player_spawn' is old. change in new
but i am noob....
So, i need your help

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 a piece of hidden.sp
also i attach hidden.sp

plz help me.
Attached Files
File Type: sp Get Plugin or Get Source (hidden.sp - 149 views - 62.5 KB)
koscar12 is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 01-26-2014 , 09:06   Re: [TF2]give weapon when spawn script...
Reply With Quote #2

I have a 17" and a 19" screen and I have never seen code like this.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
koscar12
Member
Join Date: Jan 2014
Old 01-26-2014 , 10:43   Re: [TF2]give weapon when spawn script...
Reply With Quote #3

Do you how to fix it?
koscar12 is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 01-26-2014 , 15:13   Re: [TF2]give weapon when spawn script...
Reply With Quote #4

Quote:
Originally Posted by Dr. Greg House View Post
I have a 17" and a 19" screen and I have never seen code like this.
Written on my iPhone
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram 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 08:07.


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