Old 04-06-2009   #1
Leito
Registered User
 
Leito's Avatar
 
Join Date: Jan 2009
Posts: 53
Leito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enough
ScriptHook

Hi. My next topic about animation xD But I else learn and i dont know how to make any animation when i press F10. I found script, but i have error. Anybody help me? This script is in LogInfo("animation");.

Code:
#include "CustomFiberThread.h"
#include "Scripting.h"
#include "../ScriptHook/Log.h"

#include <windows.h>

// Pull in all our scripting functions/types
using namespace Scripting;

CustomFiberThread::CustomFiberThread()
{
	SetName("CustomFiberThread");
}

// Some helper functions

Player CustomFiberThread::GetPlayer()
{
	Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());
	return playerIndex;
}

Scripting::Ped CustomFiberThread::GetPlayerPed()
{
	Ped ped;
	GetPlayerChar(GetPlayer(), &ped);
	return ped;
}


void CustomFiberThread::SpawnCar(eModel model)
{
	RequestModel(model);

	while(!HasModelLoaded(model))
	{
		Wait(0);
	}

	LogInfo("Car model available... spawning it!");

	Ped ped = GetPlayerPed();

	Vehicle vehicle;
	f32 x,y,z;

	GetCharCoordinates(ped, &x, &y, &z);

	CreateCar(model, x, y, z, &vehicle, true);

	MarkModelAsNoLongerNeeded(model);

}

void CustomFiberThread::ChangePlayerSkin(eModel model)
{
	RequestModel(model);

	while(!HasModelLoaded(model))
	{
		Wait(0);
	}

	LogInfo("Skin model available... spawning it!");

	eInteriorRoomKey roomKey;
	
	GetKeyForCharInRoom(GetPlayerPed(), &roomKey);

	ChangePlayerModel(GetPlayer(), model);

	SetRoomForCharByKey(GetPlayerPed(), roomKey);

	MarkModelAsNoLongerNeeded(model);

}

// The real script

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.

	while(IsThreadAlive())
	{

		if ((GetAsyncKeyState(VK_F5) & 1) != 0)
		{
			LogInfo("Spawning a random car");

			Vehicle vehicle;
			u32 modelHash;
			ScriptAny unknown;

			f32 x,y,z;
			GetCharCoordinates(GetPlayerPed(), &x, &y, &z);

			GetRandomCarModelInMemory(1, &modelHash, &unknown);
			CreateCar(modelHash, x, y, z, &vehicle, true);
		}
		else if ((GetAsyncKeyState(VK_F6) & 1) != 0)
		{
			LogInfo("Granting player $1000");

			AddScore(GetPlayer(), 1000);
		}
		else if ((GetAsyncKeyState(VK_F7) & 1) != 0)
		{
			LogInfo("Requested a MODEL_BANSHEE spawn");

			SpawnCar(MODEL_BANSHEE);
		}	
		else if ((GetAsyncKeyState(VK_F8) & 1) != 0)
		{
			LogInfo("Changing the player skin");

			ChangePlayerSkin(MODEL_IG_JOHNNYBIKER);
		}
		else if ((GetAsyncKeyState(VK_F9) & 1) != 0)
		{
			LogInfo("Changing the player skin back to Niko's");

			ChangePlayerSkin(MODEL_PLAYER);
		}




else if ((GetAsyncKeyState(VK_F10) & 1) != 0)
 {
LogInfo("animation");

  m_animName="amb@smoking_spliff";
  m_animSequence="create_spliff";
  speed=4.0f;
  RequestAnims(m_animName);
  anim=1;
  m_State = StateAnim;
  }


case StateAnim:
{
else if (HaveAnimsLoaded(m_animName))
 {
 Ped ped;
 Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());
 GetPlayerChar(playerIndex, &ped);
 TaskPlayAnim(ped,m_animSequence,m_animName,speed,0,0,0,0,-1);
 m_State = StateDefault;
 } 

}
break;



		// Call Wait() so we can process other scripts/game code
		// You must call Wait(...) in your loop code for a fiber thread!
		Wait(100);

	}


}
__________________



My nick on YT - RyderPL
Leito is offline   Reply With Quote
Old 04-06-2009   #2
rappo
Professional Dumbass
 
