Raised This Month: $ Target: $400
 0% 

Moneyblock Action, help please!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lukasdaman
Junior Member
Join Date: Dec 2009
Old 09-28-2012 , 09:47   Moneyblock Action, help please!
Reply With Quote #1

This is the actioncode I'm using made by Carlen20:

ActionMoney(id, ent)
{
if ( cs_get_user_team(id) == CS_TEAM_T )
{
if ( !g_cash_used[id] )
{
emit_sound(id, CHAN_STATIC, g_sound_money, 1.0, ATTN_NORM, 0, PITCH_NORM);
new property[5];
GetProperty(ent, 1, property);

cm_set_user_cash(id, cm_get_user_cash(id) + str_to_num(property));
cm_cash_used[id] = true;

set_hudmessage(0, 255, 0, 0.01, 0.18, 0, 0.0, 1.0, 0.25, 0.25, 2);
show_hudmessage(id, "You got %i more Money!", str_to_num(property));
}
}

But I get this error when compiling:

/tmp/textDEjy2S.sma(2083) : error 017: undefined symbol "g_cash_used"
/tmp/textDEjy2S.sma(2083) : warning 215: expression has no effect
/tmp/textDEjy2S.sma(2083) : error 001: expected token: ";", but found "]"
/tmp/textDEjy2S.sma(2083) : error 029: invalid expression, assumed zero
/tmp/textDEjy2S.sma(2083) : fatal error 107: too many error messages on one line

Compilation aborted.
4 Errors.

Anyone got the brainpower I don't have to fix it?


If it's of any use I use these natives:

native cm_get_user_cash(client);

native cm_set_user_cash(client, cash);

stock cm_add_user_cash(client, cash)
{
return cm_add_user_cash(client, cm_get_user_cash(client) + cash);
}
stock cm_sub_user_cash(client, cash)
{
return cm_set_user_cash(client, cm_get_user_cash(client) - cash);
}
lukasdaman is offline
matsi
Thinkosaur
Join Date: Sep 2006
Old 09-28-2012 , 13:33   Re: Moneyblock Action, help please!
Reply With Quote #2

You have two booleans on that function.

Code:
ActionMoney(id, ent) {     if ( cs_get_user_team(id) == CS_TEAM_T )     {         if ( !g_cash_used[id] )         {             emit_sound(id, CHAN_STATIC, g_sound_money, 1.0, ATTN_NORM, 0, PITCH_NORM);             new property[5];             GetProperty(ent, 1, property);                         cm_set_user_cash(id, cm_get_user_cash(id) + str_to_num(property));             cm_cash_used[id] = true;                         set_hudmessage(0, 255, 0, 0.01, 0.18, 0, 0.0, 1.0, 0.25, 0.25, 2);             show_hudmessage(id, "You got %i more Money!", str_to_num(property));         }     } }

Use one of them not both. Either create new bool:g_cash_used[ 33 ]; or use that cm_cash_used[ .. ];

( You get that error because you haven't created g_cash_used )
__________________

Accepting all kinds of requests via private message.

Last edited by matsi; 09-28-2012 at 13:34.
matsi is offline
lukasdaman
Junior Member
Join Date: Dec 2009
Old 09-28-2012 , 14:32   Re: Moneyblock Action, help please!
Reply With Quote #3

Fixed. Thanks.
lukasdaman 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 08:21.


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