Help with making /work system.
#1

Well, I'm working on a /work system for my flying server, since the current way to get score + money is to fly. That seems boring, so I'm starting work on this basic system, which will prboably be expanded in the future.

Now, there is no errors, but there is one things I canot get passed, setting the next check point for the final destenation.

Here is my script.

pawn Код:
#include <a_samp>
#include <zcmd>

#define COLOR_WHITE 0xFFFFFFFF

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Pilot Job system by TechKid100");
    print("--------------------------------------\n");
    return 1;
}

enum Work
{
    IsWorking,
}

new WorkInfo[MAX_PLAYERS][Work];

public OnPlayerConnect(playerid)
{
    WorkInfo[playerid][IsWorking] = 0;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    WorkInfo[playerid][IsWorking] = 0;
    return 1;
}

COMMAND:work(playerid, params[])
{
    if(!IsPlayerInPlane(playerid) && WorkInfo[playerid][IsWorking] == 0)
    {
        SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}You need to be in a plane to work!");
        return 1;
    }
   
    else if (WorkInfo[playerid][IsWorking] == 1 && IsPlayerInPlane(playerid))
    {
        SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}You are allready working!");
        return 1;
    }

    //Flights
    else if (WorkInfo[playerid][IsWorking] == 0 && IsPlayerInPlane(playerid))
    {
        //Lv to Sf (Flight 1)
        if(IsPlayerInRangeOfPoint(playerid, 1000, 1580.8534, 1534.2217, 10.8316))
        {
            WorkInfo[playerid][IsWorking] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "Complete flight from {FFFF00}LVAP {FFFFFF}to {FFFF00}SFAP.");
            SetPlayerRaceCheckpoint(playerid, 2, 1580.8534, 1534.2217, 10.8316, -1371.3795,-206.3711,14.1484, 5);
            return 1;
        }
       
       
        //Sf to Ls (Flight 2)
        else if(IsPlayerInRangeOfPoint(playerid, 1000, 1580.8534, 1534.2217, 10.8316))
        {
            WorkInfo[playerid][IsWorking] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "Complete flight from {FFFF00}SFAP {FFFFFF}to {FFFF00}LSAP.");
            SetPlayerRaceCheckpoint(playerid, 2, -1371.3795,-206.3711,14.1484, 1721.4504,-2415.5193,13.5547, 5);
            return 1;
        }
       
        //Ls to Lv (Flight 3)
        else if(IsPlayerInRangeOfPoint(playerid, 1000, 1580.8534, 1534.2217, 10.8316))
        {
            WorkInfo[playerid][IsWorking] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "Complete flight from {FFFF00}LSAP {FFFFFF}to {FFFF00}LVAP.");
            SetPlayerRaceCheckpoint(playerid, 2, 1721.4504, -2415.5193, 13.5547, 1580.8534, 1534.2217, 10.8316, 5);
            return 1;
        }
       
    }
   
    return 0;
}

COMMAND:stopwork(playerid, params[])
{
    if(WorkInfo[playerid][IsWorking] == 0)
    {
        SendClientMessage(playerid, COLOR_WHITE, "{FF0000}Error: {FFFFFF}You are not working!");
        return 1;
    }
   
    else if (WorkInfo[playerid][IsWorking] == 1)
    {
        WorkInfo[playerid][IsWorking] = 0;
        SendClientMessage(playerid, COLOR_WHITE, "Work has been stoped!");
        DisablePlayerRaceCheckpoint(playerid);
        return 1;
    }
    return 0;
}


public OnPlayerEnterCheckpoint(playerid)
{
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    return 1;
}

public OnPlayerDeath(playerid)
{
    WorkInfo[playerid][IsWorking] = 0;
    return 1;
}

stock IsPlayerInPlane(playerid)
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
        {
            case 593,592,577,563,553,548,520,519,513,512,511,
            497,488,487,476,469,460,447,425,417,493,484,453: return 1;
            default: return 0;
        }
    }
    return 0;
}
Now, what I really want to do is so when a player enters the first checpoint, its knows it the first checkpoint, so it dosent give the player the reward. So it needs to set the last checkpoint. And when a player enters that last checkpoint, it gives the player 10k and 1 score, and set's the work to off.

I just dont know how to get around it.

Lets take this for example.

pawn Код:
//Lv to Sf
        if(IsPlayerInRangeOfPoint(playerid, 1000, 1580.8534, 1534.2217, 10.8316))
        {
            WorkInfo[playerid][IsWorking] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "Complete flight from {FFFF00}LVAP {FFFFFF}to {FFFF00}SFAP.");
            SetPlayerRaceCheckpoint(playerid, 2, 1580.8534, 1534.2217, 10.8316, -1371.3795,-206.3711,14.1484, 5);
            return 1;
        }
SetPlayerRaceCheckpoint(playerid, 2, 1580.8534, 1534.2217, 10.8316, -1371.3795,-206.3711,14.1484, 5);

As you can see it is setting the next checkpoint but I dont know how to get around this.
Reply


Messages In This Thread
Help with making /work system. - by Odyssey - 16.07.2011, 00:54
Re: Help with making /work system. - by Adil - 16.07.2011, 01:44
Re: Help with making /work system. - by Odyssey - 16.07.2011, 02:05
Re: Help with making /work system. - by DRIFT_HUNTER - 16.07.2011, 02:10
Re: Help with making /work system. - by Odyssey - 16.07.2011, 02:14
Re: Help with making /work system. - by DRIFT_HUNTER - 16.07.2011, 02:22
Re: Help with making /work system. - by Odyssey - 16.07.2011, 02:55
Re: Help with making /work system. - by Adil - 16.07.2011, 03:04
Re: Help with making /work system. - by Odyssey - 16.07.2011, 09:46
Re: Help with making /work system. - by Basicz - 16.07.2011, 10:09
Re: Help with making /work system. - by Odyssey - 16.07.2011, 10:36
Re: Help with making /work system. - by Basicz - 16.07.2011, 10:45

Forum Jump:


Users browsing this thread: 2 Guest(s)