rappo's Avatar
 
Join Date: Aug 2003
Location: Los Angeles
Posts: 6,944
rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.
Can you paste the actual error that you're getting?
rappo is offline   Reply With Quote
Old 04-06-2009   #3
Leito
Registered User
 
Leito's Avatar
 
Join Date: Jan 2009
Posts: 53
Leito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enough
CustomFiberThread.cpp

Quote:
#include "CustomFiberThread.h"
#include "Scripting.h"
#include "../ScriptHook/Log.h"

#include <windows.h>

// Pull in all our scripting functions/types
using namespace Scripting;

CustomFiberThread::CustomFiberThread()
{
SetName("CustomFiberThread");
}

// The real script
int m_State=0;
int StateAnim = 1;
int StateDefault = 0;
f32 speed = 4.0f;
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.

while(IsThreadAlive())
{
if ((GetAsyncKeyState(VK_F1) & 1) != 0)
{
LogInfo("animation");
RequestAnims("amb@smoking_spliff");
m_State = StateAnim;
}

if(m_State == 1){
if (HaveAnimsLoaded("amb@smoking_spliff")){
Ped ped;
Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());
GetPlayerChar(playerIndex, &ped);
TaskPlayAnim(ped,"create_spliff","amb@smoking_spli ff",speed,0,0,0,0,-1);
m_State = StateDefault;
}
break;
}

// Call Wait() so we can process other scripts/game code
// You must call Wait(...) in your loop code for a fiber thread!
Wait(100);

}


}
Scripting.h

Quote:
#pragma once

#include "../ScriptHook/Scripting.h"

namespace Scripting

TaskPlayAnim();
{

static void TaskPlayAnim(Ped ped, const ch *animSequence, const ch *animName, f32 speed, int loop, f32 x, f32 y, f32 z, int ms) { NativeInvoke::Invoke<scriptVoid>("TASK_PLAY_ANIM", ped, animSequence, animName, speed, loop, x, y, z, ms); }

}
Error

Quote:
1>------ Build started: Project: SampleCustomFiber, Configuration: Debug Win32 ------
1>Compiling...
1>CustomFiberThread.cpp
1>d:\users\leito\desktop\gta iv - pliki\gta iv - mody i pliki\aru c++\samplecustomfiber\scripting.h(7) : error C2061: syntax error : identifier 'TaskPlayAnim'
1>d:\users\leito\desktop\gta iv - pliki\gta iv - mody i pliki\aru c++\samplecustomfiber\scripting.h(8) : error C2447: '{' : missing function header (old-style formal list?)
1>d:\users\leito\desktop\gta iv - pliki\gta iv - mody i pliki\aru c++\samplecustomfiber\customfiberthread.cpp(39) : error C3861: 'TaskPlayAnim': identifier not found
1>Build log was saved at "file://d:\Users\Leito\Desktop\GTA IV - Pliki\GTA IV - Mody i Pliki\aru C++\SampleCustomFiber\Debug\BuildLog.htm"
1>SampleCustomFiber - 3 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 2 up-to-date, 0 skipped ==========
__________________



My nick on YT - RyderPL
Leito is offline   Reply With Quote
Old 04-06-2009   #4
rappo
Professional Dumbass
 
rappo's Avatar
 
Join Date: Aug 2003
Location: Los Angeles
Posts: 6,944
rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.
Your Scripting.h file should look like this:

Code:
#pragma once

#include "../ScriptHook/Scripting.h"

namespace Scripting {
	static void TaskPlayAnim(Ped ped, const ch *animSequence, const ch *animName, f32 speed, int loop, f32 x, f32 y, f32 z, int ms) { NativeInvoke::Invoke("TASK_PLAY_ANIM", ped, animSequence, animName, speed, loop, x, y, z, ms); }
}
The syntax you put isn't correct, so change it to the one I gave above and see if that helps. If not, post the new error it gives!
rappo is offline   Reply With Quote
Old 04-07-2009   #5
Leito
Registered User
 
Leito's Avatar
 
Join Date: Jan 2009
Posts: 53
Leito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enough
Thx, but I was have to added to NativeInvoke::Invoke <ScriptVoid>, because I've got error - "error C2660: 'NativeInvoke::Invoke' : function does not take 10 arguments" I was builded solution and I was copy to game. I was pressed F12, but he don't do anything animation.
__________________



My nick on YT - RyderPL

Last edited by Leito; 04-07-2009 at 07:56 AM..
Leito is offline   Reply With Quote
Old 04-07-2009   #6
rappo
Professional Dumbass
 
rappo's Avatar
 
Join Date: Aug 2003
Location: Los Angeles
Posts: 6,944
rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.
Okay I compiled and ran my own version, and it works. I think the main problem is that you had TaskPlayAnim(..."spli ff") with a space between the spli and ff... you have to make that "spliff" and it might work. But here's my version, and it's working (the only thing is, there's no spliff model, just the smoke, but you have to code in RequestModel if you want the actual thing to appear):

CustomFiberThread.h
Code:
#pragma once

#include "../ScriptHook/NativeFiberThread.h"
#include "../ScriptHook/ScriptingEnums.h"
#include "../ScriptHook/ScriptingTypes.h"

class CustomFiberThread : public NativeFiberThread {
private:
	Scripting::Player GetPlayer();
	Scripting::Ped GetPlayerPed();

	b8 playSpliff;

protected:
	void RunScript();
	void setDefaultValues();
	void Start();

public:
	CustomFiberThread();
};
Scripting.h
Code:
#pragma once

#include "../ScriptHook/Scripting.h"

namespace Scripting {
	static void TaskPlayAnim(Ped ped, const ch *animSequence, const ch *animName, f32 speed, int loop, f32 x, f32 y, f32 z, int ms) { NativeInvoke::Invoke("TASK_PLAY_ANIM", ped, animSequence, animName, speed, loop, x, y, z, ms); }
}
CustomFiberThread.cpp
Code:
#include "CustomFiberThread.h"
#include "Scripting.h"
#include "../ScriptHook/Log.h"

#include <windows.h>

using namespace Scripting;

CustomFiberThread::CustomFiberThread(){
	SetName("Animation");
	setDefaultValues();
}

Player CustomFiberThread::GetPlayer() {
	Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());
	return playerIndex;
}

Scripting::Ped CustomFiberThread::GetPlayerPed() {
	Ped ped;
	GetPlayerChar(GetPlayer(), &ped);
	return ped;
}

void CustomFiberThread::setDefaultValues() {
	playSpliff = false;
}

void CustomFiberThread::Start() {
	setDefaultValues();
	NativeThread::Start();
}

void CustomFiberThread::RunScript() {
	while(IsThreadAlive()) {
		if((GetAsyncKeyState(VK_F12) && 1) != 0) {
			LogInfo("Requesting spliff animation");
			RequestAnims("amb@smoking_spliff");
			playSpliff = true;
		}

		if(playSpliff && HaveAnimsLoaded("amb@smoking_spliff")) {
			LogInfo("Playing spliff animation");
			TaskPlayAnim(GetPlayerPed(), "create_spliff", "amb@smoking_spliff", 4.0f, 0, 0, 0, 0, -1);
			playSpliff = false;
		}

		Wait(100);
	}
}
rappo is offline   Reply With Quote
Old 04-07-2009   #7
Leito
Registered User
 
Leito's Avatar
 
Join Date: Jan 2009
Posts: 53
Leito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enough
wow! rappo, very, very thanks, it works But I don't know why i have to change #include in CustomFiberThread.cpp on #include <windows.h>. It depends on version? I've got Visual C++ 2008, and Scripthook 0.2.3. I thanks one more time.
edit: Last question. How to make script to other animation, example medic.wad, or telescope_idles.wad? I tryed change Spliff on Idles, but don't run.
__________________



My nick on YT - RyderPL

Last edited by Leito; 04-07-2009 at 11:08 AM..
Leito is offline   Reply With Quote
Old 04-07-2009   #8
rappo
Professional Dumbass
 
rappo's Avatar
 
Join Date: Aug 2003
Location: Los Angeles
Posts: 6,944
rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.
Quote:
Originally Posted by Leito View Post
wow! rappo, very, very thanks, it works But I don't know why i have to change #include in CustomFiberThread.cpp on #include . It depends on version? I've got Visual C++ 2008, and Scripthook 0.2.3. I thanks one more time.
sorry that was vBulletin that took it out - I fixed it, youre right it has to be there! I use the same versions as you



And for changing the animation, the best thing to do is use SparkIV to look at other scripts. Since the names of the animations and groups aren't the same as the .wad file, you need to look them up in scripts. You use SparkIV to open the /common/data/cdimages/script.img file, and in there you will see .sco files. Open up the .sco file you want and search around for "TaskPlayAnim" and you'll see the code that you need.

For an example, I looked at Brian's script and it gave me names that I put in the animation (I also changed playSpliff variable to playAnim). This animation makes Niko stand and wave:
Code:
void CustomFiberThread::RunScript() {
	while(IsThreadAlive()) {
		if((GetAsyncKeyState(VK_F12) && 1) != 0) {
			LogInfo("Requesting animation");
			RequestAnims("missbrian_1");
			playAnim = true;
		}

		if(playAnim && HaveAnimsLoaded("missbrian_1")) {
			LogInfo("Playing animation");
			TaskPlayAnim(GetPlayerPed(), "friendly_idle", "missbrian_1", 4.0f, 0, 0, 0, 0, -1);
			playAnim = false;
		}

		Wait(100);
	}
}

If you want to find something specific, you have to think where it might be. Like if you want something related to taxis, you can check "taxi.sco". If you want omething that you remember was in a mission, you can find the mission script.
rappo is offline   Reply With Quote
Old 04-07-2009   #9
Leito
Registered User
 
Leito's Avatar
 
Join Date: Jan 2009
Posts: 53
Leito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enough
O thank you Everything act, if I didn't know something, I will write here, but now thank you ^^
__________________



My nick on YT - RyderPL
Leito is offline   Reply With Quote
Old 05-25-2009   #10
Leito
Registered User
 
Leito's Avatar
 
Join Date: Jan 2009
Posts: 53
Leito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enough
Hi again. I've got the problem. I have now Windows7 and same Visual C++, but in GTA IV patch 1.3. I pasted your scripts, and when i want to save, i've got errors ;c rappo, what's going on?
PS. sry for double.

