Raised This Month: $51 Target: $400
 12% 

Help / Support [ZP 5.0] If player doesn't have a Human Class at Spawn, set one right away


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
internel
Member
Join Date: Nov 2012
Old 07-22-2014 , 13:09   [ZP 5.0] If player doesn't have a Human Class at Spawn, set one right away
Reply With Quote #1

Hello ZP sub-forum, I need some help with this code . What I want to do is that, if the player doesn't have a Human Class selected, (like if he/she just connected) then set one and give him/her all the weapons from that class.

Here is the zp50_class_human code:

PHP Code:
/*================================================================================
    
    -------------------------
    -*- [ZP] Class: Human -*-
    -------------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <fun>
#include <fakemeta>
#include <amx_settings_api>
#include <cs_player_models_api>
#include <cs_weap_models_api>
#include <cs_maxspeed_api>
#include <cs_weap_restrict_api>
#include <zp50_core>
#include <zp50_colorchat>
#include <zp50_class_human_const>

// Human Classes file
new const ZP_HUMANCLASSES_FILE[] = "zp_humanclasses.ini"

#define MAXPLAYERS 32

#define HUMANS_DEFAULT_NAME "Human"
#define HUMANS_DEFAULT_DESCRIPTION "Default"
#define HUMANS_DEFAULT_HEALTH 100
#define HUMANS_DEFAULT_SPEED 1.0
#define HUMANS_DEFAULT_GRAVITY 1.0

// CS Player PData Offsets (win32)
const OFFSET_CSMENUCODE 205

// For class list menu handlers
#define MENU_PAGE_CLASS g_menu_data[id]
new g_menu_data[MAXPLAYERS+1]

enum _:TOTAL_FORWARDS
{
    
FW_CLASS_SELECT_PRE 0
}
new 
g_Forwards[TOTAL_FORWARDS]
new 
g_ForwardResult

new g_HumanClassCount
new Array:g_HumanClassRealName
new Array:g_HumanClassName
new Array:g_HumanClassDesc
new Array:g_HumanClassHealth
new Array:g_HumanClassSpeed
new Array:g_HumanClassGravity
new Array:g_HumanClassModelsFile
new Array:g_HumanClassModelsHandle
new g_HumanClass[MAXPLAYERS+1]
new 
g_HumanClassNext[MAXPLAYERS+1]
new 
g_AdditionalMenuText[32]

public 
plugin_init()
{
    
register_plugin("[ZP] Class: Human"ZP_VERSION_STRING"ZP Dev Team")
    
    
register_clcmd("say /hclass""show_menu_humanclass")
    
register_clcmd("say /class""show_class_menu")
    
    
g_Forwards[FW_CLASS_SELECT_PRE] = CreateMultiForward("zp_fw_class_human_select_pre"ET_CONTINUEFP_CELLFP_CELL)
}

public 
plugin_cfg()
{
    
// No classes loaded, add default human class
    
if (g_HumanClassCount 1)
    {
        
ArrayPushString(g_HumanClassRealNameHUMANS_DEFAULT_NAME)
        
ArrayPushString(g_HumanClassNameHUMANS_DEFAULT_NAME)
        
ArrayPushString(g_HumanClassDescHUMANS_DEFAULT_DESCRIPTION)
        
ArrayPushCell(g_HumanClassHealthHUMANS_DEFAULT_HEALTH)
        
ArrayPushCell(g_HumanClassSpeedHUMANS_DEFAULT_SPEED)
        
ArrayPushCell(g_HumanClassGravityHUMANS_DEFAULT_GRAVITY)
        
ArrayPushCell(g_HumanClassModelsFilefalse)
        
ArrayPushCell(g_HumanClassModelsHandleInvalid_Array)
        
g_HumanClassCount++
    }
}

public 
plugin_natives()
{
    
register_library("zp50_class_human")
    
register_native("zp_class_human_get_current""native_class_human_get_current")
    
register_native("zp_class_human_get_next""native_class_human_get_next")
    
register_native("zp_class_human_set_next""native_class_human_set_next")
    
register_native("zp_class_human_register""native_class_human_register")
    
register_native("zp_class_human_register_model""_class_human_register_model")
    
register_native("zp_class_human_get_id""native_class_human_get_id")
    
register_native("zp_class_human_get_name""native_class_human_get_name")
    
register_native("zp_class_human_get_real_name""_class_human_get_real_name")
    
register_native("zp_class_human_get_desc""native_class_human_get_desc")
    
register_native("zp_class_human_get_count""native_class_human_get_count")
    
register_native("zp_class_human_show_menu""native_class_human_show_menu")
    
register_native("zp_class_human_menu_text_add""_class_human_menu_text_add")
    
    
// Initialize dynamic arrays
    
g_HumanClassRealName ArrayCreate(321)
    
g_HumanClassName ArrayCreate(321)
    
g_HumanClassDesc ArrayCreate(321)
    
g_HumanClassHealth ArrayCreate(11)
    
g_HumanClassSpeed ArrayCreate(11)
    
g_HumanClassGravity ArrayCreate(11)
    
g_HumanClassModelsFile ArrayCreate(11)
    
g_HumanClassModelsHandle ArrayCreate(11)
}

public 
client_putinserver(id)
{
    
g_HumanClass[id] = ZP_INVALID_HUMAN_CLASS
    g_HumanClassNext
[id] = ZP_INVALID_HUMAN_CLASS
}

public 
client_disconnect(id)
{
    
// Reset remembered menu pages
    
MENU_PAGE_CLASS 0
}

public 
show_class_menu(id)
{
    if (!
zp_core_is_zombie(id))
        
show_menu_humanclass(id)
}

public 
show_menu_humanclass(id)
{
    static 
menu[128], name[32], description[32], transkey[64]
    new 
menuiditemdata[2], index
    
    formatex
(menucharsmax(menu), "%L\r"id"MENU_HCLASS")
    
menuid menu_create(menu"menu_humanclass")
    
    for (
index 0index g_HumanClassCountindex++)
    {
        
// Additional text to display
        
g_AdditionalMenuText[0] = 0
        
        
// Execute class select attempt forward
        
ExecuteForward(g_Forwards[FW_CLASS_SELECT_PRE], g_ForwardResultidindex)
        
        
// Show class to player?
        
if (g_ForwardResult >= ZP_CLASS_DONT_SHOW)
            continue;
        
        
ArrayGetString(g_HumanClassNameindexnamecharsmax(name))
        
ArrayGetString(g_HumanClassDescindexdescriptioncharsmax(description))
        
        
// ML support for class name + description
        
formatex(transkeycharsmax(transkey), "HUMANDESC %s"name)
        if (
GetLangTransKey(transkey) != TransKey_Badformatex(descriptioncharsmax(description), "%L"idtranskey)
        
formatex(transkeycharsmax(transkey), "HUMANNAME %s"name)
        if (
GetLangTransKey(transkey) != TransKey_Badformatex(namecharsmax(name), "%L"idtranskey)
        
        
// Class available to player?
        
if (g_ForwardResult >= ZP_CLASS_NOT_AVAILABLE)
            
formatex(menucharsmax(menu), "\d%s %s %s"namedescriptiong_AdditionalMenuText)
        
// Class is current class?
        
else if (index == g_HumanClassNext[id])
            
formatex(menucharsmax(menu), "\r%s \y%s \w%s"namedescriptiong_AdditionalMenuText)
        else
            
formatex(menucharsmax(menu), "%s \y%s \w%s"namedescriptiong_AdditionalMenuText)
        
        
itemdata[0] = index
        itemdata
[1] = 0
        menu_additem
(menuidmenuitemdata)
    }
    
    
// No classes to display?
    
if (menu_items(menuid) <= 0)
    {
        
zp_colored_print(id"%L"id"NO_CLASSES")
        
menu_destroy(menuid)
        return;
    }
    
    
// Back - Next - Exit
    
formatex(menucharsmax(menu), "%L"id"MENU_BACK")
    
menu_setprop(menuidMPROP_BACKNAMEmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_NEXT")
    
menu_setprop(menuidMPROP_NEXTNAMEmenu)
    
formatex(menucharsmax(menu), "%L"id"MENU_EXIT")
    
menu_setprop(menuidMPROP_EXITNAMEmenu)
    
    
// If remembered page is greater than number of pages, clamp down the value
    
MENU_PAGE_CLASS min(MENU_PAGE_CLASSmenu_pages(menuid)-1)
    
    
// Fix for AMXX custom menus
    
set_pdata_int(idOFFSET_CSMENUCODE0)
    
menu_display(idmenuidMENU_PAGE_CLASS)
}

public 
menu_humanclass(idmenuiditem)
{
    
// Menu was closed
    
if (item == MENU_EXIT)
    {
        
MENU_PAGE_CLASS 0
        menu_destroy
(menuid)
        return 
PLUGIN_HANDLED;
    }
    
    
// Remember class menu page
    
MENU_PAGE_CLASS item 7
    
    
// Retrieve class index
    
new itemdata[2], dummyindex
    menu_item_getinfo
(menuiditemdummyitemdatacharsmax(itemdata), __dummy)
    
index itemdata[0]
    
    
// Execute class select attempt forward
    
    
if(g_HumanClass[id] == ZP_INVALID_HUMAN_CLASS)
    {
        
g_HumanClass[id] = index
        g_HumanClass
[id] = g_HumanClassNext[id]
        
set_user_health(idArrayGetCell(g_HumanClassHealthg_HumanClass[id]))
        
set_user_gravity(idFloat:ArrayGetCell(g_HumanClassGravityg_HumanClass[id]))
        
cs_set_player_maxspeed_auto(idFloat:ArrayGetCell(g_HumanClassSpeedg_HumanClass[id]))
        
        new Array:
class_models ArrayGetCell(g_HumanClassModelsHandleg_HumanClass[id])
        if (
class_models != Invalid_Array)
        {
            new 
index random_num(0ArraySize(class_models) - 1)
            new 
player_model[32]
            
ArrayGetString(class_modelsindexplayer_modelcharsmax(player_model))
            
cs_set_player_model(idplayer_model)
        }
    }
    else if(
g_HumanClassNext[id] >= 1)
    {
        
ExecuteForward(g_Forwards[FW_CLASS_SELECT_PRE], g_ForwardResultidindex)
        
        
// Class available to player?
        
if (g_ForwardResult >= ZP_CLASS_NOT_AVAILABLE)
        {
            
menu_destroy(menuid)
            return 
PLUGIN_HANDLED;
        }
        
        
// Make selected class next class for player
        
g_HumanClassNext[id] = index
        
        
new name[32], transkey[64]
        new 
Float:maxspeed Float:ArrayGetCell(g_HumanClassSpeedg_HumanClassNext[id])
        
ArrayGetString(g_HumanClassNameg_HumanClassNext[id], namecharsmax(name))
        
// ML support for class name
        
formatex(transkeycharsmax(transkey), "HUMANNAME %s"name)
        if (
GetLangTransKey(transkey) != TransKey_Badformatex(namecharsmax(name), "%L"idtranskey)
        
        
// Show selected human class
        
zp_colored_print(id"%L: %s"id"HUMAN_SELECT"name)
        
zp_colored_print(id"%L: %d %L: %d %L: %.2fx"id"ZOMBIE_ATTRIB1"ArrayGetCell(g_HumanClassHealthg_HumanClassNext[id]), id"ZOMBIE_ATTRIB2"cs_maxspeed_display_value(maxspeed), id"ZOMBIE_ATTRIB3"Float:ArrayGetCell(g_HumanClassGravityg_HumanClassNext[id]))
    }
    
menu_destroy(menuid)
    return 
PLUGIN_HANDLED;
}

public 
zp_fw_core_cure_post(idattacker)
{
    
// Show human class menu if they haven't chosen any (e.g. just connected)
    
if (g_HumanClassNext[id] == ZP_INVALID_HUMAN_CLASS)
    {
        if (
g_HumanClassCount 1)
            
show_menu_humanclass(id)
        else 
// If only one class is registered, choose it automatically
            
g_HumanClassNext[id] = 0
    
}
    
    
// Bots pick class automatically
    
if (is_user_bot(id))
    {
        
// Try choosing class
        
new indexstart_index random_num(0g_HumanClassCount 1)
        for (
index start_index 1/* no condition */index++)
        {
            
// Start over when we reach the end
            
if (index >= g_HumanClassCount)
                
index 0
            
            
// Execute class select attempt forward
            
ExecuteForward(g_Forwards[FW_CLASS_SELECT_PRE], g_ForwardResultidindex)
            
            
// Class available to player?
            
if (g_ForwardResult ZP_CLASS_NOT_AVAILABLE)
            {
                
g_HumanClassNext[id] = index
                
break;
            }
            
            
// Loop completed, no class could be chosen
            
if (index == start_index)
                break;
        }
    }
    
    
