Need help with server-side money.
#1

Hello, so I do not have any scripting experience, just started developing a SAMP server just around three days ago. But enough with my life stories and let's get to my problem.

So here's the thing. I took XtremeAdmin2 and I got my serverside money from Norn's tutorial ( https://sampforum.blast.hk/showthread.php?tid=71136 ).
And now, when I use the /setcash command from XtremeAdmin2...

pawn Код:
dcmd_setcash(playerid,params[]) {
    if(IsPlayerCommandLevel(playerid,"setcash")) {
        new tmp[256],tmp2[256],Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
        if(!strlen(tmp)||!strlen(tmp2)||!IsNumeric(tmp2)||!(strval(tmp2) >= 1 && strval(tmp2) <= 1000000)) return SendClientMessage(playerid,red,"Syntax Error: \"/SETCASH <NICK OR ID> <1 - 1,000,000>\".");
        new id; if(!IsNumeric(tmp)) id = ReturnPlayerID(tmp); else id = strval(tmp);
        if(IsPlayerConnected(id) && id != INVALID_PLAYER_ID) {
            SendCommandMessageToAdmins(playerid,"SETCASH");
            new string[256],name[24],ActionName[24]; GetPlayerName(playerid,name,24); GetPlayerName(id,ActionName,24);
            if(id != playerid) { format(string,256,"Administrator \"%s\" has set your cash to $%d.",name,strval(tmp2)); SendClientMessage(id,yellow,string); format(string,256,"You have set \"%s's\" cash to $%d.",ActionName,strval(tmp2)); SendClientMessage(playerid,yellow,string); }
            else { format(string,256,"You have set your cash to $%d.",strval(tmp2)); SendClientMessage(playerid,yellow,string); }
            ResetPlayerMoney(id); return GivePlayerMoney(id,strval(tmp2));
        } return SendClientMessage(playerid,red,"ERROR: You can not set a disconnected player's cash.");
    } else return SendLevelErrorMessage(playerid,"setcash");
}

The server-side money anti-hack timer gets in it's way and doesn't let me /setcash on somebody.

pawn Код:
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("%s has picked up/attempted to spawn $%d.", username,hack);
            }
        }
    }
}
So, could anybody please help me? I tried doing something with CallRemoteFunction, but then, my money just goes up to infinite and doesn't save in my account's .ini file.
Reply


Messages In This Thread
Need help with server-side money. - by Gytis0 - 06.04.2012, 06:36
Re: Need help with server-side money. - by [HiC]TheKiller - 06.04.2012, 06:48
Re: Need help with server-side money. - by Gytis0 - 06.04.2012, 10:34
Re: Need help with server-side money. - by blank. - 06.04.2012, 10:42
Re: Need help with server-side money. - by MadeMan - 06.04.2012, 11:22
Re: Need help with server-side money. - by Gytis0 - 06.04.2012, 14:50
Re: Need help with server-side money. - by MadeMan - 06.04.2012, 14:51
Re: Need help with server-side money. - by Phil_Cutcliffe - 15.02.2013, 04:47

Forum Jump:


Users browsing this thread: 2 Guest(s)