help job farm
#1

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

Up!!!!!
Reply
#3

Launch your function SetFarm in OnPlayerUpdate.
Reply
#4

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


Forum Jump:


Users browsing this thread: 2 Guest(s)