SA-MP Forums Archive
/plant command works once, than no response - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /plant command works once, than no response (/showthread.php?tid=283089)



/plant command works once, than no response - Ov3rl0rd - 13.09.2011

Alright so I have this command when a player types /plant it will create a pickup, set the map icon for that player who did the cmd, check the team and blah blah blah but the problem is, I type the cmd and it works the first time but than if I do it again nothing happens. The rest of my cmds work still, but /plant wont -.- here is the code:
Код:
	if(strcmp(cmdtext,"/plant",true) ==0)
	{
	    new giveplayerid = Planter[playerid];
	    if(gTeam[playerid] == TEAM_SNEAK)
	    {
			new Float:X, Float:Y, Float:Z;
			GetPlayerPos(giveplayerid, X,Y,Z);
			Pickup2 = CreatePickup(1212, 3,X,Y,Z,-1);
			SendClientMessage(giveplayerid, TEAM_PD_COLOR, "You have planted a distraction");
			SetPlayerMapIcon(giveplayerid,1,X,Y,Z,56,0,MAPICON_LOCAL);
			Planter[giveplayerid]++;
			return 1;
		}
		else if(Planter[giveplayerid] >= 4)
		{
  			SendClientMessage(giveplayerid,COLOR_BLUE, "You can't plant more than 3 distractions!");
     		return 1;
		}
	}



Re: /plant command works once, than no response - Yamoo - 13.09.2011

Remove the return 1; from under
pawn Код:
Planter[giveplayerid]++;
Now try it.


Re: /plant command works once, than no response - Ov3rl0rd - 13.09.2011

If I remove the return 1; following Planter[...]++ than it just gives me Unknown Command -.- lol


Re: /plant command works once, than no response - Элиот - 13.09.2011

Код:
if(strcmp(cmdtext,"/plant",true) ==0)
	{
	    new giveplayerid = Planter[playerid];
	    if(gTeam[playerid] == TEAM_SNEAK)
	    {
			new Float:X, Float:Y, Float:Z;
			GetPlayerPos(giveplayerid, X,Y,Z);
			Pickup2 = CreatePickup(1212, 3,X,Y,Z,-1);
			SendClientMessage(giveplayerid, TEAM_PD_COLOR, "You have planted a distraction");
			SetPlayerMapIcon(giveplayerid,1,X,Y,Z,56,0,MAPICON_LOCAL);
			Planter[giveplayerid]++;
		}
		else if(Planter[giveplayerid] >= 4)
		{
  			SendClientMessage(giveplayerid,COLOR_BLUE, "You can't plant more than 3 distractions!");
		}
                return 1;
	}
It should work.


Re: /plant command works once, than no response - Ov3rl0rd - 13.09.2011

Quote:
Originally Posted by Элиот
Посмотреть сообщение
Код:
if(strcmp(cmdtext,"/plant",true) ==0)
	{
	    new giveplayerid = Planter[playerid];
	    if(gTeam[playerid] == TEAM_SNEAK)
	    {
			new Float:X, Float:Y, Float:Z;
			GetPlayerPos(giveplayerid, X,Y,Z);
			Pickup2 = CreatePickup(1212, 3,X,Y,Z,-1);
			SendClientMessage(giveplayerid, TEAM_PD_COLOR, "You have planted a distraction");
			SetPlayerMapIcon(giveplayerid,1,X,Y,Z,56,0,MAPICON_LOCAL);
			Planter[giveplayerid]++;
		}
		else if(Planter[giveplayerid] >= 4)
		{
  			SendClientMessage(giveplayerid,COLOR_BLUE, "You can't plant more than 3 distractions!");
		}
                return 1;
	}
It should work.
This is doing what it was originally doing, works once than just no response after