05.06.2013, 17:58
Hello, I am trying to make a /eat command, but it wont let me choose the second choice[berry]. Cant figure out whats wrong.
Would be grateful if anyone knew whats wrong
Код:
CMD:eat(playerid,params[]) { new option[128], string[128], sendername[MAX_PLAYER_NAME]; if(sscanf(params, "s", option)) { SendClientMessage(playerid, RED, "[Survival:RP] /eat option"); SendClientMessage(playerid, COLOR_WHITE, "[Survival:RP] Options: fish,berry"); return 1; } if (strcmp(option, "fish", true) == 0) { if(PlayerInfo[playerid][pFishDone] > 0) { if(Hungry[playerid] > 4) { ApplyAnimation(playerid, "FOOD","EAT_Burger",4.0,0, 1, 1, 1, 1); ApplyAnimation(playerid, "FOOD","EAT_Burger",4.0,0, 1, 1, 1, 1); GameTextForPlayer(playerid, "~g~You ate your fish",3500,5); PlayerInfo[playerid][pSlotsFree] -= 1; format(string, sizeof(string), "%s takes his/her cooked fish and eats it", sendername); ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN); PlayerInfo[playerid][pFishDone] -= 1; SetPlayerHealth(playerid, 100); Hungry[playerid] = 0; SetProgressBarValue(Hunger[playerid], 0.0); UpdateProgressBar(Hunger[playerid], playerid); } else { SendClientMessage(playerid, RED, "[Survival:RP] You are not hungry"); } } else { SendClientMessage(playerid, RED, "[Survival:RP] You dont have any fish cooked"); } if(strcmp(option, "berry", true) == 0) { if(Hungry[playerid] > 4) { if(PlayerInfo[playerid][pBerry] > 0) { ApplyAnimation(playerid, "FOOD","EAT_Burger",4.0,0, 1, 1, 1, 1); ApplyAnimation(playerid, "FOOD","EAT_Burger",4.0,0, 1, 1, 1, 1); GameTextForPlayer(playerid, "~g~You ate a berry",3500,5); PlayerInfo[playerid][pSlotsFree] -= 1; format(string, sizeof(string), "%s takes his/her berry and eats it", sendername); ProxDetector(30.0, playerid, string, COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN,COLOR_GREEN); PlayerInfo[playerid][pBerry] -= 1; SetPlayerHealth(playerid, 100); Hungry[playerid] = 0; SetProgressBarValue(Hunger[playerid], 0.0); UpdateProgressBar(Hunger[playerid], playerid); } else { SendClientMessage(playerid, RED, "[Survival:RP] You are not hungry"); } } else { SendClientMessage(playerid, RED, "[Survival:RP] You dont have any berries"); } } } return 1; }