SA-MP Forums Archive
[UNSOLVED] Remove Roadblock - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [UNSOLVED] Remove Roadblock (/showthread.php?tid=126755)



[UNSOLVED] Remove Roadblock - FreddeN - 10.02.2010

Hello, I'm wondering if it's possible to make this command into a /removeroadblock so it can delete the roadblock I just deployed?

Код:
	if(strcmp(cmd, "/roadblock", true) == 0)
	{
		if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI)
		{
	    if(PlayerInfo[playerid][LAERank] >= 1)
	    {
				new Float:pX, Float:pY, Float:pZ, Float:pA;
    		GetPlayerPos(playerid, pX, pY, pZ);
    		GetPlayerFacingAngle(playerid, pA);
    		CreateObject(981, pX, pY, pZ, 0.0, 0.0, pA);
    		SendClientMessage(playerid, COLOR_BLUE, "You have successfully posted a roadblock.");
    		return 1;
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GREY, "	You are not authorized to use that command.");
			  return 1;
			}
		}
		else
		{
		  SendClientMessage(playerid, COLOR_GREY, "	You are not a Law Enforcer.");
		  return 1;
		}
	}
Thanks


Re: [HELP] Remove Roadblock - Calgon - 10.02.2010

Quote:
Originally Posted by FreddeN
Hello, I'm wondering if it's possible to make this command into a /removeroadblock so it can delete the roadblock I just deployed?

Код:
	if(strcmp(cmd, "/roadblock", true) == 0)
	{
		if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI)
		{
	    if(PlayerInfo[playerid][LAERank] >= 1)
	    {
				new Float:pX, Float:pY, Float:pZ, Float:pA;
    		GetPlayerPos(playerid, pX, pY, pZ);
    		GetPlayerFacingAngle(playerid, pA);
    		CreateObject(981, pX, pY, pZ, 0.0, 0.0, pA);
    		SendClientMessage(playerid, COLOR_BLUE, "You have successfully posted a roadblock.");
    		return 1;
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GREY, "	You are not authorized to use that command.");
			  return 1;
			}
		}
		else
		{
		  SendClientMessage(playerid, COLOR_GREY, "	You are not a Law Enforcer.");
		  return 1;
		}
	}
Thanks
pawn Код:
new Roadblock;

    if(strcmp(cmd, "/roadblock", true) == 0)
    {
      if( Roadblock < 1 )
      {
            if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI)
            {
            if(PlayerInfo[playerid][LAERank] >= 1)
            {
                    new Float:pX, Float:pY, Float:pZ, Float:pA;
                GetPlayerPos(playerid, pX, pY, pZ);
                GetPlayerFacingAngle(playerid, pA);
                Roadblock = CreateObject(981, pX, pY, pZ, 0.0, 0.0, pA);
                SendClientMessage(playerid, COLOR_BLUE, "You have successfully posted a roadblock.");
                return 1;
                }
                else
                {
                  SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use that command.");
                  return 1;
                }
            }
            else
            {
              SendClientMessage(playerid, COLOR_GREY, " You are not a Law Enforcer.");
              return 1;
            }
        }
        else
        {
          SendClientMessage(playerid, COLOR_GREY, "A roadblock has already been deployed (/destroyroadblock first).");
        }
        return 1;
    }
   
    if(strcmp(cmd, "/destroyroadblock", true) == 0)
    {
            if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI)
            {
            if(PlayerInfo[playerid][LAERank] >= 1)
            {
                  if( Roadblock >= 1 )
                  {
                    DestroyObject( Roadblock );
                    Roadblock = 0; // To be sure.
                  }
                  else
                  {
                    SendClientMessage(playerid, COLOR_GREY, "No roadblocks have been deployed.");
                  }
                }
            }
      }
      return 1;
    }



Re: [HELP] Remove Roadblock - FreddeN - 10.02.2010

My Pawno just crashes, this is how my looks like:

Код:
if(strcmp(cmd, "/roadblock", true) == 0)
	{
	  if( Roadblock < 1 )
	  {
			if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI)
			{
		    if(PlayerInfo[playerid][LAERank] >= 1)
		    {
					new Float:pX, Float:pY, Float:pZ, Float:pA;
	    		GetPlayerPos(playerid, pX, pY, pZ);
	    		GetPlayerFacingAngle(playerid, pA);
	    		Roadblock = CreateObject(981, pX, pY, pZ, 0.0, 0.0, pA);
	    		SendClientMessage(playerid, COLOR_BLUE, "You have successfully deployed a roadblock");
	    		return 1;
				}
				else
				{
				  SendClientMessage(playerid, COLOR_GREY, "	You are not authorized to use that command.");
				  return 1;
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GREY, "	You are not a Law Enforcer.");
			  return 1;
			}
		}
		else
		{
		  SendClientMessage(playerid, COLOR_GREY, "	You have deployed posted a roadblock.");
		  return 1;
		}
		return 1;
	}
	
	if(strcmp(cmd, "/removeroadblock", true) == 0)
	{
			if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI)
			{
		    if(PlayerInfo[playerid][LAERank] >= 1)
		    {
				  if( Roadblock >= 1 )
				  {
				    DestroyObject( Roadblock );
				    Roadblock = 0; 
				  }
				  else
				  {
				    SendClientMessage(playerid, COLOR_GREY, "	You have not deployed any roadblock.");
				    return 1;
				  }
				}
				else
				{
				  SendClientMessage(playerid, COLOR_GREY, "	You are not authorized to use that command.");
				  return 1;
				}
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GREY, "	You are not a Law Enforcer.");
			  return 1;
			}
	  }
	  return 1;
	}



Re: [HELP] Remove Roadblock - FreddeN - 10.02.2010

BUMP: Any ideas, I'm trying to fix it but it still craches Pawno.


Re: [HELP] Remove Roadblock - FreddeN - 10.02.2010

Sorry for the bumps but I really need this command.

The error I get is:

Код:
Run time error 17: "Invalid/unsupported P-code file format"