Reload function.

Discussion in 'Plugin Development' started by CeramicTitan, Nov 11, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    CeramicTitan

    Reload Function: After firing 16 arrows with the shotgun bow it displays a message in chat it sends the player a reload message. When the message is displayed you can not fire after until you have finished 'reloading' if you change the weapon you were on while reload it cancels the reload. You must then change to that weapon again and it will start reloading again. <----- This is a plugin request i need to know how i would do something like this?

    Also how would a add a scatter shot when firing arrows. eg. http://www.youtube.com/watch?v=SOwDg5qQSCY (00:28)
     
  2. use a hashmap and save how manny shots he left
     
  3. Offline

    CeramicTitan

    have you got an example?

    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 9, 2016
  4. Offline

    zachoooo

    You will need to create a delayed task for the reload and create an "isCancelled" variable for the reload.
     
  5. Offline

    CeramicTitan

    but how do i need to know if the bow needs to be reloaded?
     
  6. Offline

    zachoooo

    Like posted above, create a hashmap of players and ammo count. Then when a player attempts to fire, check if they're ammo is greater than 0
     
  7. Offline

    CeramicTitan

    have you got an example?
     
  8. Offline

    tom1000o

    i cant tell if this belongs in the plugin request section or not.. put some code together and be creative, experiment a bit and if you still cant get it post the code here with a more specific question :p
     
    devilquak likes this.
  9. Offline

    zachoooo

    HashMap<String, Integer> hm = new Map<String, Integer>();
     
  10. Offline

    Kodfod

    Map<String, Integer> shots = new HashMap<String, Integer>();
    Map<String, Boolean> reloading = new HashMap<String, Boolean>();

    That will make the HashMaps for you. Then you should do something like the following....

    [​IMG]
     
    devilquak, tom1000o and CeramicTitan like this.
  11. Offline

    CeramicTitan

    Thanks mate! ill try this later!
     
  12. Offline

    tom1000o

    would it be more efficient to use 1 hashmap? <String, Integer, Boolean>
     
  13. Offline

    zachoooo

    Not possible.
     
  14. Offline

    tom1000o

    really? :eek: i thought you could do that. looks like i should do some more research on hashmaps!
     
  15. Offline

    Kodfod

    Take a look at How hashmaps work.
     
    tom1000o likes this.
  16. Offline

    tom1000o

Thread Status:
Not open for further replies.

Share This Page