--
[ Picked text/plain from multipart/alternative ]
I hope this helps, I basically send a console command containing the command
"primaryweapon" and then a string of the weapon which is held in the
comboboxes in my case. And then on theserver it is worked out from there.
void CWeaponLoadOutMenu::OnCommand( const char *command )
{
if (!stricmp(command, "chosenequipment") )
{
//////////////////////////////////////////////////////////////////////////
// Purpose: primaryweapon command - ^Ben
//////////////////////////////////////////////////////////////////////////
int iPrimaryEquipID = m_pPrimaryWeapons->GetActiveItem();
char buf[ 2048 ];
wchar_t playerText[ 80 ];
m_pPrimaryWeapons->GetItemText(iPrimaryEquipID, playerText,
sizeof(playerText));
localize()->ConvertUnicodeToANSI(playerText, buf, sizeof(buf));
const char* sItemText = buf;
const char* szCleanItem = ConvertRawOutPutToWeapon(sItemText);
char command[128];
Q_snprintf( command, sizeof(command), "primaryweapon \"%s\"",
szCleanItem );
engine->ClientCmd(command);
}
And then in player.cpp
Under CbasePlayer::ClientCommand
else if ( stricmp( cmd, "primaryweapon" ) == 0 ) // chase next player
{
const char *szPrimeWep = engine->Cmd_Argv(1);
m_vEquipmentList.AddToTail(szPrimeWep);
}
On 6/14/06, Gregor Brunmar <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> How do I execute a server command from a VGUI button press for example?
> The OnCommand() in the panel is client side and I would like to know how
> for example CS:S do with their buying system?
>
> Thanks in advance,
> Gregor Brunmar
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
--
- Benjamin Davison
--
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders