I'm having a problem with this command.
#1

When I do /work and start the job, then drive to the delivery spot and do /delivery I want to make it so you cant do /delivery again. Like you got to drive back to work and do /work to start over. But right now, when i go to the delivery spot and do /delivery, I can keep doing it over and over. I want to change that. Here's my current code
pawn Код:
COMMAND:delivery(playerid, cmdtext)
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 1829.40002441,-1075.30004883,23.39999962)) return SendClientMessage(playerid, COLOR_RED, "You're not near the delivery spot!");
    {

        if(simplejobrunning[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You haven't started the job yet!");
        {
            GivePlayerMoney(playerid, 7500);
            SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
        }
    }
    return 1;
}
What do I need to do to fix it?
Reply
#2

pawn Код:
new
     Delivery[MAX_PLAYERS]
;
pawn Код:
COMMAND:delivery(playerid, cmdtext)
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 1829.40002441,-1075.30004883,23.39999962)) return SendClientMessage(playerid, COLOR_RED, "You're not near the delivery spot!");
    {
        if(Delivery[playerid] == 1) return SendClientMessage(playerid, -1, "You're making a delivery!");
        if(simplejobrunning[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You haven't started the job yet!");
        {
            GivePlayerMoney(playerid, 7500);
            SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
        }
    }
    Delivery[playerid] = 1;
    return 1;
}

When he finished delivering the seven delivery to 0

pawn Код:
Delivery[playerid] = 0;
Reply
#3

PHP код:
COMMAND:delivery(playeridparams[]) {
    new 
bool:issimplejobrunning [MAX_PLAYERS];
    if(!
IsPlayerInRangeOfPoint(playerid7.01829.40002441,-1075.30004883,23.39999962)) return SendClientMessage(playeridCOLOR_RED"You're not near the delivery spot!");
    if(
simplejobrunning[playerid] == false) return SendClientMessage(playeridCOLOR_RED"You haven't started the job yet!");
    
GivePlayerMoney(playerid7500);
     
SendClientMessage(playeridblue"Congratulations, you have earned 7500");
     return 
1;

Reply
#4

Quote:
Originally Posted by Kush
Посмотреть сообщение
PHP код:
COMMAND:delivery(playeridparams[]) {
    new 
bool:issimplejobrunning [MAX_PLAYERS];
    if(!
IsPlayerInRangeOfPoint(playerid7.01829.40002441,-1075.30004883,23.39999962)) return SendClientMessage(playeridCOLOR_RED"You're not near the delivery spot!");
    if(
simplejobrunning[playerid] == false) return SendClientMessage(playeridCOLOR_RED"You haven't started the job yet!");
    
GivePlayerMoney(playerid7500);
     
SendClientMessage(playeridblue"Congratulations, you have earned 7500");
     return 
1;

wrong code
Reply
#5

Quote:
Originally Posted by Allan Kardec
Посмотреть сообщение
pawn Код:
new
     Delivery[MAX_PLAYERS]
;
pawn Код:
COMMAND:delivery(playerid, cmdtext)
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 1829.40002441,-1075.30004883,23.39999962)) return SendClientMessage(playerid, COLOR_RED, "You're not near the delivery spot!");
    {
        if(Delivery[playerid] == 1) return SendClientMessage(playerid, -1, "You're making a delivery!");
        if(simplejobrunning[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You haven't started the job yet!");
        {
            GivePlayerMoney(playerid, 7500);
            SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
        }
    }
    Delivery[playerid] = 1;
    return 1;
}

When he finished delivering the seven delivery to 0

pawn Код:
Delivery[playerid] = 0;
At the end, where do I put
pawn Код:
Delivery[playerid] = 0;
?
Reply
#6

Quote:
Originally Posted by Allan Kardec
Посмотреть сообщение
wrong code
Explain to me what is 'wrong about my code'?
Reply
#7

Quote:
Originally Posted by Kush
Посмотреть сообщение
Explain to me what is 'wrong about my code'?
About to test it.
Reply
#8

Quote:
Originally Posted by rangerxxll
Посмотреть сообщение
At the end, where do I put
pawn Код:
Delivery[playerid] = 0;
?
when complete delivery

Quote:
Originally Posted by Kush
Посмотреть сообщение
Explain to me what is 'wrong about my code'?
you forgot to set to 1 when it is already doing the delivery and the array is a set with another and with this would be the correct

pawn Код:
COMMAND:delivery(playerid, params[])
{
    new bool:simplejobrunning[MAX_PLAYERS];
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 1829.40002441,-1075.30004883,23.39999962)) return SendClientMessage(playerid, COLOR_RED, "You're not near the delivery spot!");
    if(simplejobrunning[playerid] == false) return SendClientMessage(playerid, COLOR_RED, "You haven't started the job yet!");
    GivePlayerMoney(playerid, 7500);
     SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
     simplejobrunning[playerid] = 1; // here
     return 1;
}
Reply
#9

When complete delivery? I don't completely understand, isn't that what
pawn Код:
Delivery[playerid] = 1;
Is for?
Reply
#10

not understand

pawn Код:
if(strcmp("/delivered", cmdtext, true) == 0)
{
     Delivery[playerid] = 0;
     return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)