SA-MP Forums Archive
Reset Weapon Data - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Reset Weapon Data (/showthread.php?tid=550158)



Reset Weapon Data - hoangtn219 - 11.12.2014

Hi everyone. My system is used ammunition. There are 2 errors when using this system. Example: I have a border with 24/7 Deagle member. When I shot all my escape or to a car, I would have to import Deagle with bullets as on






Re: Reset Weapon Data - Mic_H - 11.12.2014

Are you trying to say:
Your server has members who use deagle 24/7 and you want to reset their weapon when they enter a vehicle and set the ammo back to the number with which they entered the vehicle when they exit?


Re: Reset Weapon Data - hoangtn219 - 11.12.2014

I come from Vietnam. My English is very poor. Expect sympathy


Re: Reset Weapon Data - Mic_H - 11.12.2014

PHP Code:
#include <a_samp>
new WeaponAmmo[MAX_PLAYERS];
public 
OnPlayerEnterVehicle(playeridvehicleid)
{
    new 
weapons[2];
    
GetPlayerWeaponData(playerid2weapons[0], weapons[1]);
    
WeaponAmmo[playerid]=weapons[1];
    
ResetPlayerWeapons(playerid);
    return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    
GivePlayerWeapon(playerid24WeaponAmmo[playerid]);
}
public 
OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    if(
weaponid==24 &&GetPlayerAmmo(playerid)<=7)
    {
        
SetPlayerAmmo(playerid24100);
    }




Re: Reset Weapon Data - hoangtn219 - 11.12.2014

Thank you, I will try your example


Re: Reset Weapon Data - hoangtn219 - 11.12.2014

I've tried. The code you help me inactivity. I'm in the car, bullets in the gun was returned to the original.Who can help me this problem ?


Re: Reset Weapon Data - hoangtn219 - 12.12.2014

Help me