I'm having a problem with this command. -
rangerxxll - 14.09.2011
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?
Re: I'm having a problem with this command. -
Allan Kardec - 14.09.2011
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
Re: I'm having a problem with this command. -
Kush - 14.09.2011
PHP код:
COMMAND:delivery(playerid, params[]) {
new bool:issimplejobrunning [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");
return 1;
}
Re: I'm having a problem with this command. -
Allan Kardec - 14.09.2011
Quote:
Originally Posted by Kush
PHP код:
COMMAND:delivery(playerid, params[]) {
new bool:issimplejobrunning [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");
return 1;
}
|
wrong code
Re: I'm having a problem with this command. -
rangerxxll - 14.09.2011
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
|
At the end, where do I put
?
Re: I'm having a problem with this command. -
Kush - 14.09.2011
Quote:
Originally Posted by Allan Kardec
wrong code
|
Explain to me what is 'wrong about my code'?
Re: I'm having a problem with this command. -
rangerxxll - 14.09.2011

Quote:
Originally Posted by Kush
Explain to me what is 'wrong about my code'?
|
About to test it.
Re: I'm having a problem with this command. -
Allan Kardec - 14.09.2011
Quote:
Originally Posted by rangerxxll
At the end, where do I put ?
|
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;
}
Re: I'm having a problem with this command. -
rangerxxll - 14.09.2011
When complete delivery? I don't completely understand, isn't that what
Is for?
Re: I'm having a problem with this command. -
Allan Kardec - 14.09.2011
not understand
pawn Код:
if(strcmp("/delivered", cmdtext, true) == 0)
{
Delivery[playerid] = 0;
return 1;
}