Convoy
#1

Fixed Thanks.
Reply
#2

i also noticed some mistakes that will cause bugs to ur command so please explain a bit more further
pawn Код:
CMD:convoy(playerid, params[])
{
        if (GetPlayerTeam(playerid) == 1)
        {
            if(PlayerInfo[playerid][pConvoy] > 0)
            {
            // the loop cause the randomization so i removed it
                //if(PlayerInfo[i][pConvoy] == PlayerInfo[playerid][pConvoy]) //i need more explanation about this check  cause convoys differs from every player the convoy++ proves it
                //{
                    if(sscanf(params, "u",i)) return SendClientMessage(playerid, -1, "USAGE: /convoy [playerid]");
                    // some unnecessary brackets removed
                    if(i==INVALID_PLAYER_ID) return SendClientMessage(playerid,-1 "Invalid Player");
                    if(PlayerInfo[i][pConvoy]<1) return SendClientMessage(playerid,-1,"Targer player is not in trucker mission");
                        new m = GetVehicleModel(GetPlayerVehicleID(i));
                        if(m == 514 || m == 515 || m == 403)
                        {
                            new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(i)));
                            if (t == 435 || t == 450 || t == 584)
                            {
                                if (GetPlayerVehicleSeat(i) == 0)
                                {
                                    // comes from ur trucker1 stock
                                    new pmission=PlayerInfo[i][StartingPoint];
                                    PlayerInfo[playerid][StartingPoint] = pmission;
                                    DisablePlayerCheckpoint(playerid);
                                    SetPlayerCheckpoint(playerid, trucker[pmission][lx], trucker[pmission][ly], trucker[pmission][lz], 10);
                                    //truckchecktime = SetTimerEx("TruckCheck", 1000, true, "i", playerid);
                                }
                                else
                                {
                                    SendClientMessage(i, WORK, "You are not the driver of this vehicle");
                                }
                            }
                            else
                            {
                                SendClientMessage(i, WORK, "You do not have the correct trailer, please go and attach one!");
                            }
                        }
                        else
                        {
                            SendClientMessage(i, WORK, "You are not in a truck, please go and get one!");
                        }

                //}
            }
        }
        SendMessageToAdmins(playerid, 0xB3B3B3FF, "/convoy");// ????
        return 1;
}
Reply
#3

Quote:
Originally Posted by Quickie
Посмотреть сообщение
i also noticed some mistakes that will cause bugs to ur command so please explain a bit more further
pawn Код:
CMD:convoy(playerid, params[])
{
        if (GetPlayerTeam(playerid) == 1)
        {
            if(PlayerInfo[playerid][pConvoy] > 0)
            {
            // the loop cause the randomization so i removed it
                //if(PlayerInfo[i][pConvoy] == PlayerInfo[playerid][pConvoy]) //i need more explanation about this check  cause convoys differs from every player the convoy++ proves it
                //{
                    if(sscanf(params, "u",i)) return SendClientMessage(playerid, -1, "USAGE: /convoy [playerid]");
                    // some unnecessary brackets removed
                    if(i==INVALID_PLAYER_ID) return SendClientMessage(playerid,-1 "Invalid Player");
                    if(PlayerInfo[i][pConvoy]<1) return SendClientMessage(playerid,-1,"Targer player is not in trucker mission");
                        new m = GetVehicleModel(GetPlayerVehicleID(i));
                        if(m == 514 || m == 515 || m == 403)
                        {
                            new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(i)));
                            if (t == 435 || t == 450 || t == 584)
                            {
                                if (GetPlayerVehicleSeat(i) == 0)
                                {
                                    // comes from ur trucker1 stock
                                    new pmission=PlayerInfo[i][StartingPoint];
                                    PlayerInfo[playerid][StartingPoint] = pmission;
                                    DisablePlayerCheckpoint(playerid);
                                    SetPlayerCheckpoint(playerid, trucker[pmission][lx], trucker[pmission][ly], trucker[pmission][lz], 10);
                                    //truckchecktime = SetTimerEx("TruckCheck", 1000, true, "i", playerid);
                                }
                                else
                                {
                                    SendClientMessage(i, WORK, "You are not the driver of this vehicle");
                                }
                            }
                            else
                            {
                                SendClientMessage(i, WORK, "You do not have the correct trailer, please go and attach one!");
                            }
                        }
                        else
                        {
                            SendClientMessage(i, WORK, "You are not in a truck, please go and get one!");
                        }

                //}
            }
        }
        SendMessageToAdmins(playerid, 0xB3B3B3FF, "/convoy");// ????
        return 1;
}
pawn Код:
(1191) : error 001: expected token: ",", but found "-string-"
(1191) : warning 215: expression has no effect
(1191) : error 001: expected token: ";", but found ")"
(1191) : error 029: invalid expression, assumed zero
(1191) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

