Filterscript Problem Help!
#1

pawn Code:
//------------------------------------------------------------------------------
//
//   PizzaBoy miniMission Filter Script v1.0
//   Designed for SA-MP v0.2.1
//
//   Created by zeruel_angel
//
//------------------------------------------------------------------------------

#define BONUS 2500
#include <a_samp>
enum posicion{
    Float:X,
    Float:Y,
    Float:Z
    }
#define BONUS 2500
#define MAX_CASH 500
#define MIN_CASH 100
new Destinos[100][posicion];
new Pizzerias[20][posicion];
new archDestinos[]="PizzaBoy1.txt";
new archPizzerias[]="PizzaBoy2.txt";
new contador[MAX_PLAYERS];

new playerInMiniMission[MAX_PLAYERS];
new avisado[MAX_PLAYERS];
new cantidadDestinos;
new cantidadPizzerias;

forward terminarMission(playerid);

public OnFilterScriptInit()
{
    print("\nPIZZABOY Filter Script v1.0 Loading...\n******************************\n      (Zeruel_Angel)\n");
    new File:filePizza;
    new lineaPizza[255];
    filePizza = fopen(archDestinos,io_readwrite);
    new j=0;
    new idx;
    while   ((fread(filePizza,lineaPizza,sizeof(lineaPizza),false))&&(j<25))
            {
            idx = 0;
            Destinos[j][X] = floatstr(strtok(lineaPizza,idx));
            Destinos[j][Y] = floatstr(strtok(lineaPizza,idx));
            Destinos[j][Z] = floatstr(strtok(lineaPizza,idx));
            j++;
            }
    cantidadDestinos=j;
    fclose(filePizza);
    format(lineaPizza,sizeof(lineaPizza),"Total destinations loaded: %d", cantidadDestinos);
    print(lineaPizza);
   
    filePizza = fopen(archPizzerias,io_readwrite);
    j=0;
    while   ((fread(filePizza,lineaPizza,sizeof(lineaPizza),false))&&(j<25))
            {
            idx = 0;
            Pizzerias[j][X] = floatstr(strtok(lineaPizza,idx));
            Pizzerias[j][Y] = floatstr(strtok(lineaPizza,idx));
            Pizzerias[j][Z] = floatstr(strtok(lineaPizza,idx));
            j++;
            }
    cantidadPizzerias=j;
    fclose(filePizza);
    format(lineaPizza,sizeof(lineaPizza),"Total pizzeria loaded: %d", cantidadPizzerias);
    print(lineaPizza);
    for (new i=0;i<MAX_PLAYERS;i++)
        {
        playerInMiniMission[i]=-1;
        avisado[i]=-1;
        }
    print("PIZZABOY Filter Script fully Loaded\n**********************************\n\n");
}

public OnFilterScriptExit()
    {
    print("\n**********************\n*PizzaBoy Script UnLoaded*\n**********************\n");
    return 1;
    }
//------------------------------------------------------------------------------------------------------
 strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
//------------------------------------------------------------------------------------------------------
public terminarMission(playerid)
    {
    GameTextForPlayer(playerid,"~r~PizzaBoy ~n~ ~w~SideJob ~n~ ~w~cancelled",3000,4);
    playerInMiniMission[playerid]=-1;
    avisado[playerid]=-1;
    DisablePlayerRaceCheckpoint(playerid);
    contador[playerid]=0;
    return 1;
    }
//------------------------------------------------------------------------------------------------------
public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    if (newstate==PLAYER_STATE_DRIVER)
        {
        if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
            {
            if  (avisado[playerid]==-1)
                {
                GameTextForPlayer(playerid,"~w~Press ~b~Buttom 2~n~~w~to start ~r~PizzaBoy~n~~w~Sidejob",3000,5);//SetTimerEx("MandarMensaje",5500,0,"%d",playerid);
                }
            else
                {
                KillTimer(avisado[playerid]);
                avisado[playerid]=-1;
                }
            }
        }
    if  (newstate==PLAYER_STATE_ONFOOT)
        {
        if  ((playerInMiniMission[playerid]>0)&&(avisado[playerid]==-1))
            {
            GameTextForPlayer(playerid,"~w~You have ~r~10 sec ~n~~w~ to get a pizza bike",3000,4);
            avisado[playerid]=SetTimerEx("terminarMission",10000,0,"%d",playerid);
            }
        }
    return 1;
    }
//------------------------------------------------------------------------------------------------------
  getNearestPizzeria(Float:X1,Float:Y1,Float:Z1)
    {
    new index;
    new Float:distOld=9999.0;
    new Float:distNew=0.0;
    for (new i=0;i<cantidadPizzerias;i++)
        {
        distNew=floatsqroot(floatpower(floatabs(floatsub(Pizzerias[i][X],X1)),2)+floatpower(floatabs(floatsub(Pizzerias[i][Y],Y1)),2)+floatpower(floatabs(floatsub(Pizzerias[i][Z],Z1)),2));
        if  (distNew<distOld)
            {
            distOld=distNew;
            index=i;
            }
        }
    return index;
    }
