20.10.2011, 02:50
I got a problem with the Weed system, as you can see I planted some seeds and in secods it says that I waited to long so they have been removed.. It happens in seconds some times you can do /plantweed and they will be removed in 5 minutes it depends..
/plantweed CMD:
"Weed Time"
/plantweed CMD:
Код:
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_PURPLE,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; }
Код:
forward RotWeed(playerid); public RotWeed(playerid) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pPlantedWeed] == 1) { DestroyObject(WeedObject[playerid]); SendClientMessage(playerid, COLOR_LIGHTGREEN, "You have waited too long harvest your weed, therefore it's been rotten and was removed!"); PlayerInfo[playerid][pPlantedWeed] = 0; } } } public WeedTimer() { for(new i = 0; i < MAX_PLAYERS; i++) { if(PlayerInfo[i][pPlantedWeed] != 0) { PlayerInfo[i][pWeedTime] ++; if(PlayerInfo[i][pWeedTime] == 60) { PlayerInfo[i][pWeedGrams]++; PlayerInfo[i][pWeedTime] = 0; } if(PlayerInfo[i][pWeedTime] == 3600) { DestroyObject(WeedObject[i]); PlayerInfo[i][pPlantedWeed] = 0; PlayerInfo[i][pWeedGrams] = 0; PlayerInfo[i][pWeedTime] = 0; } } } return 1; }