When i try pick my weed i says This plant is not ready to be picked yet. i will post the timer on /plantseeds too
pawn Код:
COMMAND:pickweed(playerid, params[]) {
foreach(Player, i) if(IsPlayerInRangeOfPoint(playerid, 2.5, PlayerInfo[i][pWX], PlayerInfo[i][pWY], PlayerInfo[i][pWZ])) {
if(GetPlayerVirtualWorld(playerid) == PlayerInfo[i][pWVW] && GetPlayerInterior(playerid) == PlayerInfo[i][pWInt]) {
if(PlayerInfo[i][pWValue] > 0) {
if(PlayerInfo[i][pWValue] + PlayerInfo[playerid][pWeed] < 99) {
new
szMessage[52];
ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_Out", 4.0, 0, 0, 0, 0, 0, 1);
PlayerInfo[playerid][pWeed] += PlayerInfo[i][pWValue];
format(szMessage, sizeof(szMessage), "You picked the plant and gathered %d grams of pot.", PlayerInfo[i][pWValue]);
SendClientMessage(playerid, COLOR_GREY, szMessage);
format(szMessage, sizeof(szMessage), " * %s picks the weed plant.", GetPlayerNameEx(playerid));
ProxDetector(25.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
ClearWeed(i);
}
else SendClientMessage(playerid, COLOR_GREY, "You can't carry more then 99 grams of pot.");
}
else SendClientMessage(playerid, COLOR_GREY, "This plant is not ready to be picked yet.");
return 1;
}
}
return SendClientMessage(playerid, COLOR_GREY, "You are not at a plant.");
}
CMD:plantseeds(playerid, params[]) {
if(PlayerInfo[playerid][pSeeds] > 0) {
if(PlayerInfo[playerid][pWExists] == 1)
{
SendClientMessage(playerid, COLOR_GRAD2, "You already have a plant growing." );
return 1;
}
// Not working
/*new
animlib[32],
animname[4];
GetAnimationName(GetPlayerAnimationIndex(playerid), animlib, sizeof(animlib), animname, sizeof(animname));
if(strcmp(animlib, "SWIM", true) == 0) {
SendClientMessage(playerid, COLOR_GRAD2, "You can't plant weed while swimming.");
return 1;
}*/
new
szMessage[128];
GetPlayerPos(playerid, PlayerInfo[playerid][pWX], PlayerInfo[playerid][pWY], PlayerInfo[playerid][pWZ]);
PlayerInfo[playerid][pWZ] -= 1.5;
ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);
SendClientMessage(playerid, COLOR_GREEN, "You have planted some weed. It will take around 20-45 minutes to grow.");
PlayerInfo[playerid][pWInt] = GetPlayerInterior(playerid);
PlayerInfo[playerid][pWVW] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][pWExists] = 1;
PlayerInfo[playerid][pWValue] = -1;
PlayerInfo[playerid][pSeeds]--;
PlayerInfo[playerid][pWObject] = CreateDynamicObject(3409, PlayerInfo[playerid][pWX], PlayerInfo[playerid][pWY], PlayerInfo[playerid][pWZ], 0.0, 0.0, 0.0, PlayerInfo[playerid][pWVW], PlayerInfo[playerid][pWInt]);
PlayerInfo[playerid][pWTimer] = SetTimerEx("WeedGrowth", 100, 1, "i", playerid);
format(szMessage, sizeof(szMessage), " * %s plants some weed.", GetPlayerNameEx(playerid));
ProxDetector(25.0, playerid, szMessage, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else SendClientMessage(playerid, COLOR_GREY, "You don't have enough seeds to plant weed - head to the drug house and pick up some seeds (/getseeds).");
return 1;
}
Don't you guys read the rules? 48 hours before bumping.
Otherwise, i'd say everything looks fine. Show the timer, and it seems you set pWValue to -1 when doing the timer, unless the timer increases the value, your script wouldn't work.
pawn Код:
}
forward WeedGrowth(weedid);
public WeedGrowth(weedid)
{
if(PlayerInfo[weedid][pWExists])
{
//new string[128];
if(PlayerInfo[weedid][pWValue] < 45)
{
if(PlayerInfo[weedid][pWValue] > 45)
{
PlayerInfo[weedid][pWValue] = 45;
}
if(PlayerInfo[weedid][pWValue] > 0)
{
//format(string, sizeof(string), " Planter: %s\nWeight: %d grams\n /pickweed to pick", GetPlayersName(weedid), PlayerInfo[weedid][pWValue]);
//Update3DTextLabelText(PlayerInfo[weedid][pW3DText], COLOR_YELLOW, string);
}
}
if(PlayerInfo[weedid][pWValue] >= 45)
{
//format(string, sizeof(string), " Planter: %s\nThis plant is fully grown! (45g)\n /pickweed to pick", GetPlayersName(weedid), PlayerInfo[weedid][pWValue]);
//Update3DTextLabelText(PlayerInfo[weedid][pW3DText], COLOR_YELLOW, string);
}
}
return 1;
}
You're not increasing the value at all. Actually add to the value.
This states that if the pWValue is less then 45, it continues. Then it checks if the pWValue is greater then 45, what is this suppose to accomplish? This can be completely abolished.