Anti cheat problems
#1

I got money anti cheat and i download two Filterscripts Pizzaboy job and Street Sweeper job
and when i got the anti cheat i dont got money and after i removed him i got the money but thats make bugs becuase there is no anti cheat in server so when i give money or get money from some job i can put like bilions in the bank and i dont know how much money i got what to do in this situation?

My anti cheat:

pawn Код:
// Money Anticheat
        if(GetPlayerMoney(playerid) != PlayerInfo[playerid][pMoney])
        {
            ResetPlayerMoney(playerid);
            GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
        }
Reply
#2

When giving money in job, don't use GivePlayerMoney.
Код:
PlayerInfo[playerid][pMoney] += 100;
Reply
#3

Quote:
Originally Posted by King Ace
Посмотреть сообщение
When giving money in job, don't use GivePlayerMoney.
Код:
PlayerInfo[playerid][pMoney] += 100;
Thats my job but if i dont remove the anti cheat i dont earn money and if i add the anti cheat to the FS thats make to me error

pawn Код:
#include <a_samp>


#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA

new SweepingJob[256];

public OnFilterScriptInit()
{
    AddStaticVehicle(574,1424.8956,-1844.7279,13.2739,359.7335,0,0); // Sweeper1
    AddStaticVehicle(574,1428.4050,-1844.6340,13.2739,0.7382,0,0); // Sweeper2
    AddStaticVehicle(574,1431.9050,-1844.6138,13.2739,1.4491,0,0); // Sweeper3
}
forward SweeperJobFinish(playerid);
public SweeperJobFinish(playerid)
{
    if(SweepingJob[playerid] == 0){ return 1; }

    GivePlayerMoney(playerid, 200);
    if(GetPlayerMoney(playerid) > 200)
    SendClientMessage(playerid,COLOR_YELLOW,"* You have been earned for your job! - $200");
    SweepingJob[playerid] = 0;

    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/sweeper", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
        {
            SweepingJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* You are now a StreetSweeper.", name );
            SendClientMessage(playerid,COLOR_YELLOW, string);
            SendClientMessage(playerid,COLOR_YELLOW,"* Clean the street for 1 minute and recieve $200");
            SetTimerEx("SweeperJobFinish", 60000, false, "i", playerid);
            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"You have to be in a streetsweeper to start the job");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the sweepingjob by using /sweeper");
     }
     return 0;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(SweepingJob[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
        SweepingJob[playerid] = 0;
    }
}
Reply
#4

Try this.
pawn Код:
#include <a_samp>


#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA

new SweepingJob[256];

public OnFilterScriptInit()
{
    AddStaticVehicle(574,1424.8956,-1844.7279,13.2739,359.7335,0,0); // Sweeper1
    AddStaticVehicle(574,1428.4050,-1844.6340,13.2739,0.7382,0,0); // Sweeper2
    AddStaticVehicle(574,1431.9050,-1844.6138,13.2739,1.4491,0,0); // Sweeper3
}
forward SweeperJobFinish(playerid);
public SweeperJobFinish(playerid)
{
    if(SweepingJob[playerid] == 0){ return 1; }

    PlayerInfo[playerid][pMoney] += 100;
    SendClientMessage(playerid,COLOR_YELLOW,"* You have been earned for your job! - $200");
    SweepingJob[playerid] = 0;

    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/sweeper", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
        {
            SweepingJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* You are now a StreetSweeper.", name );
            SendClientMessage(playerid,COLOR_YELLOW, string);
            SendClientMessage(playerid,COLOR_YELLOW,"* Clean the street for 1 minute and recieve $200");
            SetTimerEx("SweeperJobFinish", 60000, false, "i", playerid);
            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"You have to be in a streetsweeper to start the job");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 574)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the sweepingjob by using /sweeper");
     }
     return 0;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(SweepingJob[playerid] == 1)
    {
        SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
        SweepingJob[playerid] = 0;
    }
}
Reply
#5

pawn Код:
if(GetPlayerMoney(playerid) > PlayerInfo[playerid][pMoney])
        {
            ResetPlayerMoney(playerid);
            GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
        }
use function like this to give money
pawn Код:
stock GiveCash(playerid,cash)
{
   pInfo[playerid][Cash] +=cash;
   ResetPlayerMoney(playerid);
   GivePlayerMoney(playerid,cash);
}
Reply
#6

If you got the anti money cheat scripted under OnPlayerUpdate callback, so you should save players data each time they get new legally money.
Reply
#7

Quote:
Originally Posted by Juvanii
Посмотреть сообщение
If you got the anti money cheat scripted under OnPlayerUpdate callback, so you should save players data each time they get new legally money.
I got that and i need to save but if i remove him thats make bug
Reply
#8

Someone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)