18.05.2016, 22:04
Quote:
ok now i can only pick up the first one that i planted. Others that are created after that cant be picked.
|
And one return stops the whole for loops, therefore only the first one worked
Moved the wrong return and message outside the loop
PHP код:
else if(strcmp(x_nr,"colher",true) == 0)
{
if(PlayerInfo[playerid][pFaction] == 7 || PlayerInfo[playerid][pFaction] == 8)
{
for(new c = 0; c < sizeof(DrugInfo); c++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, DrugInfo[c][sementeposX], DrugInfo[c][sementeposY], DrugInfo[c][sementeposZ]))
{
if(DrugInfo[c][drogacolher] == 1)
{
ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
DrugInfo[c][drogacolher] = 0;
DestroyDynamicObject(DrugInfo[c][semente]);
DrugInfo[c][sementecrescimento] = 0;
DrugsHolding[playerid] += 5;
return SendClientMessage(playerid, COLOR_WHITE, "[Info]: Colheste a tua planta. Agora para a transformares tens que a entregar ao teu trabalhador.");
}
return SendClientMessage(playerid, COLOR_RED, "[Erro]: A planta ainda nao cresceu! Espera mais tempo.");
}
} // this \/ message was inside the loop, should be here
return SendClientMessage(playerid, COLOR_RED, "[Erro]: Nao estas perto de nenhuma planta de cocaina!");
}
return SendClientMessage(playerid, COLOR_RED, "[Erro]: Nao pertences a faction que vende drogas!");
}