Making sure he has the package - Help!
#1

Sorry for all these thread but im having another trouble, I created a job kind of and It's all setup but how can I make it so when we does /delivermats it will make sure he HAS the materials.

The two commands(/getmats & /delivermats):


Код:
CMD:getmats(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 1168.90, 1361.76, 10.50)) return SCM(playerid, COLOR_WHITE, "You aren't at the material's pickup point!");
    {
        SendClientMessage(playerid,COLOR_RED,"You have gotten a materials package, deliver it to the checkpoint to recieve the materials.");
        SetPlayerCheckpoint(playerid, 2179.7886,-2263.6206,14.7734, 3.0);
        PlayerInfo[playerid][pGotMaterials] = 1;
    }
	return 1;
}

CMD:delivermats(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 2179.7886,-2263.6206,14.7734)) return SCM(playerid, COLOR_WHITE, "You aren't at the material's drop-off point!");
    {
        SendClientMessage(playerid,COLOR_RED,"You delivered the package and recieved 250 materials.");
        PlayerInfo[playerid][pMaterials] = 250;
    }
	return 1;
}
Thank you for everybody helping me, means so much!

I need it to make sure it's in range aswell as making sure it has the package, if you look on /getmats it gives him the package: PlayerInfo[playerid][pGotMaterials] = 1; - So how can I make it so when he deliver's it removes the 1 package aswell as making sure he has it when using /delivermats

Thanks again!

EDIT: I tried it and once you do one materials run you can't do another, probably because it still has the 1 pGotMaterials, so how can I remove this once delivering too, thanks
Reply
#2

if(PlayerInfo[playerid][pPackage] > 0) {


^ An example.

Quote:

This forum requires that you wait 120 seconds between posts. Please try again in 6 seconds.

Reply
#3

How would I make it with the making sure he's at the marker area though?
Reply
#4

pawn Код:
CMD:getmats(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 1168.90, 1361.76, 10.50)) return SCM(playerid, COLOR_WHITE, "You aren't at the material's pickup point!");
    {
        SendClientMessage(playerid,COLOR_RED,"You have gotten a materials package, deliver it to the checkpoint to recieve the materials.");
        SetPlayerCheckpoint(playerid, 2179.7886,-2263.6206,14.7734, 3.0);
        PlayerInfo[playerid][pGotMaterials] = 1;
    }
    return 1;
}

CMD:delivermats(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 2179.7886,-2263.6206,14.7734)) return SCM(playerid, COLOR_WHITE, "You aren't at the material's drop-off point!");
    {
        if(PlayerInfo[playerid][pGotMaterials] == 0) return SendClientMessage(playerid, COLOR_GREY, "You do not have the packages.");
        SendClientMessage(playerid,COLOR_RED,"You delivered the package and recieved 250 materials.");
        PlayerInfo[playerid][pMaterials] = 250;
    }
    return 1;
}
Reply
#5

Thank you so much man!

How can I make it so the pGotMaterial's goes back to 0 once he deliver's it successfully?
Reply
#6

PlayerInfo[playerid][pGotMaterial] = 0;
Reply
#7

Meh, I need some sleep.
pawn Код:
CMD:getmats(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 1168.90, 1361.76, 10.50)) return SCM(playerid, COLOR_WHITE, "You aren't at the material's pickup point!");
    {
        SendClientMessage(playerid,COLOR_RED,"You have gotten a materials package, deliver it to the checkpoint to recieve the materials.");
        SetPlayerCheckpoint(playerid, 2179.7886,-2263.6206,14.7734, 3.0);
        PlayerInfo[playerid][pGotMaterials] = 1;
    }
    return 1;
}

CMD:delivermats(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 2179.7886,-2263.6206,14.7734)) return SCM(playerid, COLOR_WHITE, "You aren't at the material's drop-off point!");
    {
        if(PlayerInfo[playerid][pGotMaterials] == 0) return SendClientMessage(playerid, COLOR_GREY, "You do not have the packages.");
        SendClientMessage(playerid,COLOR_RED,"You delivered the package and recieved 250 materials.");
        PlayerInfo[playerid][pMaterials] = 250;
        PlayerInfo[playerid][pGotMaterials] = 0;
    }
    return 1;
}
Reply
#8

Thanks guys!

One problem though, my material's dont update once I delivered them, they stay at my current which is 250, anyone?
Reply
#9

Use += and -= operators instead of = operators for incremental and decremental.
pawn Код:
CMD:getmats(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 3.0, 1168.90, 1361.76, 10.50)) return SCM(playerid, COLOR_WHITE, "You aren't at the material's pickup point!");
    {
        SendClientMessage(playerid,COLOR_RED,"You have gotten a materials package, deliver it to the checkpoint to recieve the materials.");
        SetPlayerCheckpoint(playerid, 2179.7886,-2263.6206,14.7734, 3.0);
        PlayerInfo[playerid][pGotMaterials] = 1;
    }
    return 1;
}

CMD:delivermats(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 5.0, 2179.7886,-2263.6206,14.7734)) return SCM(playerid, COLOR_WHITE, "You aren't at the material's drop-off point!");
    {
        if(PlayerInfo[playerid][pGotMaterials] == 0) return SendClientMessage(playerid, COLOR_GREY, "You do not have the packages.");
        SendClientMessage(playerid,COLOR_RED,"You delivered the package and recieved 250 materials.");
        PlayerInfo[playerid][pMaterials] += 250;
        PlayerInfo[playerid][pGotMaterials] = 0;
    }
    return 1;
}
Reply
#10

Tryed that for some reason it didn't update, maybe my fault on my stats scripting, will let you know.

In my character file it says I still have the package when I should do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)