Re: Is it possible to create a "I'm reloading!" alert? [message #432690 is a reply to message #432688] |
Tue, 13 July 2010 10:40 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma:
|
General (3 Stars) |
|
|
All of what you mentioned is possible, although I do not know if there is an appropriate sound in renegade's always.dat to play.
For the script, you could make something like...
semi-psuedocode
bool is_reloading(){ //shitty hack tbh
if loaded ammo value equals 0 and clip contains more bullets{
return true;
}
else{
return false;
}
}
Then you'd have to call that function over and over every second or so on each player. It's a hack really, and not too pretty, but it would work.
If it returned true, then you'd play the sound at the players bone, so it gave the ranged effect you're after, and then make the server type the chat out from their character.
You'd also have to add some padding around the function so if it returned true, it didn't do the check for a little while (as it could potentially return true several times before they've finished reloading if the weapons takes a long time to reload, and you're checking it every 1 second.
However, this would only work when the player runs out of bullets and is forced to reload, not when they manually reload (unless you altered the function to see if the currently loaded amount of bullets increased, although that was triger after the event has happened and not exactly useful).
To be fair, there's most likely a better way to do it, some sort of hook that gets called for when a player is reloading, but I have no experience or knowledge to offer on this.
[Updated on: Tue, 13 July 2010 11:03] Report message to a moderator
|
|
|