One Question
#1

Hello this is one job system
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455)
     {
         GivePlayerMoney(playerid, 10000);
         GameTextForPlayer(playerid, "~g~You Completed the job, well done!", 3000, 3);
         SetVehicleToRespawn(513);
         DisablePlayerCheckpoint(playerid);
         truckjobrunning = 0;
     }
How can i after finish job.To can again after 30 minutes ? ?.. and when i finish job.. Vehicle from job to back to old position (Respawn)

Sorry for my english
Reply
#2

Please help me
Reply
#3

You would need to add a variable to tell whether or not the player has completed the job. You would set that variable to 1 in the callback above.

On your command or whenever you start the job, check if the variable is 1 or 0. If it is 0, allow them to work. If it is 1, it would mean they've completed the job already.

Lastly add a timer using SetTimerEx under where you'll add the variable and set it to thirty minutes. On the timer's end, set the variable back to 0.
Reply
#4

Using a timer for the 30 minutes...

pawn Код:
On top of script
new TIMER_TruckJob[playerid];
new TruckTimer[playerid];

On the cmd add:

if(TruckTimer == 0)

Under on player enter checkpoint:

TIMER_TruckJob[playerid] = SetTimerEx("TruckJob", 30000, false, "i", playerid);
TruckTimer[playerid] = 1;

forward TruckJob(playerid);
public TruckJob(playerid)
{
    TruckTimer[playerid] = 0;
    KillTimer(TIMER_TuckJob[playerid]);
}
Reply
#5

I dont uderstand how to become bro.. : ( please give me only pawno to coppy paste

This is the all scripts

pawn Код:
#include <a_samp>

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

/*new jobtruck[] = {
512,513,514,515,516};*/

new truckjobrunning = 0;
new info;

public OnFilterScriptInit()
{
    AddStaticVehicleEx(455,-43.9742,-1155.8762,1.4823,65.0184,-1,-1, 10);
    AddStaticVehicleEx(455,-39.6336,-1148.4509,1.5148,62.2225,-1,-1, 10);
    AddStaticVehicleEx(455,-37.7033,-1144.2280,1.5173,65.7564,-1,-1, 10);
    AddStaticVehicleEx(455,-35.7032,-1140.0637,1.5149,66.4882,-1,-1, 10);
    AddStaticVehicleEx(455,-41.9300,-1152.2032,1.5132,62.4657,-1,-1, 10);
    AddStaticVehicle(411,2074.7217,-2121.5066,13.3707,270.4157,116,1); //
    AddStaticVehicle(411,2065.8503,-2121.5710,13.3679,270.3890,116,1); //
    AddStaticVehicle(411,2085.5073,-2121.6392,13.3711,267.6290,116,1); //
   
    info = CreatePickup(1239,1,-70.7099,-1139.1187,1.0781,-1);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/truck", cmdtext, true, 10) == 0)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455)
        {
            truckjobrunning = 1;
            SetPlayerCheckpoint(playerid, 2058.3142,-2092.4023,9.9832, 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 a Truck Driver.", name );
            SendClientMessageToAll(COLOR_RED, string);

            return 1;
        }
        SendClientMessage(playerid, COLOR_RED,"You have to be in a truck to start the job");
    }
    if (strcmp("/truckinfo", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "You need to bring the truckload to the airport.");
        SendClientMessage(playerid, COLOR_YELLOW, "There they will reward you for your help.");
        SendClientMessage(playerid, COLOR_YELLOW, "If you enter the truck, type /truck and a red marker will appear.");
        SendClientMessage(playerid, COLOR_YELLOW, "Just drive to the marker and you're done.");
        return 1;
    }
    return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455)
     {
         GivePlayerMoney(playerid, 10000);
         GameTextForPlayer(playerid, "~g~You Completed the job, well done!", 3000, 3);
         SetVehicleToRespawn(513);
         DisablePlayerCheckpoint(playerid);
         truckjobrunning = 0;
     }
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 455)
     {
         SendClientMessage(playerid, COLOR_RED, "You can start the truck-mission with /truck");
     }
     return 0;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if((truckjobrunning) == 1)
    {
        truckjobrunning = 0;
        SendClientMessage(playerid, COLOR_RED, "You left your truck behind, get in again if you want to continue your job.");

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

        //Nothing
 }
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == info)
    {
    GameTextForPlayer(playerid, "~g~Welcome at the Truck Driver job, use /truckinfo to know more", 3000, 3);
    }
}
Reply
#6

Please help me
Reply
#7

Quote:

please give me only pawno to coppy paste

Just made me not want to help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)