Raised This Month: $ Target: $400
 0% 

Moneymod for sven co-op


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
styno
Junior Member
Join Date: Oct 2005
Old 04-15-2006 , 23:32   Moneymod for sven co-op
Reply With Quote #1

yo, i wanted to have a money mod for Sven co-op so i started scripting but somthing isn't right....

if you say amx_money you should see:You have YOUR_MONEY_HERE $
Code:
#include <amxmodx> new moneyhave[]=500 public plugin_init()     {     register_plugin("Money Mod","1.00","StYn0!")     register_menucmd(register_menuid("Moneymod Menu"), 1023, "mh_Adminmoneymenu")     register_clcmd("amx_moneymenu", "md_showmoneyMenu", -1, " ")     register_concmd("amx_money", "showmoney", -1, "Show your money") } public showmoney(id)     {     client_print(0,print_chat,"You have %s $",moneyhave)     return PLUGIN_CONTINUE } //end of showmoney /* Menu Admin money menu */ public mh_Adminmoneymenu(id, key) {     new name[32], authid[16]     get_user_name(id, name, 31)     get_user_authid(id, authid, 16)     switch(key) {         //give to 1         case 0: {             client_cmd(id, "localAddmoney(id,100)")         }         //give to all         case 1: {             client_cmd(id, "amx_pbmenu")//not yet         }         //take from 1         case 2: {             client_cmd(id, "amx_pbmenu")//not yet         }             //take from all         case 3: {             client_cmd(id, "amx_pbmenu")//not yet         }     }     return PLUGIN_HANDLED } //end of menu public md_showmoneyMenu(id, level, cid) {     new menu[256]     format(menu, 255, "Moneymod Menu^n^n1. Give money to 1 player^n2. Give money to all players^n3. Take money from 1 player^n4. Take money from all players^n5. Exit")     show_menu(id, ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)), menu)     return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- //This function is the ONLY way this plugin should add/subtract money to a player //There are checks to prevent overflowing //To take money away just send the function a negative (-) number public localAddmoney(id, money) {     if (money > 0 && moneyhave[id] + money < moneyhave[id]) {         moneyhave[id] = 2147483647     }     else if (money < 0 && (moneyhave[id] + money < -1000000 || moneyhave[id] + money > moneyhave[id])) {         moneyhave[id] = -1000000     }     else {         moneyhave[id] += money     } } //end

cheers
__________________
Greetz,
StYn0
---
"Monkey see, monkey do :p"
styno is offline
Goshik
Senior Member
Join Date: Apr 2006
Location: Vilnius
Old 04-16-2006 , 05:57  
Reply With Quote #2

well, it should work ;)

Code:
#include <amxmodx> new moneyhave[]=500 public plugin_init()     {     register_plugin("Money Mod","1.00","StYn0!")     register_menucmd(register_menuid("Moneymod Menu"), 1023, "mh_Adminmoneymenu")     register_clcmd("amx_moneymenu", "md_showmoneyMenu", -1, " ")     register_concmd("amx_money", "showmoney", -1, "Show your money") } public showmoney(id)     {     client_print(0,print_chat,"You have %s $",moneyhave)     return PLUGIN_CONTINUE } //end of showmoney /* Menu Admin money menu */ public mh_Adminmoneymenu(id, key) {     new name[32], authid[16]     get_user_name(id, name, 31)     get_user_authid(id, authid, 16)     switch(key) {         //give to 1         case 0: {             client_cmd(id, "localAddmoney(id,100)")         }         //give to all         case 1: {             client_cmd(id, "amx_pbmenu")//not yet         }         //take from 1         case 2: {             client_cmd(id, "amx_pbmenu")//not yet         }             //take from all         case 3: {             client_cmd(id, "amx_pbmenu")//not yet         }     }     return PLUGIN_HANDLED } //end of menu public md_showmoneyMenu(id, level, cid) {     new menu[256]     format(menu, 255, "Moneymod Menu^n^n1. Give money to 1 player^n2. Give money to all players^n3. Take money from 1 player^n4. Take money from all players^n5. Exit")     show_menu(id, ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)), menu)     return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- //This function is the ONLY way this plugin should add/subtract money to a player //There are checks to prevent overflowing //To take money away just send the function a negative (-) number public localAddmoney(id, money) {     if (money > 0 && moneyhave[id] + money < moneyhave[id]) {         moneyhave[id] = 2147483647     }     else if (money < 0 && (moneyhave[id] + money < -1000000 || moneyhave[id] + money > moneyhave[id])) {         moneyhave[id] = -1000000     }     else {         moneyhave[id] += money     } }
__________________
Check out my rock band Moondust!
http://www.youtube.com/moondustband
Goshik is offline
Send a message via Skype™ to Goshik
styno
Junior Member
Join Date: Oct 2005
Old 04-16-2006 , 17:02  
Reply With Quote #3

When i want to compile it i geth an error:

