24.11.2011, 22:41
I made a weed system, where you can buy seeds, put them in the ground. And after some time the weed object starts rising from the ground, giving you a message the weed smells right ( And sets the variable of the weedplant: weedVariables[x][PlantedWeedReady] to 1) . Everything works fine, except the command to take the weed from the "plants" doesn't work that well.
I use zcmd.
The problem is, when I am standing on one of my weed jobjects, so I'm in a range of 10, of the coordinates, which work (already tested that, they're saved in a mysql database, and get deleted once you harvest the weed).
So whatever I do, it gives me the message InGame:
"You are not near any weed plants, or they don't smell that good to harvest yet."
I use zcmd.
The problem is, when I am standing on one of my weed jobjects, so I'm in a range of 10, of the coordinates, which work (already tested that, they're saved in a mysql database, and get deleted once you harvest the weed).
So whatever I do, it gives me the message InGame:
"You are not near any weed plants, or they don't smell that good to harvest yet."
Код:
CMD:harvestweed(playerid) { new HarvestValue, WeedHarvestString[128], queryString[128]; HarvestValue = random(100)+200; for(new x = 0; x < MAX_WEED; x++) { if(IsPlayerInRangeOfPoint(playerid, 10.0, weedVariables[x][PlantedWeedPos][0], weedVariables[x][PlantedWeedPos][1], weedVariables[x][PlantedWeedPos][2]) && weedVariables[x][PlantedWeedReady] == 1) { playerVariables[playerid][pPlantedSeed]--; playerVariables[playerid][pWeed] += HarvestValue; format(WeedHarvestString, sizeof(WeedHarvestString),"Harvesting the weed brought you a total of %d grams of weed. (It's in /myitems)", HarvestValue); SendClientMessage(playerid, COLOR_GREY, WeedHarvestString); DestroyDynamicObject(Weed[x]); format(queryString, sizeof(queryString), "DELETE FROM weedplants WHERE weedID = '%d'", weedVariables[x][PlantedWeedID]); mysql_query(queryString); } //else return SendClientMessage(playerid, COLOR_GREY, "You are not near any weed plants"); //else if(weedVariables[x][PlantedWeedReady] == 0) return SendClientMessage(playerid, COLOR_GREY, "The weed smell isn't that perfect yet, they need more time growing."); } else return SendClientMessage(playerid, COLOR_GREY, "You are not near any weed plants, or they don't smell that good to harvest yet."); return 1; }