//------------------------------------------------------------------------------------------------------
  pizzeriaAcasa(playerid)
    {
    new Float:X1,Float:Y1,Float:Z1;
    GetPlayerPos(playerid,X1,Y1,Z1);
    new index = getNearestPizzeria(X1,Y1,Z1);
    new index2 = random(cantidadDestinos);
    DisablePlayerRaceCheckpoint(playerid);
    SetPlayerRaceCheckpoint(playerid,0,Pizzerias[index][X],Pizzerias[index][Y],Pizzerias[index][Z],Destinos[index2][X],Destinos[index2][Y],Destinos[index2][Z],3.0);
    playerInMiniMission[playerid]=index2;
    return 1;
    }
//------------------------------------------------------------------------------------------------------
  casaApizzeria(playerid)
    {
    new index2 = playerInMiniMission[playerid];
    new index = getNearestPizzeria(Destinos[index2][X],Destinos[index2][Y],Destinos[index2][Z]);
    DisablePlayerRaceCheckpoint(playerid);
    SetPlayerRaceCheckpoint(playerid,0,Destinos[index2][X],Destinos[index2][Y],Destinos[index2][Z],Pizzerias[index][X],Pizzerias[index][Y],Pizzerias[index][Z],3.0);
    playerInMiniMission[playerid]=0;
    return 1;
    }
//------------------------------------------------------------------------------------------------------
  MissionIni(playerid)
    {
    GameTextForPlayer(playerid,"~r~PizzaBoy ~w~MiniMision ~w~Starts!~n~ Quick! go to nearest ~r~ pizzeria~w~!",3000,4);
    pizzeriaAcasa(playerid);
    return 1;
    }
//------------------------------------------------------------------------------------------------------
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    if ((newkeys==KEY_SUBMISSION)&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid)==PLAYER_STATE_DRIVER))
        {
        if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
            {
            if  (playerInMiniMission[playerid]<0)
                {
                MissionIni(playerid);
                }
            else
                {
                terminarMission(playerid);
                }
            }
        }
    }
//------------------------------------------------------------------------------------------------------
public OnPlayerEnterRaceCheckpoint(playerid)
    {
    if  (playerInMiniMission[playerid]!=-1)
        {
        if (playerInMiniMission[playerid]==0)
            {
            GameTextForPlayer(playerid,"~r~Pizza ~w~delivered!~n~ Quick! go to nearest ~r~ pizzeria~w~~n~ more work to do!",3000,3);
            new cash=(random(MAX_CASH-MIN_CASH)+MIN_CASH);
            GivePlayerMoney(playerid,cash);
            pizzeriaAcasa(playerid);
            contador[playerid]++;
            }
        else
            {
           
            if  ((((contador[playerid]/5)*5)==contador[playerid])&&(contador[playerid]!=0))
                {
                new string[255];
                format(string,sizeof(string),"You get a ~r~BONUS ~w~ every 5 pizzas!.~n~You delivered %d pizzas your bonus is ~n~~b~$%d",contador[playerid],contador[playerid]*BONUS);
                GameTextForPlayer(playerid,string,3000,3);
                }
                else
                    {
                    GameTextForPlayer(playerid,"~w~Quick deliver this~n~~r~pizza",3000,3);
                    }
            casaApizzeria(playerid);
            }
        }
    return 1;
    }
//------------------------------------------------------------------------------------------------------
public OnPlayerDisconnect(playerid)
    {
    terminarMission(playerid);
    return 1;
    }
The above filterscript has an issue that, when the player makes a delivery and gets paid, the money resets(goes back to its previous amount).

So is there anything i can do so that the money earned is actually added to the player?

Serverside money is on the gamemode. Thanks


- EDIT: So I need to add a callback to make it work with the serverside money anti cheat that is in the game mode.

This is how a player gets money in the game mode (dropping off a car at a checkpoint in the GM)


pawn Code:
SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You sold a car for $2000, your reload time is 10 minutes.");
                PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+2000;
                GivePlayerMoney(playerid, 2000);
Now what i want is to make a callback that actually works, i tried adding this one but it doesnt give money after doing a "delivery". Please Help! The Pawn below is FROM THE FILTERSCRIPT!

pawn Code:
public OnPlayerEnterRaceCheckpoint(playerid)
    {
    if  (playerInMiniMission[playerid]!=-1)
        {
        if (playerInMiniMission[playerid]==0)
            {
            GameTextForPlayer(playerid,"~r~Pizza ~w~delivered!~n~ Quick! go to nearest ~r~ pizzeria~w~~n~ more work to do!",3000,3);
            new cash=(random(MAX_CASH-MIN_CASH)+MIN_CASH);
            CallRemoteFunction("GivePlayerMoney","i",playerid,cash); //Payout - NOT WORKING
            pizzeriaAcasa(playerid);
            contador[playerid]++;
            }
        else
            {
           
            if  ((((contador[playerid]/5)*5)==contador[playerid])&&(contador[playerid]!=0))
                {
                new string[255];
                format(string,sizeof(string),"You get a ~r~BONUS ~w~ every 5 pizzas!.~n~You delivered %d pizzas your bonus is ~n~~b~$%d",contador[playerid],contador[playerid]*BONUS);
                GameTextForPlayer(playerid,string,3000,3);
                }
                else
                    {
                    GameTextForPlayer(playerid,"~w~Quick deliver this~n~~r~pizza",3000,3);
                    }
            casaApizzeria(playerid);
            }
        }
    return 1;
    }
