SA-MP Forums Archive
If player has load already, he can't use /loadtruck - 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: If player has load already, he can't use /loadtruck (/showthread.php?tid=540088)



If player has load already, he can't use /loadtruck - Josh_Main - 02.10.2014

Hey, in the middle of making a trucking job in ls. Everything is going good so far, all I need to know is how I can not let the player use /loadtruck if he already has done /loadtruck and is in the middle of delivering a load.

pawn Код:
CMD:loadtruck(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10, 866.5, -1212, 16.9))
    {
            // I've already tried using if(PlayerStat[playerid][Removalist] = 1; but when i made the else statement underneath all of it, whenever i typed /loadtruck even if i hadn't used the command before, for some reason it would still say "You don't have the trucker job!"
            PlayerStat[playerid][Removalist] = 1;
            SetPlayerCheckpoint(playerid, 850.6198, -1483.6526, 13.3298, 3.0);
            SendClientMessage(playerid, ORANGE, "Take the furniture to the businesses to receive your payment.  A location has been marked on your map!");
            SendClientMessage(playerid, ORANGE, "Reverse the truck into the trailer behind it to connect the load of furtniture!");
    }
    else
    {
        SendClientMessage(playerid, GREY, "You are not near the delivery loading area!");
    }
    return 1;
}



Re: If player has load already, he can't use /loadtruck - mant - 02.10.2014

its time 3 or 2 u are posting this code stop making new topic with old code


Re: If player has load already, he can't use /loadtruck - Josh_Main - 02.10.2014

I'm not asking the same question everytime, I'm trying to get help.


Re: If player has load already, he can't use /loadtruck - Rudy_ - 02.10.2014

pawn Код:
new InMiddle[MAX_PLAYERS];
Add this when ever player is not in Truck job, 'OnPlayerDisconnect' or when job finishes etc
pawn Код:
InMiddle[playerid] = 0;
pawn Код:
CMD:loadtruck(playerid, params[])
{
    if(InMiddle[playerid] == 0) else SendClientMessage(playerid, -1, "You are already in truck job");
    {
        if(IsPlayerInRangeOfPoint(playerid, 10, 866.5, -1212, 16.9))
        {
            InMiddle = 1;
            PlayerStat[playerid][Removalist] = 1;
            SetPlayerCheckpoint(playerid, 850.6198, -1483.6526, 13.3298, 3.0);
            SendClientMessage(playerid, ORANGE, "Take the furniture to the businesses to receive your payment.  A location has been marked on your map!");
            SendClientMessage(playerid, ORANGE, "Reverse the truck into the trailer behind it to connect the load of furtniture!");
        }
        else
        {
            SendClientMessage(playerid, GREY, "You are not near the delivery loading area!");
        }
    }
    return 1;
}