// Set selected human class. If none selected yet, use the first one
    
g_HumanClass[id] = g_HumanClassNext[id]
    if (
g_HumanClass[id] == ZP_INVALID_HUMAN_CLASSg_HumanClass[id] = 0
    
    
// Apply human attributes
    
set_user_health(idArrayGetCell(g_HumanClassHealthg_HumanClass[id]))
    
set_user_gravity(idFloat:ArrayGetCell(g_HumanClassGravityg_HumanClass[id]))
    
cs_set_player_maxspeed_auto(idFloat:ArrayGetCell(g_HumanClassSpeedg_HumanClass[id]))
    
    
// Apply human player model
    
new Array:class_models ArrayGetCell(g_HumanClassModelsHandleg_HumanClass[id])
    if (
class_models != Invalid_Array)
    {
        new 
index random_num(0ArraySize(class_models) - 1)
        new 
player_model[32]
        
ArrayGetString(class_modelsindexplayer_modelcharsmax(player_model))
        
cs_set_player_model(idplayer_model)
    }
    else
    {
        
// No models registered for current class, use default model
        
cs_reset_player_model(id)
    }
}

public 
native_class_human_get_current(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
ZP_INVALID_HUMAN_CLASS;
    }
    
    return 
g_HumanClass[id];
}

