SA-MP Forums Archive
Help Server Money - 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)
+--- Thread: Help Server Money (/showthread.php?tid=342482)



Help Server Money - Dark Crow - 13.05.2012

Well i have problem with the server money i have searched before i posted and didn't find anything so i posted When i use any admin command to give players money after they spend some example: A player has 3milion$ he spends 2milion on a firm and he buys the firm but his money go to -2milion not just like that even if the player dies and many other ways i don't know why it keeps doing that any suggestions?


Re: Help Server Money - ViniBorn - 13.05.2012

Do you use some Anti MoneyHack ?


Re: Help Server Money - Yuryfury - 13.05.2012

So when a player buys a $2 Million firm and he has $3 Million, the player's money gets set to $-2 Million?

It would be easier to help if we could see that section of the code (what happens when a player buys the firm)


Re: Help Server Money - Dark Crow - 13.05.2012

i don't use a money anti hack and its not only when buying a firm when you buy anything, deposit money , die , pay a ticket to the police... I don't really know how to fix it and where to find the problem i have a public SafeResetPlayerMoney but don't know is it because of it?


Re: Help Server Money - ViniBorn - 13.05.2012

How do you give money ? With GivePlayerMoney?

Show one command with money ...


Re: Help Server Money - Dark Crow - 13.05.2012

Here is the admin /setmoney command

Код:
	if(strcmp(cmd, "/setmoney", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /setmoney [ID na Igrac/Del od Imeto] [novac]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1337)
			{
			    if(IsPlayerConnected(playa))
			    {
			        if(playa != INVALID_PLAYER_ID)
			        {
						SafeResetPlayerMoney(playa);
						SafeGivePlayerMoney(playa, money);
						GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, 256, "|DL|%s mu gi podesi parite na %s na $%d.", sendername,giveplayer,money);
						SendAdminMessage(WHITE,string);
						SaveAccounts();
						OnPropUpdate();
						}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "Ne ste ovlasteni za taa Komanda!");
			}
		}
		return 1;
	}



Re: Help Server Money - ViniBorn - 13.05.2012

SafeGivePlayerMoney seems an AntiMoneyHack.

Show this function


Re: Help Server Money - Dark Crow - 13.05.2012

here are they
Код:
public SafeGivePlayerMoney(plyid, amounttogive)
{
	new curHour, curMinute, curSecond;
	gettime(curHour, curMinute, curSecond);
	ScriptMoneyUpdated[plyid] = curSecond;
	if (amounttogive < 0)
	{
		GivePlayerMoney(plyid, amounttogive);
		ScriptMoney[plyid] = (ScriptMoney[plyid] + amounttogive);
	}
	else
	{
		ScriptMoney[plyid] = (ScriptMoney[plyid] + amounttogive);
		GivePlayerMoney(plyid, amounttogive);
	}
	return 1;
}

public SafeResetPlayerMoney(plyid)
{
	new curHour, curMinute, curSecond;
	gettime(curHour, curMinute, curSecond);
	ScriptMoneyUpdated[plyid] = curSecond;
	ResetPlayerMoney(plyid);
	ScriptMoney[plyid] = 0;
	return 1;
}
i added the reset money too


Re: Help Server Money - Yuryfury - 13.05.2012

Why would you separate SafeGiveMoney into the two if/else statements if they both do the same thing? Are these the only added Money related callbacks?


Re: Help Server Money - Dark Crow - 13.05.2012

Quote:
Originally Posted by Yuryfury
Посмотреть сообщение
Why would you separate SafeGiveMoney into the two if/else statements if they both do the same thing? Are these the only added Money related callbacks?
there are some stocks
Код:
stock GivePlayerCash(playerid, money)
{
    Cash[playerid] += money;
    ResetMoneyBar(playerid);//Resets money in the original bar
    UpdateMoneyBar(playerid,Cash[playerid]);//Puts money in the original bar
    return Cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
    Cash[playerid] = money;
    ResetMoneyBar(playerid);//Resets money in the original bar    
    UpdateMoneyBar(playerid,Cash[playerid]);//Puts money in the original bar
    return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
    Cash[playerid] = 0;
    ResetMoneyBar(playerid);//Resets money in the original bar
    UpdateMoneyBar(playerid,Cash[playerid]);//Puts money in the original bar
    return Cash[playerid];
}
stock GetPlayerCash(playerid)
{
    return Cash[playerid];
}