本文整理汇总了C++中CScriptArgReader::ReadEnumStringOrNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ CScriptArgReader::ReadEnumStringOrNumber方法的具体用法?C++ CScriptArgReader::ReadEnumStringOrNumber怎么用?C++ CScriptArgReader::ReadEnumStringOrNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CScriptArgReader
的用法示例。
在下文中一共展示了CScriptArgReader::ReadEnumStringOrNumber方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GiveWeapon
int CLuaPedDefs::GiveWeapon ( lua_State* luaVM )
{
// bool giveWeapon ( ped thePlayer, int weapon [, int ammo=30, bool setAsCurrent=false ] )
CElement* pElement; eWeaponType weaponType; ushort usAmmo; bool bSetAsCurrent;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pElement );
argStream.ReadEnumStringOrNumber ( weaponType );
argStream.ReadNumber ( usAmmo, 30 );
argStream.ReadBool ( bSetAsCurrent, false );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::GiveWeapon ( pElement, weaponType, usAmmo, bSetAsCurrent ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例2: SetWeaponAmmo
int CLuaFunctionDefs::SetWeaponAmmo ( lua_State* luaVM )
{
// bool setWeaponAmmo ( player thePlayer, int weapon, int totalAmmo, [int ammoInClip = 0] )
CElement* pElement;
eWeaponType weaponType;
ushort usAmmo;
ushort usAmmoInClip;
CCustomWeapon * pWeapon = NULL;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pElement );
if ( !argStream.HasErrors () )
{
if ( pElement->GetType () != CElement::WEAPON )
{
argStream.ReadEnumStringOrNumber ( weaponType );
argStream.ReadNumber ( usAmmo );
argStream.ReadNumber ( usAmmoInClip, 0 );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::SetWeaponAmmo ( pElement, weaponType, usAmmo, usAmmoInClip ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
}
else
{
pWeapon = static_cast <CCustomWeapon *> ( pElement );
argStream.ReadNumber ( usAmmo );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::SetWeaponAmmo ( pWeapon, usAmmo ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例3: GetSlotFromWeapon
int CLuaFunctionDefs::GetSlotFromWeapon ( lua_State* luaVM )
{
eWeaponType weaponType;
CScriptArgReader argStream ( luaVM );
argStream.ReadEnumStringOrNumber( weaponType );
if ( !argStream.HasErrors ( ) )
{
char cSlot = CWeaponNames::GetSlotFromWeapon ( weaponType );
if ( cSlot >= 0 )
lua_pushnumber ( luaVM, cSlot );
else
lua_pushboolean ( luaVM, false );
return 1;
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例4: getJetpackWeaponEnabled
int CLuaWorldDefs::getJetpackWeaponEnabled ( lua_State* luaVM )
{
eWeaponType weaponType;
bool bEnabled;
CScriptArgReader argStream ( luaVM );
argStream.ReadEnumStringOrNumber ( weaponType );
if ( !argStream.HasErrors() )
{
if ( CStaticFunctionDefinitions::GetJetpackWeaponEnabled ( weaponType, bEnabled ) )
{
lua_pushboolean ( luaVM, bEnabled );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
lua_pushboolean ( luaVM, false );
return 1;
}
示例5: CreateWeapon
int CLuaFunctionDefs::CreateWeapon ( lua_State* luaVM )
{
CVector vecPos;
eWeaponType weaponType;
CScriptArgReader argStream ( luaVM );
argStream.ReadEnumStringOrNumber ( weaponType );
argStream.ReadNumber ( vecPos.fX );
argStream.ReadNumber ( vecPos.fY );
argStream.ReadNumber ( vecPos.fZ );
if ( !argStream.HasErrors () )
{
CLuaMain* pLuaMain = m_pLuaManager->GetVirtualMachine ( luaVM );
if ( pLuaMain )
{
CResource* pResource = pLuaMain->GetResource ();
if ( pResource )
{
CClientWeapon * pWeapon = CStaticFunctionDefinitions::CreateWeapon ( *pResource, weaponType, vecPos );
if ( pWeapon )
{
CElementGroup * pGroup = pResource->GetElementGroup();
if ( pGroup )
{
pGroup->Add ( ( CClientEntity* ) pWeapon );
}
lua_pushelement ( luaVM, pWeapon );
return 1;
}
}
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage() );
lua_pushboolean ( luaVM, false );
return 1;
}
示例6: TakeWeapon
int CLuaPedDefs::TakeWeapon ( lua_State* luaVM )
{
// bool takeWeapon ( player thePlayer, int weaponId [, int ammo ] )
CElement* pElement; eWeaponType weaponType; ushort usAmmo;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pElement );
argStream.ReadEnumStringOrNumber ( weaponType );
argStream.ReadNumber ( usAmmo, 9999 );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::TakeWeapon ( pElement, weaponType, usAmmo ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
else
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
lua_pushboolean ( luaVM, false );
return 1;
}
示例7: GetOriginalWeaponProperty
int CLuaFunctionDefs::GetOriginalWeaponProperty ( lua_State* luaVM )
{
eWeaponSkill eWepSkill = WEAPONSKILL_STD;
eWeaponType eWep = WEAPONTYPE_UNARMED;
eWeaponProperty eProp = WEAPON_INVALID_PROPERTY;
CScriptArgReader argStream ( luaVM );
argStream.ReadEnumStringOrNumber ( eWep );
argStream.ReadEnumStringOrNumber ( eWepSkill );
argStream.ReadEnumString ( eProp );
if ( !argStream.HasErrors () )
{
switch ( eProp )
{
case WEAPON_WEAPON_RANGE:
case WEAPON_TARGET_RANGE:
case WEAPON_ACCURACY:
case WEAPON_FIRING_SPEED:
case WEAPON_LIFE_SPAN:
case WEAPON_SPREAD:
case WEAPON_MOVE_SPEED:
// Get only
case WEAPON_REQ_SKILL_LEVEL:
case WEAPON_ANIM_LOOP_START:
case WEAPON_ANIM_LOOP_STOP:
case WEAPON_ANIM_LOOP_RELEASE_BULLET_TIME:
case WEAPON_ANIM2_LOOP_START:
case WEAPON_ANIM2_LOOP_STOP:
case WEAPON_ANIM2_LOOP_RELEASE_BULLET_TIME:
case WEAPON_ANIM_BREAKOUT_TIME:
case WEAPON_RADIUS:
{
float fWeaponInfo = 0.0f;
if ( CStaticFunctionDefinitions::GetOriginalWeaponProperty ( eProp, eWep, eWepSkill, fWeaponInfo ) )
{
lua_pushnumber ( luaVM, fWeaponInfo );
return 1;
}
break;
}
case WEAPON_DAMAGE:
case WEAPON_MAX_CLIP_AMMO:
case WEAPON_FLAGS:
case WEAPON_ANIM_GROUP:
case WEAPON_FIRETYPE:
case WEAPON_MODEL:
case WEAPON_MODEL2:
case WEAPON_SLOT:
case WEAPON_AIM_OFFSET:
case WEAPON_SKILL_LEVEL:
case WEAPON_DEFAULT_COMBO:
case WEAPON_COMBOS_AVAILABLE:
{
int sWeaponInfo = 0;
if ( CStaticFunctionDefinitions::GetOriginalWeaponProperty ( eProp, eWep, eWepSkill, sWeaponInfo ) )
{
lua_pushinteger ( luaVM, sWeaponInfo );
return 1;
}
break;
}
case WEAPON_FIRE_OFFSET:
{
CVector vecWeaponInfo;
if ( CStaticFunctionDefinitions::GetOriginalWeaponProperty ( eProp, eWep, eWepSkill, vecWeaponInfo ) )
{
lua_pushnumber ( luaVM, vecWeaponInfo.fX );
lua_pushnumber ( luaVM, vecWeaponInfo.fY );
lua_pushnumber ( luaVM, vecWeaponInfo.fZ );
return 3;
}
break;
}
case WEAPON_FLAG_AIM_NO_AUTO:
case WEAPON_FLAG_AIM_ARM:
case WEAPON_FLAG_AIM_1ST_PERSON:
case WEAPON_FLAG_AIM_FREE:
case WEAPON_FLAG_MOVE_AND_AIM:
case WEAPON_FLAG_MOVE_AND_SHOOT:
case WEAPON_FLAG_TYPE_THROW:
case WEAPON_FLAG_TYPE_HEAVY:
case WEAPON_FLAG_TYPE_CONSTANT:
case WEAPON_FLAG_TYPE_DUAL:
case WEAPON_FLAG_ANIM_RELOAD:
case WEAPON_FLAG_ANIM_CROUCH:
case WEAPON_FLAG_ANIM_RELOAD_LOOP:
case WEAPON_FLAG_ANIM_RELOAD_LONG:
case WEAPON_FLAG_SHOT_SLOWS:
case WEAPON_FLAG_SHOT_RAND_SPEED:
case WEAPON_FLAG_SHOT_ANIM_ABRUPT:
case WEAPON_FLAG_SHOT_EXPANDS:
{
MinServerReqCheck ( argStream, MIN_SERVER_REQ_WEAPON_PROPERTY_FLAG, "flag name is being used" );
if ( !argStream.HasErrors () )
{
bool bEnable;
if ( CStaticFunctionDefinitions::GetOriginalWeaponPropertyFlag ( eProp, eWep, eWepSkill, bEnable ) )
//.........这里部分代码省略.........
示例8: SetWeaponProperty
int CLuaFunctionDefs::SetWeaponProperty ( lua_State* luaVM )
{
// bool setWeaponProperty ( int weaponID/string weaponName, string weaponSkill, string property/int property, int/float theValue )
eWeaponSkill eWepSkill = WEAPONSKILL_STD;
eWeaponType eWep = WEAPONTYPE_BRASSKNUCKLE;
eWeaponProperty eProp = WEAPON_ACCURACY;
CScriptArgReader argStream ( luaVM );
if ( argStream.NextIsUserData () )
{
CCustomWeapon * pWeapon;
eWeaponProperty weaponProperty;
CScriptArgReader argStream ( luaVM );
argStream.ReadUserData ( pWeapon );
argStream.ReadEnumString ( weaponProperty );
if ( !argStream.HasErrors () )
{
if ( weaponProperty == WEAPON_DAMAGE )
{
short sData = 0;
argStream.ReadNumber ( sData );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::SetWeaponProperty ( pWeapon, weaponProperty, sData ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
}
else
{
float fData = 0.0f;
argStream.ReadNumber ( fData );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::SetWeaponProperty ( pWeapon, weaponProperty, fData ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
}
}
if ( argStream.HasErrors () )
m_pScriptDebugging->LogCustom ( luaVM, argStream.GetFullErrorMessage () );
}
else
{
argStream.ReadEnumStringOrNumber ( eWep );
argStream.ReadEnumStringOrNumber ( eWepSkill );
argStream.ReadEnumString ( eProp );
if ( !argStream.HasErrors () )
{
switch ( eProp )
{
case WEAPON_WEAPON_RANGE:
case WEAPON_TARGET_RANGE:
case WEAPON_ACCURACY:
case WEAPON_MOVE_SPEED:
case WEAPON_ANIM_LOOP_START:
case WEAPON_ANIM_LOOP_STOP:
case WEAPON_ANIM_LOOP_RELEASE_BULLET_TIME:
case WEAPON_ANIM2_LOOP_START:
case WEAPON_ANIM2_LOOP_STOP:
case WEAPON_ANIM2_LOOP_RELEASE_BULLET_TIME:
case WEAPON_ANIM_BREAKOUT_TIME:
{
float fWeaponInfo = 0.0f;
argStream.ReadNumber ( fWeaponInfo );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::SetWeaponProperty ( eProp, eWep, eWepSkill, fWeaponInfo ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
break;
}
case WEAPON_DAMAGE:
case WEAPON_MAX_CLIP_AMMO:
case WEAPON_FLAGS:
{
int sWeaponInfo = 0;
argStream.ReadNumber ( sWeaponInfo );
if ( !argStream.HasErrors () )
{
if ( CStaticFunctionDefinitions::SetWeaponProperty ( eProp, eWep, eWepSkill, sWeaponInfo ) )
{
lua_pushboolean ( luaVM, true );
return 1;
}
}
break;
}
case WEAPON_FLAG_AIM_NO_AUTO:
//.........这里部分代码省略.........