SA-MP Forums Archive
help job farm - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help job farm (/showthread.php?tid=562885)



help job farm - myria - 12.02.2015

I did that when you're towing and speed exceeds 10 km to activate your Timmer 60 seconds and decrease, to me does not decrease at all, remains the same and do not know why. I think I did everything right.
Code:
pawn Код:
forward SetFarm(playerid);
public SetFarm(playerid)
{
    if(PlayerInfo[playerid][pJob] == 21)
    {
        if(Farm[playerid] == 1)
        {
            if(IsPlayerInRangeOfPoint(playerid, 200.0, -381.9549,-1439.0001,25.7266))
            {
                if(IsPlayerInAnyVehicle(playerid))
                {
                    if(!IsPlayerPaused(playerid))
                    {
                        new veh = GetPlayerVehicleID(playerid);
                        if(svInfo[veh][svJob] == 21 && PlayerInfo[playerid][pJob] == 21)

                        if(PlayerInfo[playerid][pFarmTime] >= 1)
                        {
                            //new string[256];
                            new speed;
                            speed = GetVehicleSpeed(veh);
                            if(speed >= 10)
                            {
                                PlayerInfo[playerid][pFarmTime]--;
                                new string[256];
                                format(string, 256, "You have to work more~y~ %d~w~ seconds to get paid.", PlayerInfo[playerid][pFarmTime]);
                                TextDrawSetString(Farmer1[playerid], string);
                                TextDrawShowForPlayer(playerid, Farmer1[playerid]);
                                //farmtimer[playerid] = SetTimerEx("SetFarm", 1000, 1, "d", playerid);
                                }
                                if(PlayerInfo[playerid][pFarmTime] == 1)
                            {
                                SetVehicleToRespawn(GetPlayerVehicleID(playerid));
                                PlayerInfo[playerid][pCash] += 17000;
                                /*SCM(playerid, COLOR_YELLOW, "You have got $17,000 for your work.");*/
                                TextDrawHideForPlayer(playerid, Farmer1[playerid]);
                                new rand;
                                rand = 10 + random(5);
                                format(szMessage, sizeof(szMessage), "You have got %d kilograms of grains for your work.", rand);
                                SCM(playerid, -1, szMessage);
                                PlayerInfo[playerid][pGrainKG] = rand;
                                KillTimer(farmtimer[playerid]);
                            }
                        }
                    }
                }
            }
            else
            {
                GameTextForPlayer(playerid, "~r~You are not in the farm area.", 3000, 1);
            }
        }
    }
    return 1;
}
and the public have put OnPlayerStateChange
pawn Код:
if(svInfo[newcar][svJob] == 21 && PlayerInfo[playerid][pJob] == 21)
        {
            new string2[256];
            //MowerMoney[playerid] = 69;
            PlayerInfo[playerid][pFarmTime] = 60;
            format(string2, 256, "You have to work more ~y~ %d~w~ seconds to get your money.", PlayerInfo[playerid][pFarmTime]);
            TextDrawSetString(Farmer1[playerid], string2);
            TextDrawShowForPlayer(playerid, Farmer1[playerid]);
            Farm[playerid] = 1;
            farmtimer[playerid] = SetTimerEx("SetFarm", 1000, 1, "d", playerid);
            KillTimer(farmtimer[playerid]);
       }
Help me!


Re: help job farm - myria - 12.02.2015

Up!!!!!


Re: help job farm - asto63 - 12.02.2015

Launch your function SetFarm in OnPlayerUpdate.


Re: help job farm - myria - 12.02.2015

It works, but I Timmer's falling too fast, do not get to go to 10m and over.