if(strcmp(cmd,"/plantweed",true)==0) { if(IsPlayerConnected(playerid)) { if (PlayerInfo[playerid][pJob] != 4) { SendClientMessage(playerid,COLOR_GREY, "You are not a Drug Dealer !"); return 1; } new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if(GetPlayerState(playerid) != 1) return SendClientMessage(playerid, COLOR_GREY, " You must be on foot !"); if(GetPlayerInterior(playerid) > 0) return SendClientMessage(playerid, COLOR_GREY, " You must be outside to plant your seeds."); if(PlayerInfo[playerid][pSeeds] == 0) return SendClientMessage(playerid, COLOR_GREY, " You don't have any Seeds!"); if(PlayerInfo[playerid][pSeeds] < 10) return SendClientMessage(playerid, COLOR_GREY, " You don't have enough Seeds!"); if(PlayerInfo[playerid][pPlantedWeed] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "* You have already planted a weed !"); new Float:X, Float:Y, Float:Z; ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0,1); GetPlayerPos(playerid, X, Y, Z); PlayerInfo[playerid][pWeedX] = X; PlayerInfo[playerid][pWeedY] = Y; PlayerInfo[playerid][pWeedZ] = Z; WeedObject[playerid] = CreateObject(3409, X, Y, Z-1.8, 0, 0, 0); PlayerInfo[playerid][pPlantedWeed] = 1; PlayerInfo[playerid][pSeeds] -= 10; format(string, sizeof(string), "* %s plants some seeds.", name); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SendClientMessage(playerid, COLOR_GREEN, "You have planted your seeds! Every minute, your plant will make one gram of weed."); SendClientMessage(playerid, COLOR_GREEN, "If your plant won't picked within 70 minutes, it will rot and you will lose it."); SendClientMessage(playerid, COLOR_GREEN, "Also remember that anyone can /pickweed if they find your plant, so be careful."); SetTimer("RotWeed", 420000, 1); // 70 min } return 1; } //================================================== ============================ if(strcmp(cmd,"/checkweed",true)==0) { if(IsPlayerConnected(playerid)) { for(new i; i<MAX_PLAYERS; i++) { if(PlayerInfo[i][pPlantedWeed] > 0) { if(IsPlayerInRangeOfPoint(playerid, 3, PlayerInfo[i][pWeedX], PlayerInfo[i][pWeedY], PlayerInfo[i][pWeedZ])) { if(GetPlayerState(playerid) != 1) return SendClientMessage(playerid, COLOR_GREY, " You must be on foot !"); new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); ApplyAnimation(playerid, "BOMBER", "BOM_Plant_2Idle", 4.0, 0, 0, 0, 0, 0,1); format(string, sizeof(string), "* %s inspects the weed plant.", name); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); format(string, sizeof(string), "This plant has %d weed grams.", PlayerInfo[playerid][pWeedGrams]); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } } } } return 1; } //================================================== ============================ if(strcmp(cmd,"/pickweed",true)==0) { if(IsPlayerConnected(playerid)) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if(GetPlayerState(playerid) != 1) return SendClientMessage(playerid, COLOR_GREY, " You must be on foot !"); if(GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK) return SendClientMessage(playerid, COLOR_GREY, " You must be crouched to pick weed."); for(new i; i<MAX_PLAYERS; i++) { if(PlayerInfo[i][pPlantedWeed] > 0) { if(IsPlayerInRangeOfPoint(playerid, 3, PlayerInfo[i][pWeedX], PlayerInfo[i][pWeedY], PlayerInfo[i][pWeedZ])) { if(PlayerInfo[i][pWeedGrams] < 1) { SendClientMessage(playerid, COLOR_GREY, " This plant is not ready to be picked, please wait at least 2 minutes for it to grow."); } format(string, sizeof(string), "* %s begins picking a weed plant.", name); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE); SetTimerEx("WeedPickup", 5000, false, "i", playerid); return 1; } } } } return 1; } |