public 
native_class_human_get_next(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
ZP_INVALID_HUMAN_CLASS;
    }
    
    return 
g_HumanClassNext[id];
}

public 
native_class_human_set_next(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    new 
classid get_param(2)
    
    if (
classid || classid >= g_HumanClassCount)
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid human class id (%d)"classid)
        return 
false;
    }
    
    
g_HumanClassNext[id] = classid
    
return true;
}

public 
native_class_human_register(plugin_idnum_params)
{
    new 
name[32]
    
get_string(1namecharsmax(name))
    
    if (
strlen(name) < 1)
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Can't register human class with an empty name")
        return 
ZP_INVALID_HUMAN_CLASS;
    }
    
    new 
indexhumanclass_name[32]
    for (
index 0index g_HumanClassCountindex++)
    {
        
ArrayGetString(g_HumanClassRealNameindexhumanclass_namecharsmax(humanclass_name))
        if (
equali(namehumanclass_name))
        {
            
log_error(AMX_ERR_NATIVE"[ZP] Human class already registered (%s)"name)
            return 
ZP_INVALID_HUMAN_CLASS;
        }
    }
    
    new 
description[32]
    
get_string(2descriptioncharsmax(description))
    new 
health get_param(3)
    new 
Float:speed get_param_f(4)
    new 
