SafePlayerMoney - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SafePlayerMoney (
/showthread.php?tid=245386)
SafePlayerMoney -
ronnie3148 - 31.03.2011
Hey I am running a filterscript but it won't edit the ini file to give money, since I use La-RP script.... I tried
Код:
PlayerInfo[playerid][pCash] += 250;
with no luck..... how do I get around this?
I tried porting all the commands SafeGivePlayermoney but there is way to many of them and I can't port the filterscript over, cuz then it stops working...
I guess what I am saying can I edit the ini file and add the money on? and how?
Re: SafePlayerMoney -
Medal Of Honor team - 31.03.2011
can you describe it more?
Re: SafePlayerMoney -
ronnie3148 - 31.03.2011
I am using LARP, when I use just GivePlayerMoney on the filterscript it won't edit the ini file I tried using,
Код:
PlayerInfo[playerid][pCash] += 250;
new string[128];
new plname[MAX_PLAYER_NAME];
GivePlayerMoney(playerid, 250);
ScriptMoneyUpdated[playerid] = 1;
format(string, sizeof(string),"LARP/Users/%s.ini", plname);
new totalcash = dini_Int(string,"Money") + 250;
dini_IntSet(string,"Money",totalcash);
The gamemode I am using uses another way somehow to edit the inifile they use "SafeGivePlayerMoney"
So when I am giving the money from the filterscript I use /fixmoney and it takes it away.....
this is the function for SafeGivePlayerMoney in the gamemode
Код:
public SafeGivePlayerMoney(plyid, amounttogive)
{
ScriptMoneyUpdated[plyid] = 1;
new RemoveMoney = ScriptMoney[plyid] + amounttogive;
new AddMoney = ScriptMoney[plyid] + amounttogive;
new string[20];
format(string, sizeof(string),"$%d",amounttogive);
if (amounttogive < 0)
{
if(ReceivedMoney[plyid] == 0)
{
if(!IsAtTransfender(plyid) && !IsAtPaySpray(plyid))
{
TextDrawHideForPlayer(plyid, Textdraw52[plyid]);
ReceivedMoney[plyid] = 1;
TextDrawColor(Textdraw52[plyid], 0xFF0000FF);
TextDrawSetString(Textdraw52[plyid], string);
TextDrawShowForPlayer(plyid, Textdraw52[plyid]);
MoneyTimer[plyid] = SetTimerEx("RedMoney",125,true,"i",plyid);
}
}
else
{
if(!IsAtTransfender(plyid) && !IsAtPaySpray(plyid))
{
KillTimer(MoneyTimer[plyid]);
ReceivedMoney[plyid] = 1;
TextDrawHideForPlayer(plyid, Textdraw52[plyid]);
TextDrawColor(Textdraw52[plyid], 0xFF0000FF);
TextDrawSetString(Textdraw52[plyid], string);
TextDrawShowForPlayer(plyid, Textdraw52[plyid]);
MoneyTimer[plyid] = SetTimerEx("RedMoney",125,true,"i",plyid);
}
}
GivePlayerMoney(plyid, amounttogive);
ScriptMoney[plyid] = RemoveMoney;
}
else
{
if(ReceivedMoney[plyid] == 0)
{
if(!IsAtTransfender(plyid) && !IsAtPaySpray(plyid))
{
TextDrawHideForPlayer(plyid, Textdraw52[plyid]);
ReceivedMoney[plyid] = 1;
TextDrawColor(Textdraw52[plyid], 0x00FF00FF);
TextDrawSetString(Textdraw52[plyid], string);
TextDrawShowForPlayer(plyid, Textdraw52[plyid]);
MoneyTimer[plyid] = SetTimerEx("GreenMoney",125,true,"i",plyid);
}
}
else
{
if(!IsAtTransfender(plyid) && !IsAtPaySpray(plyid))
{
KillTimer(MoneyTimer[plyid]);
ReceivedMoney[plyid] = 1;
TextDrawHideForPlayer(plyid, Textdraw52[plyid]);
TextDrawColor(Textdraw52[plyid], 0x00FF00FF);
TextDrawSetString(Textdraw52[plyid], string);
TextDrawShowForPlayer(plyid, Textdraw52[plyid]);
MoneyTimer[plyid] = SetTimerEx("GreenMoney",125,true,"i",plyid);
}
}
ScriptMoney[plyid] = AddMoney;
GivePlayerMoney(plyid, amounttogive);
}
ScriptMoneyUpdated[plyid] = 0;
return 1;
}
btw congratz on the 500 posts MOH
I even tried porting in all the Safe function into the filterscript... with no luck!
Re: SafePlayerMoney -
ronnie3148 - 31.03.2011
Sorry double post meant to edit.
Re: SafePlayerMoney -
Calgon - 31.03.2011
You can use CallRemoteFunction in your filterscript, as your SafeGivePlayerMoney function is a public function.
pawn Код:
CallRemoteFunction("SafeGivePlayerMoney", "dd", playerid, amountofmoney);
Replace 'playerid' and 'amountofmoney' with the parameters you want.
Re: SafePlayerMoney -
ronnie3148 - 31.03.2011
You are awesome thanks