예제 #1
0
// createCheckpoint(type, x, y, z, targetx, targety, targetz, radius)
SQInteger CCheckpointNatives::Create(SQVM * pVM)
{
	SQInteger iType;
	CVector3 vecPosition;
	CVector3 vecTargetPosition;
	float fRadius;
	sq_getinteger(pVM, -8, &iType);
	sq_getvector3(pVM, -7, &vecPosition);
	sq_getvector3(pVM, -4, &vecTargetPosition);
	sq_getfloat(pVM, -1, &fRadius);
	sq_pushentity(pVM, g_pCheckpointManager->Add(iType, vecPosition, vecTargetPosition, fRadius));
	return 1;
}
예제 #2
0
// actorWalkToCoordinatesForPlayer(playerid, actorid, x, y, z)
SQInteger CActorNatives::WalkToCoordinates(SQVM * pVM)
{
	EntityId playerId;
	EntityId actorId;
	CVector3 vecPosition;
	SQInteger iType;
	sq_getentity(pVM, -6, &playerId);
	sq_getentity(pVM, -5, &actorId);
	sq_getvector3(pVM, -4, &vecPosition);
	sq_getinteger(pVM, -1, &iType);

	if(g_pPlayerManager->DoesExist(playerId))
	{
		CBitStream bsSend;
		bsSend.Write(actorId);
		bsSend.Write(vecPosition);
		bsSend.Write((int)iType);
		g_pNetworkManager->RPC(RPC_ScriptingActorWalkToCoordinates, &bsSend, PRIORITY_HIGH, RELIABILITY_RELIABLE_ORDERED, playerId, false);
		sq_pushbool(pVM, true);
		return 1;
	}

	sq_pushbool(pVM, false);
	return 1;
}
예제 #3
0
int CVehicleNatives::Create(SQVM * pVM)
{
	int iVehicleId;
	CVector3 vecPos, vecRot;
	sq_getinteger(pVM, -7, &iVehicleId);
	sq_getvector3(pVM, -6, &vecPos);
	sq_getvector3(pVM, -3, &vecRot);
	CVehicle * pVehicle = g_pServer->GetVehicleManager()->Add(iVehicleId);
	if(pVehicle)
	{
		pVehicle->SetPosition(vecPos);
		pVehicle->SetRotation(vecPos);
		pVehicle->SpawnForWorld();
		sq_pushentity(pVM, pVehicle);
	}
	sq_pushnull(pVM);
	return 1;
}
예제 #4
0
// createActor(modelhash, x, y, z, r)
SQInteger CActorNatives::Create(SQVM * pVM)
{
	SQInteger iModelId;
	CVector3 vecPosition;
	float fHeading;
	sq_getinteger(pVM, -5, &iModelId);
	sq_getvector3(pVM, -4, &vecPosition);
	sq_getfloat(pVM, -1, &fHeading);
	sq_pushentity(pVM, g_pActorManager->Create(iModelId, vecPosition, fHeading));
	return 1;
}
예제 #5
0
// setPickupRotation(Pickupid, x, y, z)
SQInteger CPickupNatives::SetRotation(SQVM * pVM)
{
	SQInteger pickupid;
	sq_getinteger(pVM, 2, &pickupid);
	if(g_pPickupManager->DoesExist(pickupid))
	{
		CVector3 vecPosition;
		sq_getvector3(pVM, 3, &vecPosition);
		sq_pushbool(pVM, g_pPickupManager->SetRotation(pickupid, vecPosition));
		return 1;
	}
	sq_pushbool(pVM, false);
	return 1;
}
예제 #6
0
int CVehicleNatives::SetPosition(SQVM * pVM)
{
	CVehicle * pVehicle = sq_tovehicle(pVM, 2);

	if(pVehicle)
	{
		CVector3 vecPos;
		sq_getvector3(pVM, 3, &vecPos);
		pVehicle->SetPosition(vecPos);
		sq_pushbool(pVM, true);
	}
	else
		sq_pushnull(pVM);

	return 1;
}
예제 #7
0
// setActorCoordinates(actorid, x, y, z)
SQInteger CActorNatives::SetCoordinates(SQVM * pVM)
{
	EntityId actorId;
	CVector3 vecPosition;
	sq_getentity(pVM, -4, &actorId);
	sq_getvector3(pVM, -3, &vecPosition);

	if(g_pActorManager->DoesExist(actorId))
	{
		g_pActorManager->SetPosition(actorId, vecPosition);
		sq_pushbool(pVM, true);
		return 1;
	}

	sq_pushbool(pVM, false);
	return 1;
}
예제 #8
0
// setCheckpointTargetPosition(checkpointid, targetposition)
SQInteger CCheckpointNatives::SetTargetPosition(SQVM * pVM)
{
	EntityId checkpointId;
	CVector3 vecTargetPosition;
	sq_getentity(pVM, -4, &checkpointId);
	sq_getvector3(pVM, -3, &vecTargetPosition);
	CCheckpoint * pCheckpoint = g_pCheckpointManager->Get(checkpointId);

	if(pCheckpoint)
	{
		pCheckpoint->SetTargetPosition(vecTargetPosition);
		sq_pushbool(pVM, true);
		return 1;
	}

	sq_pushbool(pVM, false);
	return 1;
}