28.10.2012, 00:15
pawn Код:
if(strcmp("/plantweed", cmd, true) == 0)
{
tmp = strtok(cmdtext, idx);
if (!WEEDS[playerid]) return SendClientMessage(playerid, COLOR_GREY," You don't have any weed-seeds to be able to grow your crops!");
if (!WATER[playerid]) return SendClientMessage(playerid, COLOR_GREY," You don't have any pots-of-water, to plant your seeds with!");
for(new weed = 0; weed < sizeof(WeedInfo); weed++)
{
if(WeedInfo[weed][WeedPlanted] == 0 && WeedInfo[weed][WeedTime] == 0)
{
if (GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GRAD2, "You must be on foot!");
if (GetPlayerInterior(playerid) != 0) return SendClientMessage(playerid, COLOR_GRAD2, " You must be outside!");
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerName(playerid, playername, 24);
ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
weedObject[weed] = CreateObject(3409, X, Y, Z-2, 0, 0, 0);
Weeder[playerid] = 1200;
WeedInfo[weed][WeedX] = X;
WeedInfo[weed][WeedY] = Y;
WeedInfo[weed][WeedZ] = Z;
WeedInfo[weed][WeedTime] = 60;
WeedInfo[weed][WeedPlanted] = 1;
strmid(WeedInfo[weed][WeedPlanter], playername, 0, strlen(playername), 50);
SendClientMessage(playerid,COLOR_FADE1,"You have planted your seeds, it will take about an hour, for your crops to grow fully mature.");
SendClientMessage(playerid,COLOR_FADE1,"Remember to type /pickweed Before someone else takes your weed, come back in about an-hour!");
WEEDS[playerid] = WEEDS[playerid] - 1;
WATER[playerid] = WATER[playerid] - 1;
return 1;
}
}
SendClientMessage(playerid,COLOR_FADE1,"USAGE: /plantweed!");
return 1;
}