OnPlayerEnterCheckpoint
#1

Problem solved:

if(IsPlayerInAnyVehicle(veh))
It should be if(IsPlayerInAnyVehicle(playerid))




I can't get it to work, it doesn't give any errors or warnings. Everytime I enter the checkpoint it really does nothing except for de-spawning the checkpoint.



pawn Код:
if(PlayerIsTrucking[playerid] == 1)
    {
        new veh = GetPlayerVehicleID(playerid);
        new orderid = PlayerInfo[playerid][pTruckerOrder];
        if(IsPlayerInAnyVehicle(veh))
        {
            if(IsPlayerInRangeOfPoint(playerid, 4, OrderInfo[orderid][oDropoffX], OrderInfo[orderid][oDropoffY], OrderInfo[orderid][oDropoffZ]))
            {
                SCM(playerid, WHITE, "Products deliverd");
                PlayerIsTrucking[playerid] = 0;
            }
        }
    }
    else DisablePlayerCheckpoint(playerid);

pawn Код:
COMMAND:takeorder(playerid, params[])
{
    new string[250], orderid, spawn;

    if(!IsPlayerLoggedIn(playerid)) return SCM(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsPlayerInRangeOfPoint(playerid, 2.0, 1782.9767,-1704.8790,13.5212)) return SCM(playerid, COLOR_GREY, "You are not at the product depot.");
    if(PlayerIsTrucking[playerid] == 1) return SCM(playerid, COLOR_GREY, "You are already doing another order.");
   
    if(PlayerInfo[playerid][pJob] != JOB_TRUCKER && PlayerInfo[playerid][pVIPJob] != JOB_TRUCKER) return SCM(playerid, COLOR_GREY, "You are not a trucker.");

    if(sscanf(params, "i", orderid))
    {
        SCM(playerid, WHITE, "[Parameters]: /takeorder [order id]");
        return true;
    }

    if(!OrderInfo[orderid][oPlaced]) return SCM(playerid, GREY, "This order has not been placed.");
    if(OrderInfo[orderid][oTaken]) return SCM(playerid, GREY, "This order has been taken by someone else.");
    //if(PlayerInfo[playerid][pOrder] == orderid) return SCM(playerid, GREY, "You can't take your own order.");

    OrderInfo[orderid][oTaken] = 1;
   
    foreach(Player, i)
    {
        if(IsPlayerLoggedIn(i) && PlayerInfo[i][pOrder] == orderid)
        {
            format(string, sizeof(string), "Trucker %s has accepted your order and is now on his way to deliver the products.", RPN(playerid));
            SCM(i, WHITE, string);
        }
    }

    PlayerIsTrucking[playerid] = 1;
    PlayerInfo[playerid][pTruckerOrder] = orderid;
    format(string, sizeof(string), "You have accepted order number %d", orderid);
    SendClientMessage(playerid, COLOR_WHITE, string);
   
    spawn = random(4);
    switch(spawn)
    {
        case 0:
        {
            new carid1 = CreateVehicle(499,1777.8176,-1691.2911,13.4316,180.7183,0,0,1200);
            PutPlayerInVehicle(playerid,carid1, 0);
        }
        case 1:
        {
            new carid2 = CreateVehicle(499,1772.5509,-1691.3591,13.4238,180.4784,0,0,1200);
            PutPlayerInVehicle(playerid,carid2, 0);
        }
        case 2:
        {
            new carid3 = CreateVehicle(499,1783.2278,-1691.3177,13.4388,179.9386,0,0,1200);
            PutPlayerInVehicle(playerid,carid3, 0);
        }
        case 3:
        {
            new carid4 = CreateVehicle(499,1788.9263,-1691.2449,13.4534,180.4550,0,0,1200);
            PutPlayerInVehicle(playerid,carid4, 0);
        }
    }
   
    SetPlayerCheckpoint(playerid, OrderInfo[orderid][oDropoffX],OrderInfo[orderid][oDropoffY],OrderInfo[orderid][oDropoffZ], 4.0);
    return true;
}
Reply
#2

First of all, you must use a streamer. Download Incognito's streamer, because with SetPlayerCheckPoint you can only stream one checkpoint at a time! Second of all, I don't see what's the problem with your code "if(PlayerIsTrucking[playerid] == 1)" I first thought that the problem might be there, but it's not...
Reply
#3

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
First of all, you must use a streamer. Download Incognito's streamer, because with SetPlayerCheckPoint you can only stream one checkpoint at a time! Second of all, I don't see what's the problem with your code "if(PlayerIsTrucking[playerid] == 1)" I first thought thaat the problem might be there, but it's not...
I've found the problem, it's if(IsPlayerInAnyVehicle(veh))
It should be if(IsPlayerInAnyVehicle(playerid))

But thanks for looking into it anyway!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)