4 Errors.
Line: 1191
pawn Код:
if(i==INVALID_PLAYER_ID) return SendClientMessage(playerid,-1 "Invalid Player");
and i added a textdraw + new string[256];
new rand = random(sizeof(trucker));
PlayerInfo[pmission][StartingPoint] = rand;



so it can start the mission


pawn Код:
CMD:convoy(playerid, params[])
{
        if (GetPlayerTeam(playerid) == 1)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            if(PlayerInfo[playerid][pConvoy] > 0)
            {
            // the loop cause the randomization so i removed it
                if(PlayerInfo[i][pConvoy]) //i need more explanation about this check  cause convoys differs from every player the convoy++ proves it
                {
                    if(sscanf(params, "u",i)) return SendClientMessage(playerid, -1, "USAGE: /convoy [playerid]");
                    // some unnecessary brackets removed
                    //if(i==INVALID_PLAYER_ID) return SendClientMessage(playerid,-1 "Invalid Player");
                    if(PlayerInfo[i][pConvoy]<1) return SendClientMessage(playerid,-1,"Targer player is not in trucker mission");
                        new m = GetVehicleModel(GetPlayerVehicleID(i));
                        if(m == 514 || m == 515 || m == 403)
                        {
                            new t = GetVehicleModel(GetVehicleTrailer(GetPlayerVehicleID(i)));
                            if (t == 435 || t == 450 || t == 584)
                            {
                                if (GetPlayerVehicleSeat(i) == 0)
                                {
                                    // comes from ur trucker1 stock
                                    new pmission=PlayerInfo[i][StartingPoint];
                                    PlayerInfo[playerid][StartingPoint] = pmission;
                                    DisablePlayerCheckpoint(playerid);
                                    SetPlayerCheckpoint(playerid, trucker[pmission][lx], trucker[pmission][ly], trucker[pmission][lz], 10);
                                    new string[256];
                                    new rand = random(sizeof(trucker));
                                    PlayerInfo[pmission][StartingPoint] = rand;
                                    format(string, sizeof(string), "go to ~r~%s ~w~to load  with ~y~%s", trucker[rand][lpname], trucker[rand][loadname]);
                                    TextDrawSetString(work[playerid], string);
                                    TextDrawShowForPlayer(playerid, work[playerid]);
                                    //truckchecktime = SetTimerEx("TruckCheck", 1000, true, "i", playerid);
                                    SendClientMessage(i, WORK, "Testing");
                                }
                                else
                                {
                                    SendClientMessage(i, WORK, "You are not the DRIVER of this vehicle");
                                }
                            }
                            else
                            {
                                SendClientMessage(i, WORK, "You do not have the correct trailer, please go and attach one!");
                            }
                        }
                        else
                        {
                            SendClientMessage(i, WORK, "You are not in a truck, please go and get one!");
                        }

                }
            }
        }
        SendMessageToAdmins(playerid, 0xB3B3B3FF, "/convoy");// ????
        return 1;
}
Reply
#4

pawn Код:
if(i==INVALID_PLAYER_ID) return SendClientMessage(playerid,-1, "Invalid Player");// typo "," :D
Reply
#5

Thank you it worked +rep
Reply
#6

i think you shouldnt add
pawn Код:
new rand = random(sizeof(trucker));
PlayerInfo[pmission][StartingPoint] = rand; //PlayerInfo[playerid][StartingPoint]?????
that will cause the PlayerInfo[playerid][StartingPoint] differs from the id he typed in /convoy <id> (PlayerInfo[id][StartingPoint] so they seems not working with each other
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)