Get Player Weapons, before and after a cmd..
#1

Hello everyone, so basically my problem is that I need the guns a player wears to save before he uses a cmd, and after 20 seconds (I've a settimerex), they shall return to his hands. How can I do that? Thanks in advance.
Reply
#2

Maybe just use OnPlayerUpdate ?
Reply
#3

Quote:
Originally Posted by [EnErGyS]KING
Посмотреть сообщение
Maybe just use OnPlayerUpdate ?
Yeah, well if you could explain a bit, it's my 2nd week scripting actually..
Reply
#4

Quote:
Originally Posted by CesarLT
Посмотреть сообщение
Hello everyone, so basically my problem is that I need the guns a player wears to save before he uses a cmd, and after 20 seconds (I've a settimerex), they shall return to his hands. How can I do that? Thanks in advance.
You mean disarm player then reset his weapons after 20 seconds?
Or do a command to see a player's weps?
Reply
#5

Quote:
Originally Posted by iFiras
Посмотреть сообщение
You mean disarm player then reset his weapons after 20 seconds?
Or do a command to see a player's weps?
I mean, that once he uses a cmd, (already scripted one), his weapons shall save and reset, and in 20 seconds, (also scripted), they shall return..how can I do that?
Reply
#6

When the player uses that command, use GetPlayerWeaponData to get the weapons and store them to an array. Then reset the player's weapon (if you want) and set the timer. When the timer's callback will be called, use loop again (like the example of GetPlayerWeaponData) and use GivePlayerWeapon instead. As the weaponid and ammo for parameters, you need to use the array (the index is the number of the loop).
Reply
#7

Just like I said use "OnPlayerUpdate"
and then save weapon.
http://pastebin.com/TaD5miwQ (not mine)
Reply
#8

Aww they did for you already -_-
Reply
#9

Quote:
Originally Posted by [EnErGyS]KING
Посмотреть сообщение
Just like I said use "OnPlayerUpdate"
and then save weapon.
http://pastebin.com/TaD5miwQ (not mine)
OnPlayerUpdate is called every 2-3 seconds per player (can and will change each time) as far as I know, you'd have to make a 20 second timer instead. OnPlayerUpdate is good for anti-money hacks, i.e. use a variable to store money and then just reset the player money there, and give them the variable money.
Reply
#10

Quote:
Originally Posted by DanishHaq
Посмотреть сообщение
OnPlayerUpdate is called every 2-3 seconds per player (can and will change each time) as far as I know, you'd have to make a 20 second timer instead. OnPlayerUpdate is good for anti-money hacks, i.e. use a variable to store money and then just reset the player money there, and give them the variable money.
It is called even more frequently than you said, more than 10 calls per second.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)