/wheat plant doesn't appear
#1

hey guys i'm looking for a little help with this, I've been scripting this using my plant weed script. Still it doesn't work. If i get some seeds at my seed pickup ( which uses PlayerInfo[playerid][pSeeds] += 1; ) and use /wheat plant, the command just doesnt write anything and nothing appears.

The Weed is supposed to appear tho and I just don't get why it doesn't.

Any help is much appreciated. Here's the code


Код:
CMD:wheat(playerid, params[])
{
    new string[128], wheat, oldj, newj;
	if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] < 100) wheat = 5;
	else if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] < 300) wheat = 10;
	else if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] < 700) wheat = 15;
	else if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] < 1200) wheat = 20;
	else if(PlayerInfo[playerid][pJobSkill][JOB_FARMER] >= 1200) wheat = 25;
   	if(!IsPlayerLoggedIn(playerid) || PlayerInfo[playerid][pAsshole] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use command.");
   	if(PlayerInfo[playerid][pJob] != JOB_FARMER && PlayerInfo[playerid][pVIPJob] != JOB_FARMER) return SendClientMessage(playerid, COLOR_GREY, "You are not a Farmer.");
	new usage[10];
	if(sscanf(params, "s[10]", usage)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /wheat [plant] or [pick]");
	else
	{
	    if(strcmp(usage, "plant", true) == 0)
	    {
	        if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GREY, "You must be standing on the ground to use this command.");
         	if(PlayerInfo[playerid][pSeeds] == 0) return SendClientMessage(playerid, COLOR_GREY, "You must have seeds to plant wheat.");
            if(PlayerInfo[playerid][pSeeds] == 1)
            for(new weed = 0; weed < sizeof(WeedInfo); weed++)
  			{
				new Float:X,Float:Y,Float:Z;
 				ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
        		ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
        		GetPlayerPos(playerid, X, Y, Z);
		        WeedInfo[weed][wX] = X;
 				WeedInfo[weed][wY] = Y;
 				WeedInfo[weed][wZ] = Z;
   				WeedInfo[weed][wPlantObject] = CreateDynamicObject(3409, X, Y, Z-1.0, 0, 0, 0, 0);
 				PlayerInfo[playerid][pSeeds] = 0;
				WeedInfo[weed][wLabel] = Create3DTextLabel("Wheat: Not ready for picking.",COLOR_PURPLE,WeedInfo[weed][wX],WeedInfo[weed][wY],WeedInfo[weed][wZ],10.0,0);
				WeedInfo[weed][wLabels]++;
				SetTimer("PlantWeedTimer",60000*10,0); // 10 minutes
				SendClientMessage(playerid,COLOR_GREEN,"You have planted your seeds, it will now grow and be ready to /wheat pick in 10 minutes.");
   				return 1;
			}
		}
		if(strcmp(usage, "pick", true) == 0)
		{
		    if(IsPlayerInRangeOfPoint(playerid,5.0,WeedInfo[playerid][wX],WeedInfo[playerid][wY],WeedInfo[playerid][wZ]))
      		{
			    for(new weed = 0; weed < sizeof(WeedInfo); weed++)
			    {
		            if(WeedInfo[playerid][wAbleToPick] == false) SendClientMessage(playerid,COLOR_GREY,"You do not have wheat growing to pick.");
				    ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
					WeedInfo[weed][wAbleToPick] = false;
					DestroyDynamicObject(WeedInfo[weed][wPlantObject]);
					WeedInfo[weed][wWeed] = wheat;
					format(string, sizeof(string), "* You have harvested {FF6347}%d wheat{33CCFF} on your plantations.", wheat*5);
    				SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
					Delete3DTextLabel(WeedInfo[weed][wLabel]);
					WeedInfo[weed][wLabels]--;
					PlayerInfo[playerid][pWheat] = wheat*5;
					oldj = strval(RPJL(playerid,JOB_FARMER));
					PlayerInfo[playerid][pJobSkill][JOB_FARMER] ++;
					newj = strval(RPJL(playerid,JOB_FARMER));
					if(oldj < newj)
					{
	    				format(string, sizeof(string), "** Your Farmer level is now %d, you can now harvest %d more pounds of wheat. **", newj, newj*5);
						SendClientMessage(playerid, COLOR_YELLOW, string);
					}
					return 1;
				}
			}
			else SendClientMessage(playerid,COLOR_GREY,"You are not near any plants.");
		}
		return 1;
	}
}
Reply
#2

Any help ?
Reply
#3

Does the 3dtextlabel show up?
Reply
#4

Quote:
Originally Posted by Write
Посмотреть сообщение
Does the 3dtextlabel show up?
Nope
Reply
#5

Switch

Код:
if(strcmp(usage, "plant", true) == 0)
to

Код:
if(!strcmp(usage, "plant", true) == 0)
or
Код:
if(strcmp(usage, "plant", true)  != 0)
Reply
#6

thanks worked buddy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)