Comments (4)
CPed is also a CMatrix. Try using the "SetTranslate" method of CMatrix.
https://github.com/DK22Pac/plugin-sdk/blob/master/plugin_vc/game_vc/CMatrix.h#L49
This is actually very different from SA because CPed is not a CMatrix there but has a CMatrixLink pointer as member.
from plugin-sdk.
well i wrote that code and it crashes when i press TAB
the code
#include "plugin_vc.h"
#include <game_vc\CHud.h>
#include <game_vc\CPed.h>
#include <game_vc\CCivilianPed.h>
#include <game_vc\CWorld.h>
#include <game_vc\CPopulation.h>
#include <game_vc\CPedType.h>
#include <game_vc\ePedType.h>
#include <game_vc\CVector.h>
#include <game_vc\CPlayerPed.h>
#include <iostream>
#include <string>
using namespace plugin;
class MyPlugin {
public:
MyPlugin() {
Events::gameProcessEvent += [] {
if (KeyPressed(VK_TAB))
{
const CVector place = CVector::CVector(0.0, 0.0, 0.0);
//CPed *ped = new CCivilianPed(CPopulation::AddPed(ePedType::PEDTYPE_DUMMY, 0, place, 0));
CPed *ped = CPopulation::AddPed(ePedType::PEDTYPE_DUMMY, (unsigned int)0, place, 0);
CWorld::Add(ped);
CHud::SetHelpMessage((unsigned short*)"Done", false, false, true);
}
};
}
} myPlugin;
and can you show a small example about using CMatrix because its confusing
from plugin-sdk.
#include "plugin_vc.h"
#include <game_vc\CHud.h>
#include <game_vc\CPed.h>
#include <game_vc\CCivilianPed.h>
#include <game_vc\CWorld.h>
#include <game_vc\CPopulation.h>
#include <game_vc\CPedType.h>
#include <game_vc\ePedType.h>
#include <game_vc\CVector.h>
#include <game_vc\CPlayerPed.h>
#include <iostream>
#include <string>
using namespace plugin;
class MyPlugin {
public:
MyPlugin() {
Events::gameProcessEvent += [] {
if (KeyPressed(VK_TAB))
{
const CVector place = CVector::CVector(0.0, 0.0, 0.0);
//CPed *ped = new CCivilianPed(CPopulation::AddPed(ePedType::PEDTYPE_CIVMALE, 0, place, 0));
CPed *ped = CPopulation::AddPed(ePedType::PEDTYPE_CIVMALE, (unsigned int)0, place, 0);
CWorld::Add(ped);
CHud::SetHelpMessage((unsigned short*)L"Done", false, false, true);
}
};
}
} myPlugin;
This code should work, I tested it. Regarding CHud class of Vice City, we can hack and use wchar_t mapping to unsigned short. But remember that CHud does not actually support unicode, so be careful. If used wrong it leads to a deadlock.
Also, if you use dxwnd to put Vice City into windowed mode you can attach a debugger to it if your debug ASI is loaded. Then you can put breakpoints into your code. This way you could find out that ped can be NULL sometimes.
from plugin-sdk.
"and can you show a small example about using CMatrix because its confusing"
To answer your last question, here is a player teleportation example that moves you up into the sky when you press/hold Tab key.
#include "plugin_vc.h"
#include "game_vc/common.h"
using namespace plugin;
class MyPlugin {
public:
MyPlugin() {
Events::gameProcessEvent += []()
{
if (KeyPressed(VK_TAB))
{
CPed *player = FindPlayerPed();
if ( player != NULL )
{
CVector oldPos = player->m_placement.pos;
player->m_placement.SetTranslateOnly( oldPos.x, oldPos.y, oldPos.z + 3.0f );
}
}
};
}
} myPlugin;
Please note that CPlacement is a CMatrix. I may have mistakenly said previously that CPed is a CPlacement, but no it just has a member called m_placement (same thing really). So calling player->m_placement.SetTranslateOnly is calling a method of CMatrix.
from plugin-sdk.
Related Issues (20)
- injector::MakeInline modifies the EFLAGS register HOT 1
- Can't build plugin.sln (C2760 Error) [Visual Studio 2019 Community]
- Crash when calling CPlaceable::GetAtDirection()
- Build errors caused by C/C++ preprocessor definitions HOT 1
- Is this error caused because a d3dx9 sdk installation is missing? HOT 2
- Plugin-SDK adaptable for GTA SA mobile version. HOT 1
- VSIX installer error in Visual Studio HOT 3
- GetD3DDevice not work correct
- Compilation error. Visual Studio 2019 HOT 4
- Linux crosscompilation: error due to includes with different casing than the file HOT 2
- GPS example broken due to missing type on GetD3DDevice template function HOT 1
- WN 11 ?? HOT 2
- Error in plugin gen HOT 5
- Recent error while trying to clone HOT 1
- Modifying shadow colors.
- CRoadBlocks::aScriptRoadBlocks address collision HOT 1
- About UE4 GTA game sdk
- Issues with installing(FIXED)
- events don't work
- A lot of errors tryIng to compile and even opening file generated by Generate MyPlugin.bat
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plugin-sdk.