if(PlayerInfo[playerid][pCow][i]) format(string, sizeof(string), "%d) %d lbs.", i+1, PlayerInfo[playerid][pCow][i]);
CMD:buycow(playerid, params[]) { new string[128], done, cow; if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command."); if(!IsAtAnimalCenter(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not at the Animal Center."); if(CowTime[playerid]) { format(string, sizeof(string), "You need to wait %d more seconds before buying a new cow.", CowTime[playerid]); SendClientMessage(playerid, COLOR_GREY, string); return 1; } for(new i=0; i<2; i++) // Cows { if(!done) { if(!PlayerInfo[playerid][pCow][i]) done = i+1; } } if(!done) return SendClientMessage(playerid, COLOR_GREY, "You can't have any more cows."); done = done-1; // Buying different cow sizes if(strval(RPJL(playerid, JOB_FARMER)) == 1) cow = random(10)+5; else if(strval(RPJL(playerid, JOB_FARMER)) == 2) cow = random(20)+15; else if(strval(RPJL(playerid, JOB_FARMER)) == 3) cow = random(40)+20; else if(strval(RPJL(playerid, JOB_FARMER)) == 4) cow = random(60)+25; else if(strval(RPJL(playerid, JOB_FARMER)) == 5) cow = random(80)+40; PlayerInfo[playerid][pCow][done] = cow; format(string, sizeof(string), "* %s Buys a new born cow at the Animal Center.", RPN(playerid)); SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE); format(string, sizeof(string), " Your new born cow is a %d lbs cow.", cow); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); // Leveling new oldj = strval(RPJL(playerid, JOB_FARMER)); PlayerInfo[playerid][pJobSkill][JOB_FARMER] ++; new newj = strval(RPJL(playerid, JOB_FARMER)); if(oldj < newj) { format(string, sizeof(string), "** Your Farmer level is now %d, you can now buy heavier cows. **", newj); SendClientMessage(playerid, COLOR_YELLOW, string); } CowBought[playerid] ++; if(CowBought[playerid] >= 5) { format(string, sizeof(string), " Remember to feed your cow to make it grow ! ", cow); format(string, sizeof(string), " For more info on cows use /Cowhelp ", cow); CowBought[playerid] = 0; CowTime[playerid] = 5; SetTimerEx("CowBuyTime", 1000, true, "i", playerid); } return 1; }
CMD:cows(playerid, params[]) { new string[128]; SendClientMessage(playerid, COLOR_BLUE, "____________________________"); SendClientMessage(playerid, COLOR_WHITE, " *** Your Cows ***"); for(new i=0; i<1; i++) { if(PlayerInfo[playerid][pCow][i]) format(string, sizeof(string), "%d) %d lbs.", i+1, PlayerInfo[playerid][pCow][i]); else format(string, sizeof(string), "%d) None.", i+1); SendClientMessage(playerid, COLOR_WHITE, string); } return 1; }
I am sorry but I am a bit lost here, are you trying to add 5 more cows or 5 more pounds when you sell?
|
CMD:feedcow(playerid, params[]) { new string[128]; if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command."); if(sscanf(params, "i", cow)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /feedcow [cow slot]"); if(cow < 1 || cow > 2) return SendClientMessage(playerid, COLOR_GREY, "Cows are between 1 and 2."); { } return 1; }
if(strval(RPJL(playerid, JOB_FARMER)) == 1) cow = random(10)+5; else if(strval(RPJL(playerid, JOB_FARMER)) == 2) cow = random(20)+15; else if(strval(RPJL(playerid, JOB_FARMER)) == 3) cow = random(40)+20; else if(strval(RPJL(playerid, JOB_FARMER)) == 4) cow = random(60)+2else if(strval(RPJL(playerid, JOB_FARMER)) == 5) cow = random(80)+40; PlayerInfo[playerid][pCow][done] = cow;
PlayerInfo[playerid][pCow] = PlayerInfo[playerid][pCow] += 5;
Yes the buycow command is giving the item cow to the player and setting its weight to a random value. ( depending on player job level )
I'm not sure if using your line its going to select the cow slot tho let me try ^^ Edit : oh and i must have a line that looks if the player have a cow or not before using that line Do you mind telling me how ? |
No it wouldn't, that line will only add 5 more to your pCow variable which should be the pounds as far as I understand.
|
if(sscanf(params, "i", cow)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /feedcow [cow slot]");