slot = offset
오프셋코드는 맨밑에 있습니다.
stock GetWeaponAmmo(client, slot) // Ammo (여분탄창)의 수를 구함.
{
new ammoOffset = FindSendPropInfo("CCSPlayer", "m_iAmmo");
return GetEntData(client, ammoOffset+(slot*4));
}
stock SetWeaponAmmo(client, slot, ammo) // Ammo의 수를 설정.
{
new ammoOffset = FindSendPropInfo("CCSPlayer", "m_iAmmo");
return SetEntData(client, ammoOffset+(slot*4), ammo);
}
stock GetPrimaryAmmo(client, weap) // Primary(주무기) Ammo를 구함.
{
//new myweapons = FindSendPropInfo("CCSPlayer", "m_hMyWeapons");
//new weap = GetEntDataEnt2(client, myweapons+ (slot*4));
if(IsValidEntity(weap))
return GetEntData(weap, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"));
return 0;
}
stock SetPrimaryAmmo(client, weap, ammo) Primary(주무기) Ammo를 설정.
{
//new myweapons = FindSendPropInfo("CCSPlayer", "m_hMyWeapons");
//new weap = GetEntDataEnt2(client, myweapons+ (slot*4));
if(IsValidEntity(weap))
return SetEntData(weap, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), ammo);
return 0;
}
//////////////////////////////////////////////////////////// 여기 까지가 함수들.
// 수류탄은 이렇습니다:
#define Slot_HEgrenade 11
#define Slot_Flashbang 12
#define Slot_Smokegrenade 13
if(GetPlayerWeaponSlot(client, 3) != -1)
{
if(GetWeaponAmmo(client, Slot_Flashbang) != 0)
{
PlayerItems[client][3][0] = GetWeaponidByName("weapon_flashbang");
PlayerItems[client][3][1] = GetWeaponAmmo(client, Slot_Flashbang);
}
else
{
PlayerItems[client][3][0] = -1;
PlayerItems[client][3][1] = 0;
}
if(GetWeaponAmmo(client, Slot_HEgrenade) != 0)
{
PlayerItems[client][4][0] = GetWeaponidByName("weapon_hegrenade");
PlayerItems[client][4][1] = GetWeaponAmmo(client, Slot_HEgrenade);
}
else
{
PlayerItems[client][4][0] = -1;
PlayerItems[client][4][1] = 0;
}
if(GetWeaponAmmo(client, Slot_Smokegrenade) != 0)
{
PlayerItems[client][5][0] = GetWeaponidByName("weapon_smokegrenade");
PlayerItems[client][5][1] = GetWeaponAmmo(client, Slot_Smokegrenade);
}
else
{
PlayerItems[client][5][0] = -1;
PlayerItems[client][5][1] = 0;
}
do
{
weaponid = GetPlayerWeaponSlot(client, 3);
if(weaponid != -1)
RemovePlayerItem(client, weaponid);
}while(weaponid != -1);
}
/*
여기부터는 Clip 설명, Clip은 여분탄창이아닌 장착된 탄창수를 조절.
*/
new WeaponIndex = GetEntPropEnt2(Client, Prop_Data, "m_hActiveWeapon");
SetEntProp(WeaponIndex, Prop_Data, "m_iClip1", 999);
// 999 - 총알수
이렇게하면 들고 있는 총을 해버리기땜시 안되고
GetWeaponslot을 WeaponIndex로 삼으면 1번 , 2번 무기 주기 가능.
//////////////////////////////////////////////////////////////////////
Weapon: weapon_ak47 Offset: 2 - Count: 90
Weapon: weapon_aug Offset: 2 - Count: 90
Weapon: weapon_awp Offset: 5 - Count: 30
Weapon: weapon_deagle Offset: 1 - Count: 35
Weapon: weapon_elite Offset: 6 - Count: 120
Weapon: weapon_famas Offset: 3 - Count: 90
Weapon: weapon_fiveseven Offset: 10 - Count: 100
Weapon: weapon_flashbang Offset: 12 - Count: 1
Weapon: weapon_g3sg1 Offset: 2 - Count: 90
Weapon: weapon_galil Offset: 3 - Count: 90
Weapon: weapon_glock Offset: 6 - Count: 120
Weapon: weapon_hegrenade Offset: 11 - Count: 1
Weapon: weapon_m249 Offset: 4 - Count: 200
Weapon: weapon_m3 Offset: 7 - Count: 32
Weapon: weapon_m4a1 Offset: 3 - Count: 90
Weapon: weapon_mac10 Offset: 8 - Count: 100
Weapon: weapon_mp5navy Offset: 6 - Count: 120
Weapon: weapon_p228 Offset: 9 - Count: 52
Weapon: weapon_p90 Offset: 10 - Count: 100
Weapon: weapon_scout Offset: 2 - Count: 90
Weapon: weapon_sg550 Offset: 3 - Count: 90
Weapon: weapon_sg552 Offset: 3 - Count: 90
Weapon: weapon_smokegrenade Offset: 13 - Count: 1
Weapon: weapon_tmp Offset: 6 - Count: 120
Weapon: weapon_ump45 Offset: 8 - Count: 100
Weapon: weapon_usp Offset: 8 - Count: 100
Weapon: weapon_xm1014 Offset: 7 - Count: 32