Float:gravity get_param_f(5)
    
    
// Load settings from human classes file
    
new real_name[32]
    
copy(real_namecharsmax(real_name), name)
    
ArrayPushString(g_HumanClassRealNamereal_name)
    
    
// Name
    
if (!amx_load_setting_string(ZP_HUMANCLASSES_FILEreal_name"NAME"namecharsmax(name)))
        
amx_save_setting_string(ZP_HUMANCLASSES_FILEreal_name"NAME"name)
    
ArrayPushString(g_HumanClassNamename)
    
    
// Description
    
if (!amx_load_setting_string(ZP_HUMANCLASSES_FILEreal_name"INFO"descriptioncharsmax(description)))
        
amx_save_setting_string(ZP_HUMANCLASSES_FILEreal_name"INFO"description)
    
ArrayPushString(g_HumanClassDescdescription)
    
    
// Models
    
new Array:class_models ArrayCreate(321)
    
amx_load_setting_string_arr(ZP_HUMANCLASSES_FILEreal_name"MODELS"class_models)
    if (
ArraySize(class_models) > 0)
    {
        
ArrayPushCell(g_HumanClassModelsFiletrue)
        
        
// Precache player models
        
new indexplayer_model[32], model_path[128]
        for (
index 0index ArraySize(class_models); index++)
        {
            
ArrayGetString(class_modelsindexplayer_modelcharsmax(player_model))
            
formatex(model_pathcharsmax(model_path), "models/player/%s/%s.mdl"player_modelplayer_model)
            
precache_model(model_path)
            
// Support modelT.mdl files
            
formatex(model_pathcharsmax(model_path), "models/player/%s/%sT.mdl"player_modelplayer_model)
            if (
file_exists(model_path)) precache_model(model_path)
        }
    }
    else
    {
        
ArrayPushCell(g_HumanClassModelsFilefalse)
        
ArrayDestroy(class_models)
        
amx_save_setting_string(ZP_HUMANCLASSES_FILEreal_name"MODELS""")
    }
    
