Raised This Month: $ Target: $400
 0% 

Money system


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 12-24-2005 , 20:56   Money system
Reply With Quote #1

How would you code a money system? In a way, such as If when you kill someone, you will recieve a dollar or something. Also, using that to buy specials, such as low gravity for example.
Unidentified is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 12-24-2005 , 21:36  
Reply With Quote #2

Use the deathmsg event and give the killer set the killers money to the killers money + 1 dollar.

Later on... make a menu with the reward options, and check if the player has enough money for each reward.
Peli is offline
Send a message via MSN to Peli
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 12-24-2005 , 23:01  
Reply With Quote #3

Quote:
Originally Posted by Peli
Use the deathmsg event and give the killer set the killers money to the killers money + 1 dollar.

Later on... make a menu with the reward options, and check if the player has enough money for each reward.
My thoughts precisely. But I am wondering how.
Unidentified is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 12-24-2005 , 23:28  
Reply With Quote #4

Quote:
cs_get_user_money
cs_set_user_money
register_event use the DeathMsg event.
to start you off you use those functions
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 12-25-2005 , 00:13  
Reply With Quote #5

It Isn't going to be for Counter-Strike.
Unidentified is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 12-25-2005 , 01:50  
Reply With Quote #6

Well I don't see any other money functions... so what you could also do is make it up.

Code:
new money = x // what you want it set at
Code:
// on menus... case 0: {    // code...    money-- // decrement }

Correct me if I'm thinking of an invalid way.
Peli is offline
Send a message via MSN to Peli
VEN
Veteran Member
Join Date: Jan 2005
Old 12-25-2005 , 11:41  
Reply With Quote #7

You need an array: new money[maxplayers] or new money[maxplayers + 1]
VEN is offline
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 12-25-2005 , 11:48  
Reply With Quote #8

Um, I'm still kinda lost.
Unidentified is offline
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 12-25-2005 , 16:27  
Reply With Quote #9

Quote:
Originally Posted by VEN
You need an array: new money[maxplayers] or new money[maxplayers + 1]
Yea that's what I was thinking, you could also do...
Code:
// global new Money[33]

Quote:
Originally Posted by Unidentified
Um, I'm still kinda lost. :Shocked:
We mean you can do it in many ways, but your easiest option is...

1. Make a deathmsg event to catch whenever the killer (read_data(1)) kills the victim (read_data(2)) and give him a money reward, like this:
Code:
money[id]+5

2. Then you can make a menu that is accessed by a client command registered in your public plugin_init(), the easist way to make a menu, I'd say is, follow this: XeroBlood's Menu Tutorial

And in your menu code for the cases, (using case 0 (the first one as an example)) you can do the code like this:
Code:
case 0: {    // code for that option, example giving hp: set_user_health()    money[id]-5    // take away 5 dollars after the use... }
Peli is offline
Send a message via MSN to Peli
Unidentified
Senior Member
Join Date: Aug 2005
Location: Compton, L.A. Thug
Old 12-26-2005 , 23:19  
Reply With Quote #10

Ahh. That helps. But how would I detect If a player killed a player? Also a way to tell the player how much money they have. Also, I'm not familiar with deathmsg.
Unidentified is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode