/convoy (playerid)
#1

User wont give same mission? random missions


pawn Код:
COMMAND:convoy(playerid, params[])
{
        new thing[128];
        SendMessageToAdmins(playerid, -1, "/convoy", params);
        if (strlen(thing) == 0)
        {
            SendClientMessage(playerid, WORK, "USAGE: /convoy [playerid]");
        }
        new rand;
        rand = random(sizeof(trucker));
        SetPVarInt(playerid, "PlayerMission", rand);
       
        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);
                        SendClientMessage(playerid, WORK, "If you lose your trailer, you will need to re-attach it to deliver");
                    }
                    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 Код:
forward Trucker1(playerid);
public Trucker1(playerid)
{
    new rand = random(sizeof(trucker));
    PlayerInfo[playerid][StartingPoint] = rand;
    DisablePlayerCheckpoint(playerid);
    SetPlayerCheckpoint(playerid, trucker[rand][ux], trucker[rand][uy], trucker[rand][uz], 10);
}
Reply
#2

Anyone?
Reply
#3

Maybe you could do:

foreach(Player, i) {
if(GetPVarInt(i, "PlayerMission" == random)
// Put code here //
}

That will check if any online player's currently have that mission.
Reply
#4

pawn Код:
foreach(Player, i) {
if(GetPVarInt(i, "PlayerMission" == random)
  new rand = random(sizeof(trucker));
}
like that?


What code should go there?
Reply
#5

foreach(Player, i) {
if(GetPVarInt(i, "PlayerMission" == random)
return cmd_convoy(playerid, params[]);
}

You could re-call the command which will basically try this again, and if the random is the same or is being used it will keep looping the command until eventually it get's one not being used(hope-fully).
Reply
#6

I can do it like:
foreach(Player, i)
{
SetPVarInt(i, "PlayerMission", rand);
}



Still doing RandonMission.
Reply
#7

That would give all the player's the same mission, I don't really get the point of that.
Reply
#8

Quote:
Originally Posted by Abagail
Посмотреть сообщение
That would give all the player's the same mission, I don't really get the point of that.
Still doing random missions. here is the command.


pawn Код:
COMMAND:convoy(playerid, params[])
{
        new thing[128];
        SendMessageToAdmins(playerid, -1, "/convoy", params);
        if (strlen(thing) == 0)
        {
            SendClientMessage(playerid, WORK, "USAGE: /convoy [playerid]");
        }
        new rand;
        rand = random(sizeof(trucker));
        //SetPVarInt(playerid, "PlayerMission", rand);
        foreach(Player, i)
        {
           SetPVarInt(i, "PlayerMission", rand);
        }

        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);
                        SendClientMessage(playerid, WORK, "If you lose your trailer, you will need to re-attach it to deliver");
                    }
                    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;
}
Reply
#9

If you don't want random missions then remove the
pawn Код:
new rand = random(..)
And assign the players who are included into the convoy to same mission.
Reply
#10

Quote:
Originally Posted by LocMax
Посмотреть сообщение
If you don't want random missions then remove the
pawn Код:
new rand = random(..)
And assign the players who are included into the convoy to same mission.
?!??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)