[SOLVED] What is wrong with this command?
#1

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

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)