mirror of
https://github.com/dashr9230/SA-MP.git
synced 2024-12-22 22:47:29 +08:00
[saco] Implement CPlayerPed::GiveWeapon(...)
This commit is contained in:
parent
653f8dcc16
commit
f6211221c4
@ -3,6 +3,8 @@
|
||||
#include "util.h"
|
||||
#include "keystuff.h"
|
||||
|
||||
extern CGame *pGame;
|
||||
|
||||
extern BYTE *pbyteCurrentPlayer;
|
||||
|
||||
//-----------------------------------------------------------
|
||||
@ -47,6 +49,47 @@ CPlayerPed::CPlayerPed()
|
||||
field_2F9 = 0;
|
||||
}
|
||||
|
||||
void CPlayerPed::GiveWeapon(int iWeaponID, int iAmmo)
|
||||
{
|
||||
if(!m_pPed) return;
|
||||
if(!GamePool_Ped_GetAt(m_dwGTAId)) return;
|
||||
|
||||
int iModelID = 0;
|
||||
iModelID = GameGetWeaponModelIDFromWeaponID(iWeaponID);
|
||||
|
||||
if(iModelID == -1) return;
|
||||
|
||||
if(!pGame->IsModelLoaded(iModelID)) {
|
||||
pGame->RequestModel(iModelID);
|
||||
pGame->LoadRequestedModels();
|
||||
while(!pGame->IsModelLoaded(iModelID)) Sleep(1);
|
||||
}
|
||||
|
||||
//ScriptCommand(&give_actor_weapon,this->m_dwGTAId,iWeaponID,iAmmo);
|
||||
|
||||
*pbyteCurrentPlayer = m_bytePlayerNumber;
|
||||
|
||||
GameStoreLocalPlayerWeaponSkills();
|
||||
GameSetRemotePlayerWeaponSkills(m_bytePlayerNumber);
|
||||
|
||||
DWORD dwPedPtr = (DWORD)m_pPed;
|
||||
|
||||
_asm mov ecx, dwPedPtr
|
||||
_asm push 1
|
||||
_asm push iAmmo
|
||||
_asm push iWeaponID
|
||||
_asm mov edx, 0x5E6080
|
||||
_asm call edx
|
||||
|
||||
GameSetLocalPlayerWeaponSkills();
|
||||
|
||||
SetArmedWeapon(iWeaponID, false);
|
||||
|
||||
*pbyteCurrentPlayer = 0;
|
||||
|
||||
//pGame->RemoveModel(iModelID);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------
|
||||
|
||||
void CPlayerPed::SetArmedWeapon(int iWeaponType, bool bUnk)
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "game.h"
|
||||
#include "aimstuff.h"
|
||||
#include "entity.h"
|
||||
|
||||
@ -17,6 +18,7 @@ public:
|
||||
|
||||
WORD GetAmmo();
|
||||
|
||||
void GiveWeapon(int iWeaponID, int iAmmo);
|
||||
void SetArmedWeapon(int iWeaponType, bool bUnk);
|
||||
WEAPON_SLOT_TYPE * GetCurrentWeaponSlot();
|
||||
WEAPON_SLOT_TYPE * FindWeaponSlot(DWORD dwWeapon);
|
||||
|
Loading…
Reference in New Issue
Block a user