ArrayPushCell(g_HumanClassModelsHandleclass_models)
    
    
    
// Health
    
if (!amx_load_setting_int(ZP_HUMANCLASSES_FILEreal_name"HEALTH"health))
        
amx_save_setting_int(ZP_HUMANCLASSES_FILEreal_name"HEALTH"health)
    
ArrayPushCell(g_HumanClassHealthhealth)
    
    
// Speed
    
if (!amx_load_setting_float(ZP_HUMANCLASSES_FILEreal_name"SPEED"speed))
        
amx_save_setting_float(ZP_HUMANCLASSES_FILEreal_name"SPEED"speed)
    
ArrayPushCell(g_HumanClassSpeedspeed)
    
    
// Gravity
    
if (!amx_load_setting_float(ZP_HUMANCLASSES_FILEreal_name"GRAVITY"gravity))
        
amx_save_setting_float(ZP_HUMANCLASSES_FILEreal_name"GRAVITY"gravity)
    
ArrayPushCell(g_HumanClassGravitygravity)
    
    
g_HumanClassCount++
    return 
g_HumanClassCount 1;
}

public 
_class_human_register_model(plugin_idnum_params)
{
    new 
classid get_param(1)
    
    if (
classid || classid >= g_HumanClassCount)
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid human class id (%d)"classid)
        return 
false;
    }
    
    
// Player models already loaded from file
    
if (ArrayGetCell(g_HumanClassModelsFileclassid))
        return 
true;
    
    new 
player_model[32]
    
get_string(2player_modelcharsmax(player_model))
    
    new 
model_path[128]
    
formatex(model_pathcharsmax(model_path), "models/player/%s/%s.mdl"player_modelplayer_model)
    
    
precache_model(model_path)
    
    
// Support modelT.mdl files
    
formatex(model_pathcharsmax(model_path), "models/player/%s/%sT.mdl"player_modelplayer_model)
    if (
file_exists(model_path)) precache_model(model_path)
    
    new Array:
class_models ArrayGetCell(g_HumanClassModelsHandleclassid)
    
    
// No models registered yet?
    
if (class_models == Invalid_Array)
    {
        
class_models ArrayCreate(321)
        
ArraySetCell(g_HumanClassModelsHandleclassidclass_models)
    }
    
ArrayPushString(class_modelsplayer_model)
    
    
// Save models to file
    
new real_name[32]
    
ArrayGetString(g_HumanClassRealNameclassidreal_namecharsmax(real_name))
    
amx_save_setting_string_arr(ZP_HUMANCLASSES_FILEreal_name"MODELS"class_models)
    
    return 
true;
}

