Ok so in my small il plugin family I have my main plugin which will hold all of my experience and ranks and what not as well as my cvars.. So for my question
How would i do something like this..
The below takes the Medic and shows it to both teams on a menu.
If i was to choose this how would i make it known to the child plugin that that was my selection and to every spawn give me my items and skills?
If you dont understand what i mean i can try to explain it better.
But basically like super hero.. If i add say DocHoliday to my super hero server What part of SH allows my added class to know i chose it?
Also how would i add Cvars using something like (Since each class will change those cvars) and then have a stock give those items and skills to each player at spawn (can be achieved by a multi forward i think just not sure how)
PHP Code:
enum _:CRCVAR
{
CVAR_PWEP,
CVAR_SWEP,
CVAR_HEALTH,
CVAR_ARMOR,
CVAR_SPEED,
CVAR_GRAVITY,
CVAR_INVIS,
CVAR_HEAL
}
new g_Cvar [ CRCVAR ] [ Class ] [ Rank ];
PHP Code:
#include <amxmodx>
#include <bfm>
public plugin_init()
{
reg_bf_class("Medic", "b")
}
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <bfm>
enum _:ItemsDatas {
Item_Name[32],
Item_Team
}
new Array:g_aItems;
new g_mItems[ItemsDatas];
new bool:AlreadyShown[33] = false, bool:ChooseNew[33];
public plugin_init()
{
g_aItems = ArrayCreate( ItemsDatas );
RegisterHam(Ham_Spawn, "player", "OnMenuSelect", 1);
}
public plugin_natives()
{
register_native("reg_bf_class", "register_battlefield_class");
}
public PlayerSpawn(id)
{
if(is_user_alive(id))
{
if(ChooseNew[id])
{
MenuDisplayer(id);
}
if(AlreadyShown[id])
{
//Multi Forward to set skills and give items according to Rank
}
}
}
public MenuDisplayer(id)
{
new iTeam = get_user_team(id)
new iMenu = menu_create("Battlefield" , "HandleClassMenu")
new i_Size = ArraySize( g_aItems )
new szNum[3]
for ( new i = 0; i < i_Size; ++i )
{
// Use to get the data from array
ArrayGetArray( g_aItems, i, g_mItems );
if(g_mItems[Item_Team] & iTeam)
{
num_to_str(i, szNum, charsmax(szNum))
menu_additem( iMenu , g_mItems[Item_Name] , szNum , 0 );
}
}
menu_setprop( iMenu , MPROP_EXIT , MEXIT_NEVER );
menu_display( id , iMenu , 0 );
}
public HandleClassMenu( id , iMenu , iItem )
{
new szKey[ 3 ] , iSelectedClass , Dummy;
menu_item_getinfo( iMenu , iItem , Dummy , szKey , 2 , "" , 0 , Dummy );
iSelectedClass = str_to_num( szKey );
AlreadyShown[id] = true;
ChooseNew[id] = false;
return PLUGIN_HANDLED;
}
public register_battlefield_class(iPlugin, iParams)
{
new szTeam[2];
get_string(1, g_mItems[Item_Name], charsmax(g_mItems[Item_Name]));
get_string(2, szTeam, charsmax(szTeam))
switch( szTeam[0] )
{
case 't','T' :
{
g_mItems[Item_Team] = 1
}
case 'c','C' :
{
g_mItems[Item_Team] = 2
}
case 'b','B' :
{
g_mItems[Item_Team] = 1 | 2
}
}
ArrayPushArray(g_aItems, g_mItems);
}
PHP Code:
#include <amxmodx>
native reg_bf_class(const name[], const team[])
stock bf_precache_model(const fmt[], any:...)
{
new filename[128];
vformat(filename, charsmax(filename), fmt, 2);
return precache_model(filename);
}
// Precache Sound
stock bf_precache_sound(const fmt[], any:...)
{
new filename[128];
vformat(filename, charsmax(filename), fmt, 2);
return precache_sound(filename);
}