/plant command works once, than no response
#1

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;
		}
	}
Reply
#2

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

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

Код:
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.
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)