/home/users/amxmodx/tmp3/phpvJ1dYC.sma(47) : error 037: invalid string (possibly non-terminated string)
/home/users/amxmodx/tmp3/phpvJ1dYC.sma(47 -- 49) : error 001: expected token: ",", but found "-identifier-"
/home/users/amxmodx/tmp3/phpvJ1dYC.sma(49) : warning 217: loose indentation
/home/users/amxmodx/tmp3/phpvJ1dYC.sma(49) : error 017: undefined symbol "player"
/home/users/amxmodx/tmp3/phpvJ1dYC.sma(49) : fatal error 107: too many error messages on one line
__________________
Greetz,
StYn0
---
"Monkey see, monkey do :p"
styno is offline
Goshik
Senior Member
Join Date: Apr 2006
Location: Vilnius
Old 04-16-2006 , 17:09  
Reply With Quote #4

mine compiles fine
Attached Files
File Type: amx money.amx (2.8 KB, 110 views)
File Type: sma Get Plugin or Get Source (money.sma - 560 views - 2.2 KB)
__________________
Check out my rock band Moondust!
http://www.youtube.com/moondustband
Goshik is offline
Send a message via Skype™ to Goshik
styno
Junior Member
Join Date: Oct 2005
Old 04-23-2006 , 10:22  
Reply With Quote #5

When i type amx_money i just see:

you have $

With no numers, i do amx_moneymenu and choose 1(add money)

and i still see

you have $
__________________
Greetz,
StYn0
---
"Monkey see, monkey do :p"
styno is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 04-23-2006 , 10:49  
Reply With Quote #6

change
Code:
client_print(0,print_chat,"You have %s $",moneyhave)
into
Code:
 client_print(0,print_chat,"You have %d $",moneyhave)
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
styno
Junior Member
Join Date: Oct 2005
Old 04-26-2006 , 16:40  
Reply With Quote #7

nope
__________________
Greetz,
StYn0
---
"Monkey see, monkey do :p"
styno is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 04-26-2006 , 17:51  
Reply With Quote #8

try this
Code:
#include <amxmodx> new moneyhave[33]={500,...} public plugin_init() {     register_plugin("Money Mod","1.00","StYn0!")     register_menucmd(register_menuid("Moneymod Menu"), 1023, "mh_Adminmoneymenu")     register_clcmd("amx_moneymenu", "md_showmoneyMenu", -1, " ")     register_concmd("amx_money", "showmoney", -1, "Show your money") } public showmoney(id) {     client_print(id,print_chat,"You have %d $",moneyhave[id])     return PLUGIN_CONTINUE } //end of showmoney /* Menu Admin money menu */ public mh_Adminmoneymenu(id, key) {     new name[32], authid[16]     get_user_name(id, name, 31)     get_user_authid(id, authid, 16)     switch(key)     {         //give to 1         case 0:         {             client_cmd(id, "localAddmoney(id,100)")         }         //give to all         case 1:         {             client_cmd(id, "amx_pbmenu")//not yet         }         //take from 1         case 2:         {             client_cmd(id, "amx_pbmenu")//not yet         }             //take from all         case 3:         {             client_cmd(id, "amx_pbmenu")//not yet         }     }     return PLUGIN_HANDLED } //end of menu public md_showmoneyMenu(id, level, cid) {     new menu[256]     formatex(menu, 255, "Moneymod Menu^n^n1. Give money to 1 player^n2. Give money to all players^n3. Take money from 1" )     format(menu, 255, "%s player^n4. Take money from all players^n5. Exit", menu )     show_menu(id, ((1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)), menu)     return PLUGIN_HANDLED } //---------------------------------------------------------------------------------------------- //This function is the ONLY way this plugin should add/subtract money to a player //There are checks to prevent overflowing //To take money away just send the function a negative (-) number public localAddmoney(id, money) {     if (money > 0 && moneyhave[id] + money < moneyhave[id])     {         moneyhave[id] = 2147483647     }     else if (money < 0 && (moneyhave[id] + money < -1000000 || moneyhave[id] + money > moneyhave[id]))     {         moneyhave[id] = -1000000     }     else     {         moneyhave[id] += money     } }
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
styno
Junior Member
Join Date: Oct 2005
Old 04-27-2006 , 01:46  
Reply With Quote #9

nope, i changed my script to this....

Code:
#include <amxmodx> new moneyhave[33]={500,...} public plugin_init()       {       register_plugin("Money Mod","1.00","StYn0!")       register_clcmd("amx_givemoney", "localmoney",ADMIN_LEVEL_A, "<authid, nick, @team or #userid> <money>")       register_concmd("amx_money", "showmoney", -1, "Show your money")   }   public showmoney(id)       {       client_print(0,print_chat,"You have %d $",moneyhave)       return PLUGIN_CONTINUE   }   //----------------------------------------------------------------------------------------------   //This function is the ONLY way this plugin should add/subtract money to a player   //There are checks to prevent overflowing   //To take money away just send the function a negative (-) number   public localAddmoney(id, money)   {     if (money > 0 && moneyhave[id] + money < moneyhave[id]) {           moneyhave[id] = 2147483647       }       else if (money < 0 && (moneyhave[id] + money < -1000000 || moneyhave[id] + money > moneyhave[id])) {           moneyhave[id] = -1000000       }       else {           moneyhave[id] += money       }   }
__________________
Greetz,
StYn0
---
"Monkey see, monkey do :p"
styno is offline
styno
Junior Member
Join Date: Oct 2005
Old 04-27-2006 , 12:14  
Reply With Quote #10

bump?(i added this code but now i cant even do amx_money anymore )
__________________
Greetz,
StYn0
---
"Monkey see, monkey do :p"
styno 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 05:04.


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