anti cheat money - Please Help
#1

hello
i have one problem.
When using the command give money to players = reset money
How do I solve this problem?
Код:
#include <a_samp>
#define ResetMoneyBar ResetPlayerMoney
#define UpdateMoneyBar GivePlayerMoney
forward MoneyTimer();
public OnFilterScriptInit()
{
    SetTimer("MoneyTimer", 1000, 1);
	return 1;
}
new Cash[MAX_PLAYERS];

stock GivePlayerCash(playerid, money)
{
    Cash[playerid] += money;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock SetPlayerCash(playerid, money)
{
    Cash[playerid] = money;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock ResetPlayerCash(playerid)
{
    Cash[playerid] = 0;
    ResetMoneyBar(playerid);//Resets the money in the original moneybar, Do not remove!
    UpdateMoneyBar(playerid,Cash[playerid]);//Sets the money in the moneybar to the serverside cash, Do not remove!
    return Cash[playerid];
}
stock GetPlayerCash(playerid)
{
    return Cash[playerid];
}
public OnPlayerConnect(playerid)
{
    ResetPlayerCash(playerid);
	return 1;
}
public MoneyTimer()
{
    new username[MAX_PLAYER_NAME];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(GetPlayerCash(i) != GetPlayerMoney(i))
            {
                ResetMoneyBar(i);//Resets the money in the original moneybar, Do not remove!
                UpdateMoneyBar(i,GetPlayerCash(i));//Sets the money in the moneybar to the serverside cash, Do not remove!
                new hack = GetPlayerMoney(i) - GetPlayerCash(i);
                GetPlayerName(i,username,sizeof(username));
                printf("Player %s = money hack = $%d.", username,hack);
            }
        }
    }
}
Command :
Код:
CMD:givemoney(playerid, params[])
{
	new id, money, reason[128];
	if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF9900}[Server] only to use admin level 5.");
	if(sscanf(params,"uds", id, money, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF9900}[Server] Use: /givemoney [PlayerID/Name] [amount] [reason]");
	if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFFFFFFFF,"{FF9900}[Server] player not connected.");
	    else {
        new Namep[MAX_PLAYER_NAME], polakiMessage[128];
        new Nameid[MAX_PLAYER_NAME], polakiidMessage[128];
        GetPlayerName(playerid, Namep, sizeof(Namep));
        GetPlayerName(id, Nameid, sizeof(Nameid));
        format(polakiMessage, sizeof(polakiMessage), "{FF0000}[Server] you, player %s(%d) [$%d] reason [%s].", Nameid, id, money, reason);
        SendClientMessage(playerid, 0xFFFFFFFF, polakiMessage);
        format(polakiidMessage, sizeof(polakiidMessage), "{FF0000}[Server] admin level 5 %s(%d) [$%d] reason [%s] you give.", Namep, playerid, money, reason);
        SendClientMessage(id, 0xFFFFFFFF, polakiidMessage);
        GivePlayerMoney(id, money);
    }
	return 1;
}
Thanks
-------------------
sorry. my bad english.
Reply


Messages In This Thread
anti cheat money - Please Help - by Miladajir - 10.05.2014, 12:53
Re: anti cheat money - Please Help - by rickisme - 10.05.2014, 13:40
Re: anti cheat money - Please Help - by Miladajir - 10.05.2014, 14:41
Re: anti cheat money - Please Help - by Miladajir - 10.05.2014, 14:56
Re: anti cheat money - Please Help - by doreto - 10.05.2014, 15:12
Re: anti cheat money - Please Help - by Miladajir - 10.05.2014, 16:28

Forum Jump:


Users browsing this thread: 1 Guest(s)