Reply
#2

Did you use
ResetPlayerMoney(playerid);
On the filterscript, check if you did and reply
Reply
#3

It doesnt reset the money as in to 0. It wont add the money to the current cash the player has.

Example: My character has 15,000 money, and he does a delivery for 500. He gets 15,500 money but after 2 seconds the money goes back to 15,000. Im guessing because of the serverside money on the gamemode.
Reply
#4

Quote:
Originally Posted by Medardo4Life
View Post
It doesnt reset the money as in to 0. It wont add the money to the current cash the player has.

Example: My character has 15,000 money, and he does a delivery for 500. He gets 15,500 money but after 2 seconds the money goes back to 15,000. Im guessing because of the serverside money on the gamemode.
Well,let me guess,are you using any ANTI Cheats,for money hack it might be the reason even if money given by server.. i'm just woundring otherwise
GivePlayerMoney(playerid, 500)
or Show me your
GivePlayerMoney(playerid, money);
Reply
#5

yes i am using anti money cheat. what can i do?
Reply
#6

You need to search for it,and see what happens when someone tries to get money.. by hax which is not server scripted,got MSN? it will make it easier..
Reply
#7

xmedardox@hotmail.com
Reply
#8

UPDATED! someone please help!
Reply
#9

bump. need help.
Reply
#10

I'm not 100Percent SURE if its the SIDE Money of the Server or the FS it self being buggy, try this codes as FS
and Tell me,if the same happens.
pawn Code:
#include <a_samp>

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

new PizzaJob[256];

public OnFilterScriptInit()
{
   
    AddStaticVehicle(448,2122.1677,-1784.2250,12.9837,180.4585,0,0); // Pizza 1
    AddStaticVehicle(448,2121.9895,-1784.7623,12.9867,181.5936,0,0); // Pizza 1
    AddStaticVehicle(448,2118.8469,-1784.5692,12.9880,181.5090,0,0); // Pizza 2
    AddStaticVehicle(448,2115.7837,-1784.6464,12.9860,181.6605,0,0); // Pizza 3
   
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/pizza", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
        {
            PizzaJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* %s is now a Pizzaboy.", name );
            SendClientMessageToAll(COLOR_YELLOW, string);
            SetPlayerCheckpoint(playerid,2012.6134,-1729.3796,13.1536,10);
            SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"You have to be on a pizza bike to start the job!");
    }
    return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the pizza courier by using /pizza");
     }
     return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 448)
     {
        if(PizzaJob[playerid] == 1){
            PizzaJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,2012.4771,-1640.1229,13.1431,10);
            SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
            return 1;
         }
        if(PizzaJob[playerid] == 2){
            PizzaJob[playerid] = 3;
            SetPlayerCheckpoint(playerid,2387.0063,-1667.1498,13.1249,10);
            return 1;
         }
        if(PizzaJob[playerid] == 3){
            PizzaJob[playerid] = 4;
            SetPlayerCheckpoint(playerid,2414.9255,-1649.6678,13.1305,10);
            return 1;
         }
        if(PizzaJob[playerid] == 4){
            PizzaJob[playerid] = 5;
            SetPlayerCheckpoint(playerid,2517.6394,-1678.3141,13.9862,10);
            return 1;
         }
        if(PizzaJob[playerid] == 5){
            PizzaJob[playerid] = 6;
            SetPlayerCheckpoint(playerid,2441.1526,-2017.4093,13.1231,10);
            return 1;
         }
        if(PizzaJob[playerid] == 6){
            PizzaJob[playerid] = 7;
            SetPlayerCheckpoint(playerid,2486.2058,-2017.6384,13.1309,10);
            return 1;
         }
        if(PizzaJob[playerid] == 7){
            PizzaJob[playerid] = 8;
            SetPlayerCheckpoint(playerid,2520.9238,-2016.4714,13.1395,10);
            return 1;
         }
        if(PizzaJob[playerid] == 8){
            PizzaJob[playerid] = 9;
            SetPlayerCheckpoint(playerid,2464.7258,-2000.3944,13.1430,10);
            return 1;
         }
        if(PizzaJob[playerid] == 9){
            PizzaJob[playerid] = 10;
            SetPlayerCheckpoint(playerid,2240.8374,-1886.9504,13.1486,10);
            return 1;
         }
        if(PizzaJob[playerid] == 10){
            PizzaJob[playerid] = 11;
            SetPlayerCheckpoint(playerid,2095.5488,-1815.7517,12.9792,10);
            return 1;
         }
        if(PizzaJob[playerid] == 11){
            PizzaJob[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $400 for delivering the pizzas.");
            GivePlayerMoney(playerid,400);
         }
     }
     return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(PizzaJob[playerid] > 0)
    {
        PizzaJob[playerid] = 0;
        SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
        DisablePlayerCheckpoint(playerid);
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)