Random missions
#1

/convoy called random mission not the player mission?
pawn Код:
COMMAND:convoy(playerid, params[])
{
        new thing[128];
        if (strlen(thing) == 0)
        {
            SendClientMessage(playerid, WORK, "USAGE: /convoy [playerid]");
        }
        new giveplayerid = ReturnUser(thing);
        GetPVarInt(giveplayerid, "PlayerMission");
       
        if (GetPlayerTeam(playerid) == 1)
        {
            new m = GetVehicleModel(GetPlayerVehicleID(playerid));
            if(m == 514 || m == 515 || m == 403)
            {
                new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(playerid)));
                if (t == 435 || t == 450 || t == 584)
                {
                    if (GetPlayerVehicleSeat(playerid) == 0)
                    {
                        Trucker1(playerid);
                    }
                    else
                    {
                        SendClientMessage(playerid, WORK, "You are not the driver of this vehicle");
                    }
                }
                else
                {
                    SendClientMessage(playerid, WORK, "You do not have the correct trailer, please go and attach one!");
                }
            }
            else
            {
                SendClientMessage(playerid, WORK, "You are not in a truck, please go and get one!");
            }

         }
         return 1;
}
pawn Код:
public Trucker1(playerid)
{
    new rand = random(sizeof(trucker));
    PlayerInfo[playerid][StartingPoint] = rand;
    DisablePlayerCheckpoint(playerid);
    SetPlayerCheckpoint(playerid, trucker[rand][lx], trucker[rand][ly], trucker[rand][lz], 10);
}
Reply
#2

Any one?
Reply
#3

What do you mean?, do you want it like you set the player ID that you insert to that mission?.
Reply
#4

Yes. when I /work and the other player, Don't get the same mission.
Reply
#5

The new command:

pawn Код:
CMD:convoy(playerid, params[])
{

    new giveplayerid;
    if(sscanf(params, "u",giveplayerid)) return SendClientMessage(playerid, -1, "USAGE: /convoy [playerid]");
    new giveplayerid = ReturnUser(thing);
    if(GetPVarInt(giveplayerid, "PlayerMission") > 0) return SendClientMessage(playerid, -1, "That player is already on the mission!.");
    if(GetPlayerTeam(giveplayerid) == 1) // That player should be in the team
    {
        new m = GetVehicleModel(GetPlayerVehicleID(giveplayerid));
        if(m == 514 || m == 515 || m == 403)
        {
            new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(giveplayerid)));
            if (t == 435 || t == 450 || t == 584)
            {
                if (GetPlayerVehicleSeat(giveplayerid) == 0)
                {
                    Trucker1(giveplayerid);
                }
                else
                {
                    SendClientMessage(playerid, WORK, "That player isn't at the driver seat of the vehicle.");
                }
            }
            else
            {
                SendClientMessage(playerid, WORK, "That player doesn't have the correct trailer, tell him to attach one!");
            }
        }
        else
        {
            SendClientMessage(playerid, WORK, "That player isn't on a truck, tell him to get one!.");
        }
    }
    return 1;
}

improvement of the public:

pawn Код:
stock Trucker1(playerid)
{
    new rand = random(sizeof(trucker));
    PlayerInfo[playerid][StartingPoint] = rand;
    DisablePlayerCheckpoint(playerid);
    SetPlayerCheckpoint(playerid, trucker[rand][lx], trucker[rand][ly], trucker[rand][lz], 10);
    SetPVarInt(playerid, "PlayerMission", 1); // the player is on the mission!.
    return 1;
}
Reply
#6

When I do other player ids. wont do the mission. if I type my id. I get a mission.


pawn Код:
CMD:convoy(playerid, params[])
{
    new thing[128];
    ReturnUser(thing);
    new giveplayerid;
    if(sscanf(params, "u",giveplayerid)) return SendClientMessage(playerid, -1, "USAGE: /convoy [playerid]");
    //if(GetPVarInt(giveplayerid, "PlayerMission") > 1) return SendClientMessage(playerid, COLOUR_RED, "Error: {FFFFFF}That player is already on the mission!");
    if(GetPlayerTeam(giveplayerid) == 1) // That player should be in the team
    {
        new m = GetVehicleModel(GetPlayerVehicleID(giveplayerid));
        if(m == 514 || m == 515 || m == 403)
        {
            new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(giveplayerid)));
            if (t == 435 || t == 450 || t == 584)
            {
                if (GetPlayerVehicleSeat(giveplayerid) == 0)
                {
                    Trucker1(giveplayerid);
                    JobStep[playerid] = 1;
                    truckchecktime = SetTimerEx("TruckCheck", 1000, true, "i", playerid);
                }
                else
                {
                    SendClientMessage(playerid, WORK, "That player isn't at the driver seat of the vehicle.");
                }
            }
            else
            {
                SendClientMessage(playerid, WORK, "That player doesn't have the correct trailer, tell him to attach one!");
            }
        }
        else
        {
            SendClientMessage(playerid, WORK, "That player isn't on a truck, tell him to get one!");
        }
    }
    return 1;
}
Reply
#7

Any one?
Reply
#8

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
When I do other player ids. wont do the mission. if I type my id. I get a mission.
What does it say when you do it to other people?
Reply
#9

Quote:
Originally Posted by awsomedude
Посмотреть сообщение
What does it say when you do it to other people?
Nothing when I type /convoy 1 don't get the same mission. If the player type /work then I type /convoy 1
Reply
#10

Shouldn't this
pawn Код:
JobStep[playerid] = 1;
truckchecktime = SetTimerEx("TruckCheck", 1000, true, "i", playerid);
be
pawn Код:
JobStep[giveplayerid] = 1;
truckchecktime = SetTimerEx("TruckCheck", 1000, true, "i", giveplayerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)