This topic was marked solved by Sebastian, on April 19th, 2020, 03:07 PM

habi

  • Sr. Member
  • Posts: 281
ammo problem
«  »
hi when entering a vehicle, change weapon to driveby type. this is the idea.

Code: [Select]
function onPlayerEnterVehicle( player, vehicle, door )
{
local wepid = player.GetWeaponAtSlot( 5);
local ammo =  player.GetAmmoAtSlot(5);
if(wepid != 0 )player.SetWeapon( wepid, ammo );
}
but this is not working correctly in game, the ammo increases when entering vehicle.

DarkRaZoR^

  • Full Member
  • VC:MP Battlefield Head Developer/KF Leader
  • Posts: 226
Re: ammo problem
« Reply #1,  »
Try adding that code inside that VC:MP callback to onPlayerEnteringVehicle.

Athanatos

  • Hero Member
  • Throwing random words to increase my post counter
  • Posts: 1,019
Re: ammo problem
« Reply #2,  »
Try player.SetWeapon(wepid,0)
Developer of RCNR, Zombie Survival, VLSM(C++) and Infected City Survival

habi

  • Sr. Member
  • Posts: 281
Re: ammo problem
« Reply #3,  »Last edited
guys first of all, i left the problem. ie. what to us if the poorplayer get little ammo

and i think it was problem with bug.
Quote from DarkRaZoR^ on February 9th, 2020, 01:27 AM
Try adding that code inside that VC:MP callback to onPlayerEnteringVehicle.
tried and found not working still
Quote from Athanatos on February 9th, 2020, 11:32 AM
Try player.SetWeapon(wepid,0)
if we do that, weapon itself gone.

bug, i mean, with vcmp
ie. player.GetAmmoAtSlot

Sebastian

  • VC:MP Beta Tester
  • Something like this: hga hga hga
  • Posts: 1,173
Re: ammo problem
« Reply #4,  »
I faced this problem too, and yeah - seems like we cannot get the ammo of player's weapon while in a car.
But I think this was happening only for passengers - don't know about driver.

Xmair

  • Wiki Contributor
  • Posts: 953
Re: ammo problem
« Reply #5,  »Last edited
Code: [Select]
player.Slot = 5;

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD