Command Works Then Says "Unknown Command"? PLEASE HELP!
#1

Ok, I made this fs:


Код:
#include <a_samp>

#define GREEN 0x12B60AFF
#define RED 0xE60000FF

new NuclearBomb;
new N;
new bool:Nuking =false;

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Air Strike For WW3 Loaded! ");
	print("--------------------------------------\n");
	return 1;
}

stock IsPlayerInRangeOfPoint(playerid, Float:range, Float:x, Float:y, Float:z)
{
	new
		Float:px,
		Float:py,
		Float:pz;
	GetPlayerPos(playerid, px, py, pz);
	px -= x;
	py -= y;
	pz -= z;
	return ((px * px) + (py * py) + (pz * pz)) < (range * range);
}

public OnPlayerCommandText (playerid, cmdtext[])
{
	if(strcmp(cmdtext, "/as", true) == 0)
	{
	  if(Nuking)
	  {
	    SendClientMessage(playerid,RED,"Area marked, please use /confirm for air strike to strike.");
			return 1;
	  }
	  Nuking = true;
	  new Float:x,Float:y,Float:z, Float:a;
		GetPlayerPos(playerid, x, y, z);
		GetPlayerFacingAngle(playerid, a);
		x += (2 * floatsin(-a, degrees));
		y += (2 * floatcos(-a, degrees));
	  ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
	  NuclearBomb = CreateObject(3786, x, y, z, 0, 0, 96);
	  SendClientMessage(playerid,GREEN,"Take Cover & Type /confirm To Confirm The Air Strike Upon The Selected Area.");
	  return 1;
	}
	if(strcmp (cmdtext, "/confirm", true) == 0)
	{
 	  if(!Nuking)
	  {
   	SendClientMessage(playerid,RED,"Air Strike: We cannot find your marked location! Please mark it again!");
		return 1;
	  }
	  Nuking = false;
    new Float:x,Float:y,Float:z;
    GetObjectPos(NuclearBomb, x, y, z);
    DestroyObject(NuclearBomb);
    CreateExplosion(x, y, z, 7, 10);
    CreateExplosion(x, y, z+3, 7, 10);
    CreateExplosion(x, y, z+6, 7, 10);
    CreateExplosion(x, y, z+9, 7, 10);
    CreateExplosion(x, y, z+12, 7, 10);
    CreateExplosion(x, y, z+15, 7, 10);
    CreateExplosion(x, y, z+18, 7, 10);
    CreateExplosion(x, y, z+21, 7, 10);
    CreateExplosion(x, y+7, z+21, 7, 10);
    CreateExplosion(x, y-7, z+21, 7, 10);
    CreateExplosion(x+7, y, z+21, 7, 10);
    CreateExplosion(x-7, y, z+21, 7, 10);
    CreateExplosion(x, y, z+24, 7, 10);
    CreateExplosion(x, y+10, z+24, 7, 10);
    CreateExplosion(x, y-10, z+24, 7, 10);
    CreateExplosion(x+10, y, z+24, 7, 10);
    CreateExplosion(x-10, y, z+24, 7, 10);
    CreateExplosion(x, y, z+27, 7, 10);
    CreateExplosion(x, y+7, z+27, 7, 10);
    CreateExplosion(x, y-7, z+27, 7, 10);
    CreateExplosion(x+7, y, z+27, 7, 10);
    CreateExplosion(x-7, y, z+27, 7, 10);
    CreateExplosion(x, y, z+30, 7, 10);
    CreateExplosion(x, y+3, z+30, 7, 10);
    CreateExplosion(x, y-3, z+30, 7, 10);
    CreateExplosion(x+3, y, z+30, 7, 10);
    CreateExplosion(x-3, y, z+30, 7, 10);
    SendClientMessage(playerid,GREEN,"Air Strike: We sucessfully hit the selected target!");
		SetWeather(44);
		for(new i = 0; i < MAX_PLAYERS; i++)
	  {
			if(IsPlayerConnected(i))
			{
				if(IsPlayerInRangeOfPoint(i,5000,x,y,z))
				{
					if(IsPlayerInAnyVehicle(i))
					{
						SetVehicleHealth(GetPlayerVehicleID(i),0.0);
					}
					SetPlayerHealth(playerid, 0.0);
					PlayerPlaySound(playerid, 1159, x, y, z);
				}
			}
		}
	}
	return 0;
}
And after I type /confirm , it does the command but also says "Server: Unknown Command"
Anyone Know whats wrong? Please Help! Thanks!
Reply
#2

You need to return 1; at the end of the command.
Reply
#3

pawn Код:
if(strcmp (cmdtext, "/confirm", true) == 0)
    {
      if(!Nuking)
      {
    SendClientMessage(playerid,RED,"Air Strike: We cannot find your marked location! Please mark it again!");
        return 1;
      }
      Nuking = false;
    new Float:x,Float:y,Float:z;
    GetObjectPos(NuclearBomb, x, y, z);
    DestroyObject(NuclearBomb);
    CreateExplosion(x, y, z, 7, 10);
    CreateExplosion(x, y, z+3, 7, 10);
    CreateExplosion(x, y, z+6, 7, 10);
    CreateExplosion(x, y, z+9, 7, 10);
    CreateExplosion(x, y, z+12, 7, 10);
    CreateExplosion(x, y, z+15, 7, 10);
    CreateExplosion(x, y, z+18, 7, 10);
    CreateExplosion(x, y, z+21, 7, 10);
    CreateExplosion(x, y+7, z+21, 7, 10);
    CreateExplosion(x, y-7, z+21, 7, 10);
    CreateExplosion(x+7, y, z+21, 7, 10);
    CreateExplosion(x-7, y, z+21, 7, 10);
    CreateExplosion(x, y, z+24, 7, 10);
    CreateExplosion(x, y+10, z+24, 7, 10);
    CreateExplosion(x, y-10, z+24, 7, 10);
    CreateExplosion(x+10, y, z+24, 7, 10);
    CreateExplosion(x-10, y, z+24, 7, 10);
    CreateExplosion(x, y, z+27, 7, 10);
    CreateExplosion(x, y+7, z+27, 7, 10);
    CreateExplosion(x, y-7, z+27, 7, 10);
    CreateExplosion(x+7, y, z+27, 7, 10);
    CreateExplosion(x-7, y, z+27, 7, 10);
    CreateExplosion(x, y, z+30, 7, 10);
    CreateExplosion(x, y+3, z+30, 7, 10);
    CreateExplosion(x, y-3, z+30, 7, 10);
    CreateExplosion(x+3, y, z+30, 7, 10);
    CreateExplosion(x-3, y, z+30, 7, 10);
    SendClientMessage(playerid,GREEN,"Air Strike: We sucessfully hit the selected target!");
        SetWeather(44);
        for(new i = 0; i < MAX_PLAYERS; i++)
      {
            if(IsPlayerConnected(i))
            {
                if(IsPlayerInRangeOfPoint(i,5000,x,y,z))
                {
                    if(IsPlayerInAnyVehicle(i))
                    {
                        SetVehicleHealth(GetPlayerVehicleID(i),0.0);
                    }
                    SetPlayerHealth(playerid, 0.0);
                    PlayerPlaySound(playerid, 1159, x, y, z);
                }
            }
        }
        return 1;
    }
    return 0;
}
Reply
#4

Thanks for your feedback guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)