Jump to content

Gamer_Z

Members
  • Posts

    8
  • Joined

  • Last visited

Gamer_Z's Achievements

Newbie

Newbie (4/54)

0

Reputation

  1. you know that in meantime I did progress very much, I made Pawn4Singleplayer. Nice bump. #not
  2. I'm developing a small project, it's located here: https://gpb.googlecode.com/files/samod2.zip Everything seems to work except I can't loop any vehicles spawned by the GTA engine, any way to loop them?
  3. I tried creating a vehicle. setting the player position works with GetPools()->PedFromRef(1)->SetPos but GetPools()->AddVehicle(,1,1) crashes at this: DWORD dwReturn = 0; // Set Variation 1 before creation. MemSetFast( (void *)VAR_CVehicle_Variation1, ucVariation, 1 ); MemSetFast( (void *)VAR_CVehicle_Variation2, ucVariation2, 1 ); DWORD dwFunc = FUNC_CCarCtrlCreateCarForScript; _asm { push 0 // its a mission vehicle push 0 push 0 push 0 // spawn at 0,0,0 push dwModelID call dwFunc add esp, 0x14 mov dwReturn, eax } at the add esp, 0x14 after call dwFunc call. Why is this happening?
  4. Could someone extract MTA source so everyone can make singleplayer scripts? For example: To make.. something Like a tank with rockets to shoot NPC's ? I tried a few times, but I'm too unfamiliar and it always crashes, has compile errors or plainly doesn't work. Or maybe someone could look why this one is crashing (when hitting Q+P in-game)? : http://www.solidfiles.com/d/8199d80268/
  5. hm ok, do you maybe know how to draw a radar area with the C++ source, a call to GetRadar()->DrawRadarArea seems not enough..
  6. look at the commented lines "bAlreadyInited = true;//": /** * This adds the local player to the ped pool, nothing else * @return BOOL TRUE if success, FALSE otherwise */ BOOL CGameSA::InitLocalPlayer( ) { DEBUG_TRACE("BOOL CGameSA::InitLocalPlayer( )"); // Added by ChrML - Looks like it isn't safe to call this more than once but mod code might do static bool bAlreadyInited = false; if ( bAlreadyInited ) { return TRUE; } //bAlreadyInited = true;//Current MTA Code, wtf is this doing here? CPoolsSA * pools = (CPoolsSA *)this->GetPools (); if ( pools ) { //* HACKED IN HERE FOR NOW *// CPedSAInterface* pInterface = pools->GetPedInterface ( (DWORD)1 ); if ( pInterface ) { pools->AddPed ( (DWORD*)pInterface ); bAlreadyInited = true;//only set to true when local player was succesfully added, right? return TRUE; } return FALSE; } return FALSE; }
  7. Hello everyone, I'm trying to make a simple GTA SA Singleplayer scripting engine thanks to MTA Client Source (extracted game_sa project) but I am having problems. The setmoney stuff etc works, but now I have this (see ProcessTickMain): ////////////////////////////////////////// #include <StdInc.h> ////////////////////////////////////////// #define FUNCTION __declspec(dllexport) HINSTANCE gl_hThisInstance = NULL; HHOOK hHook = NULL; HANDLE hTimer = NULL; HANDLE hTimerQueue = NULL; HANDLE iTimer = NULL; HANDLE iTimerQueue = NULL; VOID CALLBACK ProcessTickMain(PVOID lpParam, BOOLEAN TimerOrWaitFired); VOID CALLBACK InitPlugin(PVOID lpParam, BOOLEAN TimerOrWaitFired); LRESULT CALLBACK KeyHit(int code,WPARAM wParam,LPARAM lParam); #define LocalPed (pGame->GetPools()->GetPedFromRef ( (DWORD)1 )) BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { // to avoid compiler lvl4 warnings LPVOID lpDummy = lpReserved; lpDummy = NULL; switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: gl_hThisInstance = (HINSTANCE)hModule; hTimerQueue = CreateTimerQueue(); if (NULL != hTimerQueue) { if(CreateTimerQueueTimer( &iTimer, hTimerQueue, InitPlugin, NULL , 2000, 0, 0)){} } break; case DLL_PROCESS_DETACH: DeleteTimerQueue(hTimerQueue); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; } VOID CALLBACK InitPlugin(PVOID lpParam, BOOLEAN TimerOrWaitFired) { GetGameInterface(g_pCore); pGame->InitLocalPlayer(); if(CreateTimerQueueTimer( &hTimer, hTimerQueue, ProcessTickMain, NULL , 30, 30, 0)){} hHook = SetWindowsHookEx(WH_KEYBOARD, KeyHit, gl_hThisInstance, GetWindowThreadProcessId((HWND)gl_hThisInstance, NULL)); } VOID CALLBACK ProcessTickMain(PVOID lpParam, BOOLEAN TimerOrWaitFired) { //static bool Inited = false; //if(!Inited) //{ // // Inited = true; //} //if(pGame->IsGameLoaded()) //{ //pGame->GetPlayerInfo()->SetPlayerMoney(100000); if(pGame->GetPools()->GetPedFromRef((DWORD)1)) { pGame->GetPlayerInfo()->SetPlayerMoney((long)pGame->GetPools()->GetPedFromRef((DWORD)1)->GetHealth()); } else { //pGame->InitLocalPlayer(); pGame->GetPlayerInfo()->SetPlayerMoney(0); } //if(0 < Functions::GetPlayerVehicleID() != 0xFFFF) //{ // Functions::SetVehiclePos(Functions::GetPlayerVehicleID(),0.0f,0.0f,30.0f); //} //} } LRESULT CALLBACK KeyHit(int code,WPARAM wParam,LPARAM lParam) { return CallNextHookEx(hHook,code,wParam,lParam); } and it just doesn't want to work.. csh stays at 0 while it should be 100. What am I doing wrong? Edit: oh fixed it, was a bug in the CGameSA::InitializeLocalPlayer function. This is the previous function: BOOL CGameSA::InitLocalPlayer( ) { DEBUG_TRACE("BOOL CGameSA::InitLocalPlayer( )"); // Added by ChrML - Looks like it isn't safe to call this more than once but mod code might do static bool bAlreadyInited = false; if ( bAlreadyInited ) { return TRUE; } bAlreadyInited = true;//we set this to true, no matter what the return will be CPoolsSA * pools = (CPoolsSA *)this->GetPools (); if ( pools ) { //* HACKED IN HERE FOR NOW *// CPedSAInterface* pInterface = pools->GetPedInterface ( (DWORD)1 ); if ( pInterface ) { pools->AddPed ( (DWORD*)pInterface ); return TRUE; } return FALSE; } return FALSE; } and this is my current function: BOOL CGameSA::InitLocalPlayer( ) { DEBUG_TRACE("BOOL CGameSA::InitLocalPlayer( )"); // Added by ChrML - Looks like it isn't safe to call this more than once but mod code might do static bool bAlreadyInited = false; if ( bAlreadyInited ) { return TRUE; } CPoolsSA * pools = (CPoolsSA *)this->GetPools (); if ( pools ) { //* HACKED IN HERE FOR NOW *// CPedSAInterface* pInterface = pools->GetPedInterface ( (DWORD)1 ); if ( pInterface ) { pools->AddPed ( (DWORD*)pInterface ); bAlreadyInited = true;//only true whem added, right? return TRUE; } return FALSE; } return FALSE; }
  8. For exampel to use squirrel, pawn in MTA, the ones I can find are very outdated. and maybe there is a .net plugin for MTA? (i can't find anything). Something like: http://forum.sa-mp.com/showthread.php?t=338735 ?
×
×
  • Create New...