SA-MP Forums Archive
/loadtruck command won't work properly - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /loadtruck command won't work properly (/showthread.php?tid=540039)



/loadtruck command won't work properly - Josh_Main - 02.10.2014

Hey, I'm in the middle of creating a trucking system. But I can't seem to figure this out. When I type /loadtruck at the point, it still sends me the message "You are not in range of the loading area", even when I am. I want it to only return this message if I am not in range of the /loadtruck area.

pawn Код:
CMD:loadtruck(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 866.5, -1212, 16.9, 10))
    {
        if(Removalist[playerid]  == 0)
        {
            Removalist[playerid] = 1;
            SendClientMessage(playerid, GREY, "You have loaded your truck with furniture!");
            SetPlayerCheckpoint(playerid, 850.6198, -1483.6526, 13.3298, 3.0);
            SendClientMessage(playerid, GREY, "Take the furniture to the businesses to receive your payment.  A location has been marked on your map!");
            AddStaticVehicle(515, 850.6198, -1483.6526, 13.3298, 90,  -1, -1);
        }
        else
            {
                SendClientMessage(playerid, GREY, "You are already doing a job!");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, GREY, "You are not in range of the loading area!");
            return 1;
        }
    return 1;
    }
Also, could anyone please tell me why AddStaticVehicle isn't adding a vehicle? Even when I got rid of IsPlayerInRangeOfPoint to test if the command works, it won't place the vehicle.

Thank you!!


Re: /loadtruck command won't work properly - Rudy_ - 02.10.2014

pawn Код:
CMD:loadtruck(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 866.5, -1212, 16.9, 10))
    {
        if(Removalist[playerid]  == 0)
        {
            Removalist[playerid] = 1;
            SendClientMessage(playerid, GREY, "You have loaded your truck with furniture!");
            SetPlayerCheckpoint(playerid, 850.6198, -1483.6526, 13.3298, 3.0);
            SendClientMessage(playerid, GREY, "Take the furniture to the businesses to receive your payment.  A location has been marked on your map!");
            AddStaticVehicle(515, 850.6198, -1483.6526, 13.3298, 90,  -1, -1);
        }
        else
        {
            SendClientMessage(playerid, GREY, "You are already doing a job!");
        }
    }
    else
    {
        SendClientMessage(playerid, GREY, "You are not in range of the loading area!");
    }
    return 1;
}



Re: /loadtruck command won't work properly - Josh_Main - 02.10.2014

Quote:
Originally Posted by Rudy_
Посмотреть сообщение
pawn Код:
CMD:loadtruck(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 866.5, -1212, 16.9, 10))
    {
        if(Removalist[playerid]  == 0)
        {
            Removalist[playerid] = 1;
            SendClientMessage(playerid, GREY, "You have loaded your truck with furniture!");
            SetPlayerCheckpoint(playerid, 850.6198, -1483.6526, 13.3298, 3.0);
            SendClientMessage(playerid, GREY, "Take the furniture to the businesses to receive your payment.  A location has been marked on your map!");
            AddStaticVehicle(515, 850.6198, -1483.6526, 13.3298, 90,  -1, -1);
        }
        else
        {
            SendClientMessage(playerid, GREY, "You are already doing a job!");
        }
    }
    else
    {
        SendClientMessage(playerid, GREY, "You are not in range of the loading area!");
    }
    return 1;
}
Thanks for the reply man, but it still says "You are not in range of the loading area!"


Re: /loadtruck command won't work properly - Vince - 02.10.2014

Check the order of your parameters. They're all in the wrong order. It's actually checking if the player is in range of 866.5 from the point -1212, 16.9, 10, rather than in a range of 10 from the point 866.5, -1212, 16.9.


Re: /loadtruck command won't work properly - Josh_Main - 02.10.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
Check the order of your parameters. They're all in the wrong order. It's actually checking if the player is in range of 866.5 from the point -1212, 16.9, 10, rather than in a range of 10 from the point 866.5, -1212, 16.9.
Oh shit! Thanks man I didn't even release. Thank you!