View Single Post
GoldNux
Senior Member
Join Date: Mar 2018
Old 05-18-2018 , 08:19   Re: [HELP] Run time error 10 (cs_set_weapon_ammo)
Reply With Quote #6

Quote:
Originally Posted by CrazY. View Post
Honestly I have not seen anything informing to ignore this error on the site that Bugsy given to you...
Well, I am far from a programmer and just starting out.
My plugin works without any issues, and I simply thought that it would return 0 if it didnt find any weapon entity.
There was not much further explanation, I still don't know how to properly check if an entity exists..

Something like this?

PHP Code:
            new ak47Ent;
            new 
glock18Ent;
            new 
uspEnt;
            
ak47Ent find_ent_by_owner(-1"weapon_ak47"id);
            
glock18Ent find_ent_by_owner(-1"weapon_glock18"id);
            
uspEnt find_ent_by_owner(-1"weapon_usp"id);
            if(
pev_valid(ak47Ent))
            {
                
cs_set_weapon_ammo(find_ent_by_owner(-1,"weapon_ak47",id),30)
            }
            if(
pev_valid(glock18Ent))
            {
                
cs_set_weapon_ammo(find_ent_by_owner(-1,"weapon_glock18",id),20)
            }
            if(
pev_valid(uspEnt))
            {
                
cs_set_weapon_ammo(find_ent_by_owner(-1,"weapon_usp",id),12)
            } 
__________________
Try my version of de_dust2, I think it's great and you should check it out!
https://gamebanana.com/mods/83731

Last edited by GoldNux; 05-18-2018 at 08:34.
GoldNux is offline