Code:
1>------ Build started: Project: SampleCustom, Configuration: Debug Win32 ------
1>Compiling...
2>------ Build started: Project: SampleCustomFiber, Configuration: Debug Win32 ------
2>Compiling...
1>CustomThread.cpp
2>CustomFiberThread.cpp
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\scripthook\scripting.h(6) : error C2065: 'Ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\scripthook\scripting.h(6) : error C2146: syntax error : missing ')' before identifier 'ped'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\scripthook\scripting.h(6) : error C2182: 'TaskPlayAnim' : illegal use of type 'void'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\scripthook\scripting.h(6) : error C2059: syntax error : ')'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\scripthook\scripting.h(6) : error C2143: syntax error : missing ';' before '{'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\scripthook\scripting.h(6) : error C2447: '{' : missing function header (old-style formal list?)
2>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\scripthook\scripting.h(6) : error C2653: 'NativeInvoke' : is not a class or namespace name
2>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\scripthook\scripting.h(6) : error C3861: 'Invoke': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(31) : error C2065: 'Ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(31) : error C2146: syntax error : missing ';' before identifier 'ped'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(31) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(32) : error C2065: 'Vehicle' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(32) : error C2146: syntax error : missing ';' before identifier 'vehicle'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(32) : error C2065: 'vehicle' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(34) : error C2065: 'ScriptAny' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(34) : error C2146: syntax error : missing ';' before identifier 'unknown'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(34) : error C2065: 'unknown' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(36) : error C2065: 'Player' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(36) : error C2146: syntax error : missing ';' before identifier 'playerIndex'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(36) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(36) : error C3861: 'ConvertIntToPlayerIndex': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(36) : error C3861: 'GetPlayerId': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(37) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(37) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(37) : error C3861: 'GetPlayerChar': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(40) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(40) : error C3861: 'GetCharCoordinates': identifier not found
2>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustomfiber\customfiberthread.cpp(15) : error C3861: 'ConvertIntToPlayerIndex': identifier not found
2>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustomfiber\customfiberthread.cpp(15) : error C3861: 'GetPlayerId': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(42) : error C2065: 'unknown' : undeclared identifier
2>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustomfiber\customfiberthread.cpp(21) : error C3861: 'GetPlayerChar': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(42) : error C3861: 'GetRandomCarModelInMemory': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(43) : error C2065: 'vehicle' : undeclared identifier
2>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustomfiber\customfiberthread.cpp(38) : error C3861: 'RequestAnims': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(43) : error C3861: 'CreateCar': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(49) : error C2065: 'Player' : undeclared identifier
2>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustomfiber\customfiberthread.cpp(42) : error C3861: 'HaveAnimsLoaded': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(49) : error C2146: syntax error : missing ';' before identifier 'playerIndex'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(49) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(49) : error C3861: 'ConvertIntToPlayerIndex': identifier not found
2>Generating Code...
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(49) : error C3861: 'GetPlayerId': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(50) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(50) : error C3861: 'AddScore': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(58) : error C3861: 'RequestModel': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(69) : error C3861: 'RequestModel': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(80) : error C3861: 'RequestModel': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(90) : error C3861: 'HasModelLoaded': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(94) : error C2065: 'Ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(94) : error C2146: syntax error : missing ';' before identifier 'ped'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(94) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(95) : error C2065: 'Vehicle' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(95) : error C2146: syntax error : missing ';' before identifier 'vehicle'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(95) : error C2065: 'vehicle' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(98) : error C2065: 'Player' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(98) : error C2146: syntax error : missing ';' before identifier 'playerIndex'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(98) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(98) : error C3861: 'ConvertIntToPlayerIndex': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(98) : error C3861: 'GetPlayerId': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(99) : error C2065: 'playerIndex' : undeclared identifier
2>Compiling...
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(99) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(99) : error C3861: 'GetPlayerChar': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(101) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(101) : error C3861: 'GetCharCoordinates': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(103) : error C2065: 'vehicle' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(103) : error C3861: 'CreateCar': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(105) : error C3861: 'MarkModelAsNoLongerNeeded': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(114) : error C3861: 'HasModelLoaded': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(118) : error C2065: 'Player' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(118) : error C2146: syntax error : missing ';' before identifier 'playerIndex'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(118) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(118) : error C3861: 'ConvertIntToPlayerIndex': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(118) : error C3861: 'GetPlayerId': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(121) : error C2065: 'Ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(121) : error C2146: syntax error : missing ';' before identifier 'ped'
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(121) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(123) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(123) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(123) : error C3861: 'GetPlayerChar': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(124) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(124) : error C3861: 'GetKeyForCharInRoom': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(126) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(126) : error C3861: 'ChangePlayerModel': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(128) : error C2065: 'playerIndex' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(128) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(128) : error C3861: 'GetPlayerChar': identifier not found
2>Main.cpp
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(129) : error C2065: 'ped' : undeclared identifier
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(129) : error C3861: 'SetRoomForCharByKey': identifier not found
1>c:\gta iv - pliki\gta iv - mody i pliki\aru c++\gtaivscripthook_0.2.3\samplecustom\customthread.cpp(131) : error C3861: 'MarkModelAsNoLongerNeeded': identifier not found
1>Build log was saved at "file://c:\GTA IV - Pliki\GTA IV - Mody i Pliki\aru C++\GTAIVScriptHook_0.2.3\SampleCustom\Debug\BuildLog.htm"
1>SampleCustom - 81 error(s), 0 warning(s)
2>Generating Code...
2>Build log was saved at "file://c:\GTA IV - Pliki\GTA IV - Mody i Pliki\aru C++\GTAIVScriptHook_0.2.3\SampleCustomFiber\Debug\BuildLog.htm"
2>SampleCustomFiber - 7 error(s), 0 warning(s)
========== Build: 0 succeeded, 2 failed, 1 up-to-date, 0 skipped ==========
__________________



My nick on YT - RyderPL

Last edited by Leito; 05-25-2009 at 02:27 PM..
Leito is offline   Reply With Quote
Old 05-25-2009   #11
rappo
Professional Dumbass
 
rappo's Avatar
 
Join Date: Aug 2003
Location: Los Angeles
Posts: 6,944
rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.
Right click the project you are working on, go to "Project Dependencies" and make sure that "ScriptHook" is checked. Then try to compile again. I'm not sure if that is the exact problem but it looks like it.
__________________
rappo is offline   Reply With Quote
Old 05-26-2009   #12
Leito
Registered User
 
Leito's Avatar
 
Join Date: Jan 2009
Posts: 53
Leito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enough
Don't run. This same error.
__________________



My nick on YT - RyderPL
Leito is offline   Reply With Quote
Old 05-26-2009   #13
rappo
Professional Dumbass
 
rappo's Avatar
 
Join Date: Aug 2003
Location: Los Angeles
Posts: 6,944
rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.
Aight can you post your code? You might be missing a "using namespace Scripting" somewhere.
__________________
rappo is offline   Reply With Quote
Old 05-27-2009   #14
Leito
Registered User
 
Leito's Avatar
 
Join Date: Jan 2009
Posts: 53
Leito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enoughLeito will become famous soon enough
Sure, but this code is this same what you have in post up.

CustomFiberThread.cpp
Code:
#include "CustomFiberThread.h"
#include "Scripting.h"
#include "../ScriptHook/Log.h"

#include <windows.h>

using namespace Scripting;

CustomFiberThread::CustomFiberThread(){
	SetName("Animation");
	setDefaultValues();
}

Player CustomFiberThread::GetPlayer() {
	Player playerIndex = ConvertIntToPlayerIndex(GetPlayerId());
	return playerIndex;
}

Scripting::Ped CustomFiberThread::GetPlayerPed() {
	Ped ped;
	GetPlayerChar(GetPlayer(), &ped);
	return ped;
}

void CustomFiberThread::setDefaultValues() {
	playSpliff = false;
}

void CustomFiberThread::Start() {
	setDefaultValues();
	NativeThread::Start();
}

void CustomFiberThread::RunScript() {
	while(IsThreadAlive()) {
		if((GetAsyncKeyState(VK_F12) && 1) != 0) {
			LogInfo("Requesting spliff animation");
			RequestAnims("amb@smoking_spliff");
			playSpliff = true;
		}

		if(playSpliff && HaveAnimsLoaded("amb@smoking_spliff")) {
			LogInfo("Playing spliff animation");
			TaskPlayAnim(GetPlayerPed(), "create_spliff", "amb@smoking_spliff", 4.0f, 0, 0, 0, 0, -1);
			playSpliff = false;
		}

		Wait(100);
	}
}
Scripting.h
Code:
#pragma once

#include "../ScriptHook/Scripting.h"

namespace Scripting {
	static void TaskPlayAnim(Ped ped, const ch *animSequence, const ch *animName, f32 speed, int loop, f32 x, f32 y, f32 z, int ms) { NativeInvoke::Invoke("TASK_PLAY_ANIM", ped, animSequence, animName, speed, loop, x, y, z, ms); }
}
CustomFiberThread.h
Code:
#pragma once

#include "../ScriptHook/NativeFiberThread.h"
#include "../ScriptHook/ScriptingEnums.h"
#include "../ScriptHook/ScriptingTypes.h"

class CustomFiberThread : public NativeFiberThread {
private:
	Scripting::Player GetPlayer();
	Scripting::Ped GetPlayerPed();

	b8 playSpliff;

protected:
	void RunScript();
	void setDefaultValues();
	void Start();

public:
	CustomFiberThread();
};
__________________



My nick on YT - RyderPL
Leito is offline   Reply With Quote
Old 05-27-2009   #15
rappo
Professional Dumbass
 
rappo's Avatar
 
Join Date: Aug 2003
Location: Los Angeles
Posts: 6,944
rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.rappo is a God.
okay you must be missing the scripthook then. you have to have all these folders in the same place so that they can use the same files. also keep your file names consistent. your errors say error in scripting.h but you have #include "Scripting.h" - make sure youve got the correct capitalization. Don't rename any of the files or folders that aru gave
__________________
rappo is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 08:13 AM.