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
#2

just change :

Quote:

GivePlayerMoney(id, money);

to :
Quote:

GivePlayerCash(id, money);

Reply
#3

thanks for help
Reply
#4

I also have another problem.
When I use the command, In the console type is:

Strings without a length are deprecated, please add a destination size.

How do I solve the problem?
Reply
#5

Quote:
Originally Posted by Miladajir
Посмотреть сообщение
I also have another problem.
When I use the command, In the console type is:

Strings without a length are deprecated, please add a destination size.

How do I solve the problem?
pawn Код:
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[128]", 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;
}
Reply
#6

thanks for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)