public 
native_class_human_get_id(plugin_idnum_params)
{
    new 
real_name[32]
    
get_string(1real_namecharsmax(real_name))
    
    
// Loop through every class
    
new indexhumanclass_name[32]
    for (
index 0index g_HumanClassCountindex++)
    {
        
ArrayGetString(g_HumanClassRealNameindexhumanclass_namecharsmax(humanclass_name))
        if (
equali(real_namehumanclass_name))
            return 
index;
    }
    
    return 
ZP_INVALID_HUMAN_CLASS;
}

public 
native_class_human_get_name(plugin_idnum_params)
{
    new 
classid get_param(1)
    
    if (
classid || classid >= g_HumanClassCount)
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid human class id (%d)"classid)
        return 
false;
    }
    
    new 
name[32]
    
ArrayGetString(g_HumanClassNameclassidnamecharsmax(name))
    
    new 
len get_param(3)
    
set_string(2namelen)
    return 
true;
}

public 
_class_human_get_real_name(plugin_idnum_params)
{
    new 
classid get_param(1)
    
    if (
classid || classid >= g_HumanClassCount)
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid human class id (%d)"classid)
        return 
false;
    }
    
    new 
real_name[32]
    
ArrayGetString(g_HumanClassRealNameclassidreal_namecharsmax(real_name))
    
    new 
len get_param(3)
    
set_string(2real_namelen)
    return 
true;
}

public 
native_class_human_get_desc(plugin_idnum_params)
{
    new 
classid get_param(1)
    
    if (
classid || classid >= g_HumanClassCount)
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid human class id (%d)"classid)
        return 
false;
    }
    
    new 
description[32]
    
ArrayGetString(g_HumanClassDescclassiddescriptioncharsmax(description))
    
    new 
len get_param(3)
    
set_string(2descriptionlen)
    return 
true;
}

public 
native_class_human_get_count(plugin_idnum_params)
{
    return 
g_HumanClassCount;
}

