2 registered members (Akow, tomaslolo),
1,536
guests, and 12
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
function "help"
#392086
01/19/12 00:27
01/19/12 00:27
|
Joined: Nov 2009
Posts: 70
Siwler
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2009
Posts: 70
|
hey guys its me again with the problem, I hope I don't offend anyone by my lack of knowledge in programing. Function add_money() // in next line of code I get syntax error if (cash == 0) {cash_pan, visible = on;} // so I tried it this way if (cash == 0) {cash_pan = VISIBLE;} // I still get syntax error, don't know any other way to fix this. Will anyone help me? here is the full code:
var cash = 0;
function add_money();
function buy_me();
STRING* snipergun_mdl = "snipergun.mdl";
STRING* gotcash_snd = "gotcash.wav";
STRING* spentcash_snd = "spntcash.wav";
BMAP* cash_map = "cashpan.bmp";
/////////////////////////////////////////////
// collects cash from items etc.
FONT* arial_font = "Arial#20b";
PANEL* cash_pan =
{
bmap = cash_map;
digits (40, 22, 4, Arial#20b, 1, cash);
flags = transparent, overlay, refresh, d3d;;
}
action get_cash()
{
set (my, ENABLE_IMPACT);
my.event = add_money;
}
function add_money()
{
wait (1);
if (my.skill1 == 0) {my.skill1 = 20;} // default = 20 bucks
if (cash == 0) {cash_pan, visible = on;}
cash += my.skill1;
snd_play (gotcash_snd, 70, 0);
ent_remove (me);
}
/////////////////////////////////////////////////
action buy_items()
{
set (my, ENABLE_CLICK);
my.event = buy_me;
}
function buy_me()
{
wait (1);
if (event_type != EVENT_CLICK || cash < my.skill1) {return;}
cash -= my.skill1;
snd_play (spentcash_snd, 70, 0);
ent_remove (me);
}
Honesty will get you far, were dishonesty will get you only so far in life.
|
|
|
Re: function "help"
[Re: Siwler]
#392088
01/19/12 00:39
01/19/12 00:39
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
In what language are you coding in, lite-C (*.c) or C-Script (*.wdl)?
flags = transparent, overlay, refresh, d3d;;
There's a ";" too much. Those flags are obsolete, at least refresh and d3d. You combine flags with "|": flags = TRANSLUCENT | OVERLAY; "set" is a macro for entity flags that is declared as follows: #define set(obj,flag) obj.flags |= (flag) ENABLE_IMPACT is an emask flag, not flags (see manual). That means you have to write your own macro or set the flag as follows: my.emask |= ENABLE_CLICK; Replace
if (cash == 0) {cash_pan, visible = on;}
with
if (cash == 0) { set(cash_pan,SHOW); }
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: function "help"
[Re: Superku]
#392090
01/19/12 01:09
01/19/12 01:09
|
Joined: Nov 2009
Posts: 70
Siwler
OP
Junior Member
|
OP
Junior Member
Joined: Nov 2009
Posts: 70
|
Thank you for clearing all that out for me I no longer get syntax errors.
But code don't work for me, have to see why.
Honesty will get you far, were dishonesty will get you only so far in life.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|