Drakath Posted July 30, 2014 Share Posted July 30, 2014 I have encountered a strange problem. I gave a minigun to a ped: giveWeapon(myPed, 38, 9999, true) And when I tried to make him shoot using setPedControlState he just shot a few bullets and then it looked like he ran out of ammo even though I gave him 9999. I also tried it with a rocket launcher but I only saw him do a shooting animation, no rockets were actually launched. Is this some sort of bug? Is it possible to fix it by scripting? Link to comment
Anubhav Posted July 30, 2014 Share Posted July 30, 2014 Use slothbot resource. It can helpalot. Link to comment
Drakath Posted July 30, 2014 Author Share Posted July 30, 2014 I don't want to use it. Just tell me how to fix it. Link to comment
Drakath Posted July 30, 2014 Author Share Posted July 30, 2014 Never mind, I found a way to fix this. Link to comment
Saml1er Posted July 30, 2014 Share Posted July 30, 2014 Even though you found a solution but tell me tell you the reason why you couldn't see the ped shooting. Since setPedControlState is client side event and only the client can see him shooting. For example, player1 = getRandomPlayer() triggerClientEvent(player1,"onClientControlTrigger", player1) -- Now this event is triggered for player1 only and player1 can only see what's happening ;P Link to comment
DiSaMe Posted July 30, 2014 Share Posted July 30, 2014 Because setPedControlState is client side event and only the client can see him shooting. For example, player1 = getRandomPlayer() triggerClientEvent(player1,"onClientControlTrigger", player1) -- Now this event is triggered for player1 only and player1 can only see what's happening ;P That doesn't make much sense... The reason is that ammo data is only kept as long as the ped is streamed in. If the ped is streamed out after or while the weapon is given (that includes giving the weapon right after ped creation when it's not streamed in yet), then upon streaming in it will only have one bullet. The workaround is to give the weapon again, which can be done using repeatedly executing timer. Edit: oops, didn't notice "Never mind, I found a way to fix this" message. Link to comment
Saml1er Posted July 30, 2014 Share Posted July 30, 2014 Because setPedControlState is client side event and only the client can see him shooting. For example, player1 = getRandomPlayer() triggerClientEvent(player1,"onClientControlTrigger", player1) -- Now this event is triggered for player1 only and player1 can only see what's happening ;P That doesn't make much sense... The reason is that ammo data is only kept as long as the ped is streamed in. If the ped is streamed out after or while the weapon is given (that includes giving the weapon right after ped creation when it's not streamed in yet), then upon streaming in it will only have one bullet. The workaround is to give the weapon again, which can be done using repeatedly executing timer. You're right. That can be the reason, I totally forgot about that. I experienced this problem once with slothbot resource. Link to comment
Moderators IIYAMA Posted July 30, 2014 Moderators Share Posted July 30, 2014 Projectiles must be added manually. createProjectile I tested it with version: 1.3.5 in the past. Maybe it will be added in the future. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now