Quantcast

Jump to content

» «
Photo

Trying to make a 2 player mod, crashes on spawning

No replies to this topic
Zolika1351
  • Zolika1351

    Ladies, hide your titties!

  • Members
  • Joined: 16 Jun 2014
  • Hungary

#1

Posted 23 August 2017 - 07:54 PM Edited by Zolika1351, 23 August 2017 - 07:54 PM.

Here's the current code:

void CustomFiberThread::RunScript()
{
	// This is a fiber thread, so we use an loop to run the contents of this script.
	// The thread will terminate when we return from this function.
	Ped Player2_Ped;
	Blip Player2_Blip;
	Vector3 Player2_BlipCoords;
	while(IsThreadAlive())
	{
		if ((GetAsyncKeyState(VK_F8) & 1) != 0)
		{
			f32 x;
			f32 y;
			f32 z;
			Ped PlayerChar;
			GetPlayerChar(GetPlayer(), &PlayerChar);
			GetCharCoordinates(PlayerChar, &x, &y, &z);
			LogInfo("Player 2 Spawned");
			CreateChar(1, MODEL_M_Y_MULTIPLAYER, x, y, z, &Player2_Ped, true);
			AddBlipForChar(Player2_Ped, &Player2_Blip);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_FACE, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_UPPER, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_LOWER, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_SUSE, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_HAND, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_FEET, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_JACKET, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_HAIR, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_SUS2, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_TEEF, 0, 0);
			SetCharComponentVariation(Player2_Ped, PED_COMPONENT_HEAD, 0, 0);
		}
		// Call Wait() so we can process other scripts/game code
		// You must call Wait(...) in your loop code for a fiber thread!
		if (IsButtonPressed(1, BUTTON_Y) != false);
		{
			GetBlipCoords(Player2_Blip, &Player2_BlipCoords);
			TaskEnterCarAsDriver(Player2_Ped, GetClosestCar(Player2_BlipCoords.X, Player2_BlipCoords.Y, Player2_BlipCoords.Z, 100, 0, 69), 10000);
		}

		Wait(10);

	}

}

When I press F8 to load the player, the game crashes. I don't use RequestModel since it's broken on 1.0.8.0 anyway so I just use the Multiplayer - Player Model option and load a bodyguard with Simple Native Trainer, then press F8. It worked before adding the "get in car" option, so it must be that.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users