[FilterScript] Pilot Job
#1

Hello guys! This is my second filterscript, I hope you like it
You can add cars using debug if you know how to use debug!



Код:
//Filterscript by LarryTiger

    #include <a_samp>

    #define COLOR_RED 0xFF0000AA
    #define COLOR_YELLOW 0xFFFF00AA


    new flyjobrunning = 0;
    new info;

    public OnFilterScriptInit()
    {
        AddStaticVehicle(519,1729.8932,-2415.7798,14.4727,149.2040,1,1); //

        info = CreatePickup(1239,1,1748.7014,-2421.0500,13.5547,-1);
    }

    public OnPlayerCommandText(playerid, cmdtext[])
    {
            if (strcmp("/startflight", cmdtext, true, 10) == 0)
            {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
            {
                flyjobrunning = 1;
                SetPlayerCheckpoint(playerid, -1253.9714,238.6661,14.1484, 10);
                GameTextForPlayer(playerid, "~g~You started the job, good luck!", 3000, 3);
                new name[MAX_PLAYER_NAME], string[48];
                GetPlayerName(playerid, name, sizeof(name));
                format(string, sizeof(string), "%s is now delivering goods with a plane.", name );
                SendClientMessageToAll(COLOR_RED, string);

				return 1;
                            }
 			SendClientMessage(playerid, COLOR_RED,"You have to be in the jobplane to start the job");
            }
            if (strcmp("/flyinfo", cmdtext, true, 10) == 0)
            {
                SendClientMessage(playerid, COLOR_YELLOW, "You need to bring the planeload to the airport in San Fierro.");
                SendClientMessage(playerid, COLOR_YELLOW, "There they will reward you for your help.");
                SendClientMessage(playerid, COLOR_YELLOW, "If you enter the truck, type /startflight and a red marker will appear.");
                SendClientMessage(playerid, COLOR_YELLOW, "Just fly to the marker and you're done.");
                SendClientMessage(playerid, COLOR_YELLOW, "this Job Not Required You To join This just Do This Job For Money.");
				return 1;
            }
            return 0;
    }
    public OnPlayerEnterCheckpoint(playerid)
    {
         if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
         {
          	 GivePlayerMoney(playerid, 500);
			 GameTextForPlayer(playerid, "~g~You Completed the job, well done!", 3000, 3);
     		 SetVehicleToRespawn(1);
             DisablePlayerCheckpoint(playerid);
             flyjobrunning = 500;
             SetPlayerPos(playerid, 1729.8932,-2415.7798,14.4727);
             }
    }
    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
         if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 519)
         {
             SendClientMessage(playerid, COLOR_RED, "You can start the Fly job with /startflight");
         }
         return 0;
    }
    public OnPlayerExitVehicle(playerid, vehicleid)
    {
            if((flyjobrunning) == 1)
            {
                flyjobrunning = 0;
                SendClientMessage(playerid, COLOR_RED, "You left the plane, you failed the job.");

            }else if((flyjobrunning) == 0){

                    //Nothing
     }
    }

    public OnPlayerPickUpPickup(playerid, pickupid)
    {
        if(pickupid == info)
            {
        GameTextForPlayer(playerid, "~g~Welcome at the Fly job, use /flyinfo to know more", 3000, 3);
            }
    }
All comments are welcomed
Reply
#2

First, flyjobrunning=500 upon mission completing doesn't make any sense.
Second, flyjobrunning should be a per-player variable. You are using it as a global variable.
Third, I can spam /startmission.
Fourth, I can exit my plane and still do the mission.

The code itself, is not indentated and badly coded.
Reply
#3

Good for a beginner
But you have some things to work on , Good luck.
Reply
#4

I have doubts if your code actually works. But I guess you're just a beginner. Put more time into your next release.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)