Welcome to Open Carnage

A resource for gamers and technology enthusiasts, with unique means of rewarding content creation and support. Have a wander to see why we're worth the time!


Kavawuvi's weaponvariable.lua



Hope everyone is good.


If and when anyone (particularly @Kavawuvi) gets a spare minute I have a couple of lua script related issues I wanted to ask for your expertise on.


I've been playing with @Kavawuvi's weaponvariable.lua script and have a whole of bunch of useful applications for it on my server - specifically rprinting basic instructions for certain weapons.


For example, I'm rprinting a message when a player picks up the bourrin badass rocket launcher that tells them to hold down fire until the beep noise changes to fire homing rockets.

I know you're probably rolling your eyes, but we must get 20 new school kids joining a day asking HOW?!!! when they get killed by a homing rocket.


So my first question is, rather than using EVENT_ALIVE (which creates a messy/noisy console when rprinting cos it's being called every second) is there an event (or something else) I could use to rprint a message that appears just once?

And is there a way to have it stay on screen until the weapon is no longer being held?


Secondly, would it be possible to create a variable script or achieve the same thing for vehicles?


For example, when a player enters a Falcon, rprint a message telling the player that Q is height lock - and the A + D keys are for strafing - and have the message stay on screen, only to clear when they exit the vehicle.


I guess I could live without the messages staying on screen, but it would be nice if that was achievable.

Thanks for your time and for the help I've received from the open carnage community so far - particularly the scripts I've already used and abused.

Here's a bunch of your stuff in action the other day, cheers



Share this post

Link to post
Share on other sites

Currently, the way to do this is to spam the console with empty messages (newlines, spaces, etc.) before sending your message, and you'd do this a few times a second to ensure it refreshes on the screen quickly.


In Lua, this would look like this:

for i = 1,26 do
    rprint(PlayerIndex, "|n")
rprint(PlayerIndex, "Insert message here")


Or in events.txt, you could put this in your event:

rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "|n";rprint $n "Message"


Tucker933 likes this





Share this post

Link to post
Share on other sites

Thank you - I am already doing something similar. This should give me the extra finesse I was missing.


Any thoughts on whether a variable for vehicles is possible?


Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.