SA-MP Forums Archive
Why my made cmd wont work - 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: Why my made cmd wont work (/showthread.php?tid=348174)



Why my made cmd wont work - San1 - 04.06.2012

Код:
	new bool:robber[MAX_PLAYERS];
	if (strcmp("/robber", cmdtext, true, 10) == 0)
	{
	    if(robber[playerid] == false)
	    {
			SetPlayerAttachedObject(playerid,1, 19142, 1, 0.112397, 0.049958, -0.001576, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
			SetPlayerAttachedObject( playerid, 2, 1550, 1, -0.008714, -0.188819, -0.026564, 159.138153, 86.558647, 0.000000, 1.005565, 0.984468, 1.014210 ); // CJ_MONEY_BAG -
			SetPlayerAttachedObject( playerid, 3, 18637, 1, 0.000000, -0.026987, 0.152000, 89.427894, 357.510375, 273.945983, 1.000000, 1.000000, 1.000000 ); // PoliceShield1 - Shield on back
			SetPlayerAttachedObject( playerid, 4, 18634, 6, 0.045389, -0.019335, -0.246956, 0.000000, 91.442123, 85.389228, 0.971265, 1.000000, 1.000000 ); // GTASACrowbar1 - Crowbar in hand
			SetPlayerAttachedObject( playerid, 5, 1485, 18, -0.024238, -0.058657, -0.019224, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 ); // CJ_CIGGY - cuban cigar
			SendClientMessage(playerid, COLOR_RED, "You've Have gave urself rob gear");
			        robber[playerid] = true;
	    }
	    else if(robber[playerid] == true)
	    {
		    if(IsPlayerAttachedObjectSlotUsed(playerid, 1)) RemovePlayerAttachedObject(playerid,1);
		    if(IsPlayerAttachedObjectSlotUsed(playerid, 2)) RemovePlayerAttachedObject(playerid,2);
		    if(IsPlayerAttachedObjectSlotUsed(playerid, 3)) RemovePlayerAttachedObject(playerid,3);
		    if(IsPlayerAttachedObjectSlotUsed(playerid, 4)) RemovePlayerAttachedObject(playerid,4);
		    if(IsPlayerAttachedObjectSlotUsed(playerid, 5)) RemovePlayerAttachedObject(playerid,5);
		    SendClientMessage(playerid, COLOR_RED, "You've Removed you robber gear");
		            robber[playerid] = false;
	  }
		  return 1;

	}
The second time i type it, it suppose to remove the objects but it keeps giving them and not remove them can someone please fix and tell me how you did it


Re: Why my made cmd wont work - Flake. - 04.06.2012

try
pawn Код:
new bool:robber[MAX_PLAYERS];
    if (strcmp("/robber", cmdtext, true, 10) == 0)
    {
        if(robber[playerid] == false)
        {
            SetPlayerAttachedObject(playerid,1, 19142, 1, 0.112397, 0.049958, -0.001576, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 );
            SetPlayerAttachedObject( playerid, 2, 1550, 1, -0.008714, -0.188819, -0.026564, 159.138153, 86.558647, 0.000000, 1.005565, 0.984468, 1.014210 ); // CJ_MONEY_BAG -
            SetPlayerAttachedObject( playerid, 3, 18637, 1, 0.000000, -0.026987, 0.152000, 89.427894, 357.510375, 273.945983, 1.000000, 1.000000, 1.000000 ); // PoliceShield1 - Shield on back
            SetPlayerAttachedObject( playerid, 4, 18634, 6, 0.045389, -0.019335, -0.246956, 0.000000, 91.442123, 85.389228, 0.971265, 1.000000, 1.000000 ); // GTASACrowbar1 - Crowbar in hand
            SetPlayerAttachedObject( playerid, 5, 1485, 18, -0.024238, -0.058657, -0.019224, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 ); // CJ_CIGGY - cuban cigar
            SendClientMessage(playerid, COLOR_RED, "You've Have gave urself rob gear");
                    robber[playerid] = true;
        }
        else if(robber[playerid] == true)
        {
            RemovePlayerAttachedObject(playerid,1);
            RemovePlayerAttachedObject(playerid,2);
            RemovePlayerAttachedObject(playerid,3);
            RemovePlayerAttachedObject(playerid,4);
            RemovePlayerAttachedObject(playerid,5);
            SendClientMessage(playerid, COLOR_RED, "You've Removed you robber gear");
            robber[playerid] = false;
      }
          return 1;

    }