Filterscript read stock in main gm?
#1

Hey guys pretty self explanitory in the title.
How can i get a filterscript to read a stock in the main gamemode?

Iv downloaded a vehicle filterscript, but I need it to read the way money is handled otherwise cars are free..
Thanks heaps.
Reply
#2

I guess you can't do it.
Reply
#3

You can use "CallRemoteFunction". Although I have never really messed with this, I am not to handy with how to actually use it. :P

This forum requires that you wait 120 seconds between posts. Please try again in 4 seconds. <-- Every time..
Reply
#4

i found this but im not understanding it a great deal..
https://sampforum.blast.hk/showthread.php?tid=261584

Can anyone help? Ill add that im using zgaming roleplay GM script and What is setup in the main GM for cash is:
enum pInfo
{
pMoney,//Money

the stock for giving or taking money is:
stock GiveZaiatMoney(playerid, amount)
{
new string[128];
if(amount < 0) format(string, sizeof(string), "~r~-$%d", amount*-1);
else if(amount > 0) format(string, sizeof(string), "~g~+$%d", amount);
GameTextForPlayer(playerid, string, 3000, 1);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PlayerInfo[playerid][pMoney] += amount;
return 1;
}

How can I make it so the money handling can be accessed through the vehicle filterscript. Thanks guys.
Reply
#5

Okay what I did was created:
Код:
forward playermoney(playerid, amount);
public playermoney(playerid, amount)
{
    GiveZaiatMoney(playerid, amount);
	return 1;
}
Then in the filterscript created
CallRemoteFunction("playermoney", "ii", playerid, money);

which takes me to the script above which takes me to the stock givezaiatmoney But iv run into a problem.
How do I turn these two into the above callremotefunction? Its for when selling your car to another player..? and how would I edit the above script? Thanks!

GivePlayerMoney(playerid, -price);
GivePlayerMoney(targetid, price);

GivePlayerMoney(i, -cost); .. ?
Reply
#6

stocks can only be called from the script they're in (unless they're included via an include).

Change the keyword of your stock function to public and forward it and you'll be able to call it from filterscripts and other remote scripts, using CallRemoteFunction.
Reply
#7

Thanks for the tip, iv got that all working What I need to understand is this:
GivePlayerMoney(i, -cost);

Whats this mean and how can I make it work with CallRemoteFunction("playermoney", "ii", playerid, money);
its park of the fueling part of the vehicle script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)