本文整理汇总了C++中CVehicle::GetLocked方法的典型用法代码示例。如果您正苦于以下问题:C++ CVehicle::GetLocked方法的具体用法?C++ CVehicle::GetLocked怎么用?C++ CVehicle::GetLocked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVehicle
的用法示例。
在下文中一共展示了CVehicle::GetLocked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLocked
// getVehicleLocked(vehicleid)
int CVehicleModuleNatives::GetLocked(EntityId vehicleId)
{
CVehicle * pVehicle = g_pVehicleManager->GetAt(vehicleId);
if(pVehicle)
{
return pVehicle->GetLocked();
}
return -1;
}
示例2: VehicleEnterExit
void CServerRPCHandler::VehicleEnterExit(CBitStream * pBitStream, CPlayerSocket * pSenderSocket)
{
// Ensure we have a valid bit stream
if(!pBitStream)
return;
EntityId playerId;
if(!pBitStream->ReadCompressed(playerId))
return;
// Check the host
if(playerId != pSenderSocket->GetPlayerId())
return;
// Get the player pointer
CPlayer * pPlayer = g_pPlayerManager->GetAt(playerId);
// Is the player pointer valid?
if(pPlayer)
{
// Read the vehicle entry/exit type
BYTE byteVehicleEntryExitType;
if(!pBitStream->Read(byteVehicleEntryExitType))
return;
// Read the vehicle id
EntityId vehicleId;
if(!pBitStream->ReadCompressed(vehicleId))
return;
// Get the vehicle
CVehicle * pVehicle = g_pVehicleManager->GetAt(vehicleId);
// Does the vehicle not exist?
if(!pVehicle)
return;
// Is this an entry request?
if(byteVehicleEntryExitType == VEHICLE_ENTRY_REQUEST)
{
// Read the seat id
BYTE byteSeatId;
if(!pBitStream->Read(byteSeatId))
return;
bool bReply = true;
// Is the vehicle fully locked?
if(pVehicle->GetLocked() == 1)
bReply = false;
else
{
// Get the reply
CSquirrelArguments arguments;
arguments.push(playerId);
arguments.push(vehicleId);
arguments.push(byteSeatId);
bReply = (g_pEvents->Call("vehicleEntryRequest", &arguments).GetInteger() == 1);
}
// Reply to the vehicle entry request
CBitStream bitStream;
bitStream.WriteCompressed(playerId);
bitStream.WriteBit(bReply);
//-Was the reply ok?
if(bReply)
{
bitStream.Write((BYTE)VEHICLE_ENTRY_RETURN);
bitStream.Write(vehicleId);
bitStream.Write(byteSeatId);
// Set the player state
pPlayer->SetState(STATE_TYPE_ENTERVEHICLE);
}
g_pNetworkManager->RPC(RPC_VehicleEnterExit, &bitStream, PRIORITY_HIGH, RELIABILITY_RELIABLE, INVALID_ENTITY_ID, true);
}
// Is this an entry cancellation?
if(byteVehicleEntryExitType == VEHICLE_ENTRY_CANCELLED)
{
// Read the seat id
BYTE byteSeatId;
if(!pBitStream->Read(byteSeatId))
return;
// Call the event
CSquirrelArguments arguments;
arguments.push(playerId);
arguments.push(vehicleId);
arguments.push(byteSeatId);
g_pEvents->Call("vehicleEntryCancelled", &arguments);
CBitStream bitStream;
bitStream.WriteCompressed(playerId);
bitStream.WriteBit(true);
//.........这里部分代码省略.........