Raised This Month: $ Target: $400
 0% 

arrg, somebody help plz


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tadoom
Junior Member
Join Date: Jan 2007
Old 01-16-2007 , 01:12   arrg, somebody help plz
Reply With Quote #1

I want to replace a cs function (cs_get_user_money) with my own (g_money) but when I go to compile it doesent work. The g_money is from my tfc money plugin.

Last edited by tadoom; 01-16-2007 at 01:50.
tadoom is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-16-2007 , 01:44   Re: arrg, somebody help plz
Reply With Quote #2

We'll need to see your code.

Also, why are you replacing a function? Why not just use it?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
tadoom
Junior Member
Join Date: Jan 2007
Old 01-16-2007 , 01:49   Re: arrg, somebody help plz
Reply With Quote #3

Im not using that function becuase I cant, its a cstrike one and im playing on tfc. I got a tfc money plugin going and I wanted to port the ice grenade plugin to tfc using well... the money plugin I have instead of cs functions I cant use. my code is...

Code:
public moneyforfrags() {  new iPlayers[32],iNum  get_players(iPlayers,iNum)  for(new i=0;i<iNum;i++)  {   new id=iPlayers[i]   if(is_user_connected(id))   {    if(get_user_frags(id)>lastfrags[id])    {     new hv=g_money[id]+=(get_user_frags(id)-lastfrags[id])*5     g_money[id]+=(get_user_frags(id)-lastfrags[id])*5     lastfrags[id]=get_user_frags(id)     client_print(id,print_chat,"You gained $%i.",hv)    }   }  } }

Thats just part of it but it seems like the only part you need.

All the money commands have used g_money
tadoom is offline
tadoom
Junior Member
Join Date: Jan 2007
Old 01-16-2007 , 01:54   Re: arrg, somebody help plz
Reply With Quote #4

oh yeah and the other plugin is....

Code:
 public buy_frostnade(id)  {  if(!get_cvar_num("fn_on"))   return PLUGIN_CONTINUE;  // no custom buy needed  if(get_cvar_num("fn_override"))   return PLUGIN_HANDLED;  // not enough moneh  new money = g_money(id);  if(money < get_cvar_num("fn_price"))  {   client_print(id,print_center,"Not enough money");   return PLUGIN_HANDLED;  }  // already have a frost grenade  if(hasFrostNade[id])  {   client_print(id,print_center,"Already own fs.");   return PLUGIN_HANDLED;  }  // already have a smoke grenade  new weapons[32], num, i;  get_user_weapons(id,weapons,num);  for(i=0;i<num;i++)  {   if(weapons[i] == TFC_WPN_NORMALGRENADE)   {    client_print(id,print_center,"You already own a normal grenade.");    return PLUGIN_HANDLED;   }  }  // gimme gimme  hasFrostNade[id] = 1;  give_item(id,"weapon_normalgrenade");  g_money(id,money - get_cvar_num("fn_price"));  // display icon  message_begin(MSG_ONE,get_user_msgid("StatusIcon"),{0,0,0},id);  write_byte(1); // status (0=hide, 1=show, 2=flash)  write_string("dmg_cold"); // sprite name  write_byte(FROST_R); // red  write_byte(FROST_G); // green  write_byte(FROST_B); // blue  message_end();  return PLUGIN_HANDLED;  }
tadoom is offline
Salepate
Junior Member
Join Date: Jan 2007
Old 01-16-2007 , 02:09   Re: arrg, somebody help plz
Reply With Quote #5

What about g_money ? how can you use :
Code:
public buy_frostnade(id) {     g_money[id]+=(get_user_frags(id)-lastfrags[id])*5;
}
and
Code:
public moneyforfrags() {     g_money(id, money - get_cvar_num("fn_price")); }
at a same time ? Isn't money a function ?

Besides declaring a variable in a loop will generate an error.
Code:
for ( new i = 0 ; i <iNum ; i ++ ) {     new id = iPlayers[i]; }
must be :
Code:
new id; for ( new i = 0 ; i <iNum ; i ++ ) {     id = iPlayers[i]; }
Salepate is offline
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-16-2007 , 05:01   Re: arrg, somebody help plz
Reply With Quote #6

show us g_money, cause you are first using one argument, and then two...
Salepate is right about the player loop, although i would've used iPlayers[i] instead of making a new variable...
Also, a variable can't have the same name as a function...
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.
dutchmeat is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-16-2007 , 17:05   Re: arrg, somebody help plz
Reply With Quote #7

By the first function you posted, it looks like g_money is a variable, not a function. So change this:

Code:
 new money = g_money(id);

To this:

Code:
 new money = g_money[id];
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
tadoom
Junior Member
Join Date: Jan 2007
Old 01-16-2007 , 19:44   Re: arrg, somebody help plz
Reply With Quote #8

Thanks guys, I will try all this out soon. Im horrid at coding I know
tadoom is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 01-17-2007 , 01:42   Re: arrg, somebody help plz
Reply With Quote #9

Just remember the brackets are when you're storing data, and the parenthesis are for when you're calling a function and passing in that data.
__________________
Bad_Bud 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 22:25.


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