SA-MP Forums Archive
[SOLVED] What is wrong with this command? - 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: [SOLVED] What is wrong with this command? (/showthread.php?tid=150219)



[SOLVED] What is wrong with this command? - FreddeN - 25.05.2010

Hello,

What happends is... nothing, Pawno just crashes, the crash happends when I add the /removeroadblock command, the /roadblock command works fine.

Код:
new Roadblock;

	if(strcmp(cmd, "/roadblock", true) == 0)
	{
	  if( Roadblock < 1 )
	  {
			if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
			{
				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_LIGHTYELLOW, "Roadblock successfully deployed.");
    			return 1;
	  		}
			else
			{
			  SendClientMessage(playerid, COLOR_GREY, "	You are not a part of a faction.");
	 		}
		}
		else
		{
		  SendClientMessage(playerid, COLOR_GREY, "	A roadblock has already been deployed.");
		}
		return 1;
	}

if(strcmp(cmd, "/removeroadblock", true) == 0)
	{
			if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
			{
				if( Roadblock >= 1 )
  			{
    				DestroyObject( Roadblock );
			    Roadblock = 0; 
			  }
			  else
			  {
    				SendClientMessage(playerid, COLOR_GREY, "	No roadblocks have been deployed.");
			  }
			}
			else
			{
			  SendClientMessage(playerid, COLOR_GREY, "	You are not a part of a faction.");
	 		}
	  }
	  return 1;
	}
Thanks for your help folks


Re: [HELP] What is wrong with this command? - sjvt - 25.05.2010

pawn Код:
if(strcmp(cmd, "/removeroadblock", true) == 0)
{
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
    {
        if( Roadblock >= 1 )
        {
                DestroyObject( Roadblock );
            Roadblock = 0;
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "   No roadblocks have been deployed.");
        }  
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "   You are not a part of a faction.");
    }
    return 1;
}



Re: [HELP] What is wrong with this command? - FreddeN - 25.05.2010

Quote:
Originally Posted by SiloX
pawn Код:
if(strcmp(cmd, "/removeroadblock", true) == 0)
{
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
    {
        if( Roadblock >= 1 )
        {
                DestroyObject( Roadblock );
            Roadblock = 0;
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "   No roadblocks have been deployed.");
        }  
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "   You are not a part of a faction.");
    }
    return 1;
}
Thanks