I cant load armory equipment
#1

I made these commands to be able to load my armory but they dont work like i want them to do..
When i type /loadarmory and i am trucker it say im not trucker, if i use the cars that i put it say that i cant deliver with that car.. Here is the code
pawn Код:
if(strcmp(cmd, "/loadarmory", true) == 0)
    {
        if(PlayerInfo[playerid][pJob] == 16)
        {
            if(PlayerInfo[playerid][pArmoryrefill] == 0)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                if(IsPlayerInRangeOfPoint(playerid, 2,-65.3189,-1119.7914,1.0781))
                {
                    if(GetVehicleModel(tmpcar) == 456 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 578 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
                    {
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, "You have loaded your truck with armory equipment!");
                        SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "* The Government have paid the bill for loading armory equipment.");
                        PlayerInfo[playerid][pArmoryrefill] = 1;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "You are NOT a Trucker");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You are NOT at the Armory loading place!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't load with this vehicle!");
        }
        return 1;
    }
Reply
#2

You messed up a lot. Here's the working code for you.

pawn Код:
if(strcmp(cmd, "/loadarmory", true) == 0)
    {
        if(PlayerInfo[playerid][pJob] == 16)
        {
            if(PlayerInfo[playerid][pArmoryrefill] == 0)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                if(IsPlayerInRangeOfPoint(playerid, 2,-65.3189,-1119.7914,1.0781))
                {
                    if(GetVehicleModel(tmpcar) == 456 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 578 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
                    {
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, "You have loaded your truck with armory equipment!");
                        SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "* The Government have paid the bill for loading armory equipment.");
                        PlayerInfo[playerid][pArmoryrefill] = 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You can't load with this vehicle!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "You are NOT at the Armory loading place!");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You are already loaded.");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You are not a Trucker!");
        }
        return 1;
    }
Reply
#3

Okey, Well did i mess this command up too?
pawn Код:
if(strcmp(cmd, "/unloadarmory", true) == 0)
    {
        if(PlayerInfo[playerid][pJob] == 16)
        {
            if(PlayerInfo[playerid][pArmoryrefill] == 1)
            {
                new tmpcar = GetPlayerVehicleID(playerid);
                if(IsPlayerInRangeOfPoint(playerid, 2,1567.2455,-1691.3341,5.8906))
                {
                    if(GetVehicleModel(tmpcar) == 456 || GetVehicleModel(tmpcar) == 440 || GetVehicleModel(tmpcar) == 514 || GetVehicleModel(tmpcar) == 578 || GetVehicleModel(tmpcar) == 403 || GetVehicleModel(tmpcar) == 515)
                    {
                        SendClientMessage(playerid, TEAM_GROVE_COLOR, "You have loaded your truck with armory equipment!");
                        SendClientMessage(playerid, TEAM_AZTECAS_COLOR, "* The Government have paid the bill for loading armory equipment.");
                        PlayerInfo[playerid][pArmoryrefill] = 0;
                        SafeGivePlayerMoney(playerid, 2500);
                        Armory[ARMOUR] = 15;
                        Armory[MP5] = 20;
                        Armory[SHOTGUN] = 20;
                        Armory[SHIELD] = 15;
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "You are NOT a Trucker");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "You are NOT at the Armory loading place!");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't load with this vehicle!");
        }
        return 1;
    }
Reply
#4

Is there any differance between the IsPlayerInRangeOfPoint and PlayerToPoint? Like, When i use IsPlayerInRangeOfPoint i must stand on the icon for the command to work, but if i use PlayerToPoint is it enough that im close to the point?
Reply
#5

IsPlayerInRangeOfPoint is a native SA-MP function.

PlayerToPoint is defined in your script. I know nothing about it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)