SA-MP Forums Archive
Custom Weapon System - 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: Custom Weapon System (/showthread.php?tid=543943)



Custom Weapon System - seanny - 30.10.2014

How would I be able to make a custom weapon system?

Weapons use existing models but have different damages based on the type of gun that they are.

How can I create a system like that? I want to do it myself but if someone could show me a small example, that'd be great.

[Edit]

Heres a video if you don't understand:
https://www.youtube.com/watch?v=K8iMnHZs8aw


Re: Custom Weapon System - Pottus - 30.10.2014

There is a bunch of things you need to do it right there really is no small example because it requires a complete re-work of the way in which damage is issued.

To sum it up quickly.

- You need to set all players to the same team (Hooking SetPlayerTeam() GetPlayerTeam())
- You need to use OnPlayerGiveDamage() to process damage amounts
- You need to use OnPlayerTakeDamage() to process other damage (Car ramming, heliblading, fall damage)
- OnPlayerTakeDamage() is passed directly to OnPlayerGiveDamage()
- Server sided health/armor variables are also required


Re: Custom Weapon System - seanny - 30.10.2014

Thanks mate.


Re: Custom Weapon System - Crayder - 30.10.2014

Quote:
Originally Posted by Pottus
View Post
There is a bunch of things you need to do it right there really is no small example because it requires a complete re-work of the way in which damage is issued.

To sum it up quickly.

- You need to set all players to the same team (Hooking SetPlayerTeam() GetPlayerTeam())
- You need to use OnPlayerGiveDamage() to process damage amounts
- You need to use OnPlayerTakeDamage() to process other damage (Car ramming, heliblading, fall damage)
- OnPlayerTakeDamage() is passed directly to OnPlayerGiveDamage()
- Server sided health/armor variables are also required
Hmm... Yea, I feel like I just asked the same stuff, and it turns out, Pottus was the one to run me through it.

Click me to see additional info on my old situation!


Re: Custom Weapon System - TakeiT - 30.10.2014

OnPlayerTakeDamage, you can change the amount of damage the weapon does.


Re: Custom Weapon System - Pottus - 30.10.2014

@TakeiT - There is a lot of things you need to consider OPTG is only part of this didn't you read my post ?