GModRP drop money on death?

I’m pretty much remaking GModRP into Gangsta RP and wanted to know how would I make It so when a person Is killed they drop like $10-$25 pretty much I want it to drop random cash from 1-25 and when its dropped it glows green pretty much line in the GTA series. Could someone script this or tell me how I would script this and post it up here? It would be very much appreciated. :biggrin:

Create a effect, find the function for playerdeath, Then create the entity on the death with ENT.Create(" ")
Then use Math.Random to stand for the amount of cash, use math.clamp to set the NWFloat for money.

Can you give me an example of what it would look like If I just wanted it to give the player 1-25$ for killing another person and the ent name is tehmoneylol?

Does anyone know how I would do this?

Look at the examples for how to make a scripted entity yourself: http://wiki.garrysmod.com/?title=Category:Lua:Articles:Scripted_Entities

This hook is called when a player dies: http://wiki.garrysmod.com/?title=Gamemode.DoPlayerDeath
Create the entity at the position of the Victim.

However you do not need a NWFloat as schumacher said, you can just set the value to the entity when you initialise it with math.random such as self.Value = math.random( 25 ). Then when an activator uses the entity (pressing +use (usually e) on the entity) it will give the activator the money (Activator.Money = Activator.Money + self.Value for example.)

As for the effect, you could do it numerous ways. You could simply draw a texture underneath the entity to look like a light is hitting the floor meaning you don’t even have to make a new scripted effect (like how garry makes a circle under your feet in fretta.) Or you could even just do a dynamic light at the position of the money.

In addition, there is a nice ability for adding a few default entity effects (such as pulsating and dimlight) here: http://wiki.garrysmod.com/?title=Entity.AddEffects though you cannot change the colour and the light is always white.

Ok that sounds extremely hard could someone give me an example of what it would look like? the ent name of the money is “tehmoneylol”

It’s easy, if you actually tried you’d see it was quite a small task. If you run into problems just post for more help. You will learn more if you actually attempt things yourself and you will learn quicker and enjoy the reward of finishing something.

Edit:
If a task seems too daunting then split it into small bullet points and do one at a time.

E.g.

  • Create a sent and set it a model. It does nothing special yet.
  • Make one spawn where a player dies.
  • Make it so if you +use the entity, it prints something to the chat/console and then self removes.
  • Change the previous point to give a person 1 - 25 dollars on use.
  • Finally figure out what effect you want and implement it.

The problem is I don’t know any of the functions that do that… =\ that’s why I need an example.

[editline]08:11PM[/editline]
How would I just make this command execute on player death “gm_rp_dropcash 1”

Then use the wiki, we’re not here to do all of your work for you. If we were, we’d be asking for x amount of money per hour.

I linked you to pretty much everything you needed in my earlier post.

I got it working for him, no need to post here anymore.