public 
native_class_human_show_menu(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_connected(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    
show_menu_humanclass(id)
    return 
true;
}

public 
_class_human_menu_text_add(plugin_idnum_params)
{
    static 
text[32]
    
get_string(1textcharsmax(text))
    
format(g_AdditionalMenuTextcharsmax(g_AdditionalMenuText), "%s%s"g_AdditionalMenuTexttext)

This is a sub-plugin that I founded in this forum that gives the player grenades when spawning.

PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <fun> 
#include <zp50_class_human> 

#define _PLUGIN    "[ZP50] Human Class: Grenader"
#define _VERSION               "1.0b"
#define _AUTHOR             "H.RED.ZONE"

new const humanclass2_name[] = "Grenader Human" 
new const humanclass2_info[] = "Get More Grenades" 
new const humanclass2_models[][] = { "sas" 
const 
humanclass2_health 75 
const Float:humanclass2_speed 1.1 
const Float:humanclass2_gravity 1.0 

new _gNades 

new _pCvarHeNum
    
,_pCvarFrostNum
    
,_pCvarFlareNum

public plugin_init() { 
    
register_plugin(_PLUGIN_VERSION_AUTHOR
    
    
_pCvarHeNum register_cvar("zp_human_class_he""3")
    
_pCvarFrostNum register_cvar("zp_human_class_frost""3")
    
_pCvarFlareNum register_cvar("zp_human_class_flare""3")


public 
plugin_precache() {     
    
_gNades zp_class_human_register(humanclass2_namehumanclass2_infohumanclass2_healthhumanclass2_speedhumanclass2_gravity

    for (new 
index 0index sizeof humanclass2_modelsindex++) 
        
zp_class_human_register_model(_gNadeshumanclass2_models[index]) 


public 
zp_fw_core_spawn_post(plr) {
    if(
zp_class_human_get_next(plr) == _gNades ) {
        if(!
zp_core_is_zombie(plr)) { 
            
_GiveGrenades(plr)
                }
        } 


public 
zp_fw_core_cure_post(plr) { 
    if(
zp_class_human_get_next(plr) == _gNades) { 
        
_GiveGrenades(plr)
    } 
}  

public 
_GiveGrenades(plr) {
    
give_item(plr"weapon_hegrenade"
    
cs_set_user_bpammoplrCSW_HEGRENADEget_pcvar_num_pCvarHeNum ))
    
    
give_item(plr"weapon_flashbang")
    
cs_set_user_bpammoplrCSW_FLASHBANGget_pcvar_num_pCvarFrostNum ))
    
    
give_item(plr"weapon_smokegrenade")
    
cs_set_user_bpammoplrCSW_SMOKEGRENADEget_pcvar_num_pCvarFlareNum ))

Please help u.u
internel is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-22-2014 , 14:06   Re: [ZP 5.0] If player doesn't have a Human Class at Spawn, set one right away
Reply With Quote #2

You want to give default human grenades?
__________________
H.RED.ZONE is offline
internel
Member
Join Date: Nov 2012
Old 07-22-2014 , 15:00   Re: [ZP 5.0] If player doesn't have a Human Class at Spawn, set one right away
Reply With Quote #3

Quote:
Originally Posted by H.RED.ZONE View Post
You want to give default human grenades?
that plugin was just an example, what I meant was that if the var g_HumanClass is equal to "ZP_INVALID_HUMAN_CLASS", the player choose any class and instead of waiting for the next round , just give him that class right away (that including all the weapons that class may have)

sorry for my rusty english >.<, and thanks for answering ^^

Last edited by internel; 07-22-2014 at 15:00.
internel is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-22-2014 , 15:18   Re: [ZP 5.0] If player doesn't have a Human Class at Spawn, set one right away
Reply With Quote #4

Code:
public client_putinserver(id)
{
    g_HumanClass[id] = ZP_INVALID_HUMAN_CLASS
    g_HumanClassNext[id] = ZP_INVALID_HUMAN_CLASS
}
=>
Code:
public client_putinserver(id)
{
    g_HumanClass[id] = 1
    g_HumanClassNext[id] = 1
}
I guess you mean that?
__________________

Last edited by H.RED.ZONE; 07-22-2014 at 15:18.
H.RED.ZONE is offline
internel
Member
Join Date: Nov 2012
Old 07-22-2014 , 22:24   Re: [ZP 5.0] If player doesn't have a Human Class at Spawn, set one right away
Reply With Quote #5

Quote:
Originally Posted by H.RED.ZONE View Post
Code:
public client_putinserver(id)
{
    g_HumanClass[id] = ZP_INVALID_HUMAN_CLASS
    g_HumanClassNext[id] = ZP_INVALID_HUMAN_CLASS
}
=>
Code:
public client_putinserver(id)
{
    g_HumanClass[id] = 1
    g_HumanClassNext[id] = 1
}
I guess you mean that?

not exactly that >.<

if you are a player that spawns for the first time in the map and haven't choose any human class yet, when you choose it, you get all the weapons and stats from that class instead of waiting for the next round. (That's what I'm trying to do, but I don't know how)

Last edited by internel; 07-22-2014 at 22:25.
internel is offline
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 07-22-2014 , 22:35   Re: [ZP 5.0] If player doesn't have a Human Class at Spawn, set one right away
Reply With Quote #6

Quote:
Originally Posted by internel View Post
not exactly that >.<

if you are a player that spawns for the first time in the map and haven't choose any human class yet, when you choose it, you get all the weapons and stats from that class instead of waiting for the next round. (That's what I'm trying to do, but I don't know how)
Thats what i wrote just the thing is it sets class number 1 to be default so you need to set first class what you want. Sort human plugins as you want.
__________________
H.RED.ZONE is offline
wicho
Veteran Member
Join Date: Feb 2012
Location: GuateAmala
Old 07-23-2014 , 02:53   Re: [ZP 5.0] If player doesn't have a Human Class at Spawn, set one right away
Reply With Quote #7

I think he want to deactivate the weapons menu on new round to the human classes that receive weapons, for example if he have a human class called sniper human he dont want to show the menu of weapons because otherwise the class would be meaningless, cuz he can drop the sniper weapon and choose others...
wicho is offline
Reply



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


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