Raised This Month: $ Target: $400
 0% 

automatically selects the class


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PsychoPach
Member
Join Date: Aug 2010
Location: Lithuania
Old 08-14-2011 , 07:22   automatically selects the class
Reply With Quote #1

Hi all how make then you go in server and start play you automatically selects the class? and then you die you respawn and again auto class select. the class not the same, but different

CT 50% - that choose this class
Berserk 50% - that choose this class
Carmine 50% - that choose this class
Vox 50% - that choose this class
Girl 50% - that choose this class
Blade 50% - that choose this class
Robot 50% - that choose this class
Hellknight 50% - that choose this class

PHP Code:
/* Stay Alive Mod By Ziugis or PsychoPach. Special Thanks: Pur3Biatch, Exolent[jNr] */  

#include <amxmodx>    
#include <amxmisc>    
#include <fun>  
#include <cstrike>   
#include <fakemeta>  
#include <hamsandwich>   

#define PLUGIN "Stay Alive!"    
#define VERSION "0.1"    
#define AUTHOR "Ziugis"    

#define Ham_Player_ResetMaxSpeed Ham_Item_PreFrame 

enum _:CLASSES {     
    
CLASS_CT 0,    
    
CLASS_BERSERK,  
    
CLASS_CARMINE,  
    
CLASS_VOX,  
    
CLASS_GIRL,  
    
CLASS_BLADE,  
    
CLASS_ROBOT,  
    
CLASS_HELLKNIGHT  

new const 
className[CLASSES][] = { 
    
"CT"
    
"Berserk"
    
"Carmine"
    
"Vox"
    
"Girl"
    
"Blade"
    
"Robot"
    
"Hellknight" 
}; 
new 
Trie:classNameToIndex
enum _:MODELS 
    
MODEL_PLAYER
    
MODEL_WEAPON_P
    
MODEL_WEAPON_V 

new const 
classModels[CLASSES][MODELS][] = { 
    {
"CT"""""}, 
    {
"Berserk""""models/Alive/v_claws.mdl"}, 
    {
"Carmine""models/Alive/p_bak.mdl""models/Alive/v_bak.mdl"}, 
    {
"Vox""models/Alive/p_samurai.mdl""models/Alive/v_samurai.mdl"}, 
    {
"Girl""models/Alive/p_pockets.mdl""models/Alive/v_pockets.mdl"}, 
    {
"Blade""models/Alive/p_khanjar.mdl""models/Alive/v_khanjar.mdl"}, 
    {
"Robot""models/Alive/p_chainsaw.mdl""models/Alive/v_chainsaw.mdl"}, 
    {
"Hellknight"""""
}; 
// must untag (_:value) all floats, but keep the variable tagged as float 
// use _:-1.0 for damage to not alter the original damage 
new const Float:classDamage[CLASSES] = { 
    
_:-1.0_:70.0_:30.0_:60.0_:40.0_:40.0_:150.0_:100.0 
}; 
new const 
classHealth[CLASSES] = { 
    
5012002001501251507005000 
}; 
new const 
classArmor[CLASSES] = { 
    
100500250500050800
}; 
// must untag (_:value) all floats, but keep the variable tagged as float 
new const Float:classSpeed[CLASSES] = { 
    
_:400.0_:115.0_:300.0_:1000.0_:1500.0_:500.0_:450.0_:600.0 
}; 
new const 
classWeapons[CLASSES] = { 
    (
1<<CSW_M3), 
    (
1<<CSW_M249), 
    (
1<<CSW_MAC10)|(1<<CSW_TMP), 
    (
1<<CSW_MP5NAVY), 
    (
1<<CSW_M4A1), 
    (
1<<CSW_XM1014), 
    (
1<<CSW_AWP), 
    

}; 

new 
PlayerClass[33]   

new 
maxPlayers

public 
plugin_init()     
{    
    
register_plugin(PLUGINVERSIONAUTHOR)    
     
    
register_clcmd("say""CmdSay");   
     
    
RegisterHam(Ham_Item_Deploy"knife""FwdDeployKnifePost"1); 
    
RegisterHam(Ham_TakeDamage"player""KniveTakeDamage"); 
    
RegisterHam(Ham_Player_ResetMaxSpeed"player""FwdResetMaxSpeedPost"1); 
     
    
maxPlayers get_maxplayers(); 
}    

public 
plugin_precache()     
{   
    
classNameToIndex TrieCreate(); 
     
    new 
model[64]; 
    for(new class = 
0; class < CLASSES; class++) { 
        
copy(modelcharsmax(model), className[class]); 
        
strtolower(model); 
        
TrieSetCell(classNameToIndexmodel, class); 
         
        if(
classModels[class][MODEL_PLAYER][0]) { 
            
formatex(modelcharsmax(model), "models/player/%s/%s.mdl"classModels[class][MODEL_PLAYER], classModels[class][MODEL_PLAYER]); 
            
precache_model(model); 
        } 
        if(
classModels[class][MODEL_WEAPON_P][0]) { 
            
precache_model(classModels[class][MODEL_WEAPON_P]); 
        } 
        if(
classModels[class][MODEL_WEAPON_V][0]) { 
            
precache_model(classModels[class][MODEL_WEAPON_V]); 
        } 
    } 
     
    return 
PLUGIN_CONTINUE    


public 
CmdSay(id) { 
    new 
args[194]; 
    
read_args(argscharsmax(args)); 
    
remove_quotes(args); 
     
    if(
args[0] == '/') { 
        new 
command[32]; 
        
parse(args[1], commandcharsmax(command)); 
        
strtolower(command); 
         
        new class; 
        if(
TrieGetCell(classNameToIndexcommand, class) && PlayerClass[id] != class) { 
            
PlayerClass[id] = class; 
            
set_user_health(idclassHealth[class]); 
            
set_user_armor(idclassArmor[class]); 
            
set_user_maxspeed(idclassSpeed[class]); 
            if(
classModels[class][MODEL_PLAYER][0]) { 
                
cs_set_user_model(idclassModels[class][MODEL_PLAYER]); 
            } else { 
                
cs_reset_user_model(id); 
            } 
            new 
weaponName[20]; // weapon_smokegrenade = 19 
            
for(new CSW_P228<= CSW_P90i++) { 
                if(
classWeapons[class] & (1<<i) && get_weaponname(iweaponNamecharsmax(weaponName))) { 
                    
give_item(idweaponName); 
                } 
            } 
            
client_print(idprint_chat"[Stay Alive] You are %s now."className[class]); 
        } 
    } 


public 
FwdDeployKnifePost(weapon) { 
    new 
id pev(weaponpev_owner); 
     
    new class = 
PlayerClass[id]; 
     
    if(
classModels[class][MODEL_WEAPON_P][0]) { 
        
set_pev(idpev_weaponmodel2classModels[class][MODEL_WEAPON_P]); 
    } 
    if(
classModels[class][MODEL_WEAPON_V][0]) { 
        
set_pev(idpev_viewmodel2classModels[class][MODEL_WEAPON_V]); 
    } 


public 
FwdResetMaxSpeedPost(id) { 
    
set_user_maxspeed(idclassSpeed[PlayerClass[id]]); 


public 
KniveTakeDamage(victiminflictorattackerFloat:damagedamage_bits)   

    if(    
attacker == inflictor 
    
&&     attacker != victim 
    
&&     (<= attacker <= maxPlayers
    &&     
classDamage[PlayerClass[attacker]] >= 0.0 
    
&&     get_user_weapon(attacker) == CSW_KNIFE
    { 
        
SetHamParamFloat(4classDamage[PlayerClass[attacker]]); 
    } 

Or show the code how pleas
__________________
Sorry for me english

Last edited by PsychoPach; 08-14-2011 at 12:40.
PsychoPach is offline
Send a message via Skype™ to PsychoPach
 



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 03:19.


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