Disabling All Commands
#1

Hey, I Made This Filter Script Called Snach'sDm

i would like some help becouse it keeps disabling all the commands when i try to use it.... ANYHELP?

Code:
Код:
new Playersticked[200];
new Float:PlayerstickData[200][3];
#include <a_samp>
new playersticked[MAX_PLAYERS] = 0;
#pragma tabsize 0
#define FILTERSCRIPT
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_BRIGHTRED 0xFF0000AA
#define COLOR_GREEN 0x33AA33AA
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new SnachsDm;
//Originaly Made For SNdm By Snach
//--------------------------------------------------------------------------------------------------//

public OnFilterScriptInit()
{
    print("---------------------------------------------------");
    print("---------------------------------------------------");
    SnachsDm = CreateObject(18259, 1966.6487,1514.3054,25.2428, 0.0000, 0.0000, 0.0000);
    return 1;
}

//--------------------------------------------------------------------------------------------------//
IsPlayerInCube(playerid, Float:xmin, Float:ymin, Float:zmin, Float:xmax, Float:ymax, Float:zmax)
{
	new Float:x, Float:y, Float:z;
	GetPlayerPos(playerid, x, y, z);
	if(x > xmin && y > ymin && z > zmin && x < xmax && y < ymax && z < zmax)return 1;
	return 0;
}
public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
		if (strcmp(cmdtext, "/SnAcHhelp", true)==0){ if(IsPlayerAdmin(playerid)){
SendClientMessage(playerid, COLOR_YELLOW, "--- Snach commands ---");
SendClientMessage(playerid, COLOR_BRIGHTRED, "/Snachup /snachdown /snachright /snachleft /snachforwards /snachbackwards");
SendClientMessage(playerid, COLOR_BRIGHTRED, "/teleporttosnach /snachreset /getsnachhere /movesnachhere /nukesnach");
}if(!IsPlayerAdmin(playerid)){
SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
}return 1;}

if (strcmp(cmdtext, "/SnAcHup", true)==0){ if(IsPlayerAdmin(playerid)){
new Float:x, Float:y, Float:z;
GetObjectPos( SnachsDm, x, y, z );
MoveObject( SnachsDm, x, y, z+15, 5.0 );
SendClientMessage(playerid, 0x33AA33AA, "Snachs Dm House is going up now!");
}if(!IsPlayerAdmin(playerid)){
SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");}
return 1;}

if (strcmp(cmdtext, "/nukesnach", true)==0){if(IsPlayerAdmin(playerid)){
new Float:x, Float:y, Float:z;
GetObjectPos( SnachsDm, x, y, z );
CreateExplosion(x, y, z-3, 6, 80.0);
CreateExplosion(x+3, y, z-3, 6, 80.0);
CreateExplosion(x, y+6, z-3, 6, 80.0);
CreateExplosion(x, y+3, z-3, 6, 80.0);
CreateExplosion(x+6, y, z-3, 6, 80.0);
CreateExplosion(x+6, y+6, z-3, 6, 80.0);
CreateExplosion(x+5, y+6, z-3, 6, 80.0);
SendClientMessage(playerid, 0x33AA33AA, "You have nuked snach!");}
if(!IsPlayerAdmin(playerid)){
SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");}
return 1;}

if (strcmp(cmdtext, "/snachdown", true)==0){if(IsPlayerAdmin(playerid)){
new Float:x, Float:y, Float:z;
GetObjectPos( SnachsDm, x, y, z );
MoveObject( SnachsDm, x, y, z-25, 5.0 );
SendClientMessage(playerid, 0x33AA33AA, "Snach is going down now!");}
if(!IsPlayerAdmin(playerid)){
SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");}
return 1;}

if (strcmp(cmdtext, "/SnAcHright", true)==0){if(IsPlayerAdmin(playerid)){
new Float:x, Float:y, Float:z;
GetObjectPos( SnachsDm, x, y, z );
MoveObject( SnachsDm, x+15, y, z, 2.0 );
SendClientMessage(playerid, 0x33AA33AA, "Snach is going to the right now!");}
if(!IsPlayerAdmin(playerid)){
SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");}
return 1;
}
    if (strcmp(cmdtext, "/SnAcHleft", true)==0)
    {
    	if(IsPlayerAdmin(playerid))
    	  {
        new Float:x, Float:y, Float:z;
        GetObjectPos( SnachsDm, x, y, z );
        MoveObject( SnachsDm, x-15, y, z, 2.0 );
        SendClientMessage(playerid, 0x33AA33AA, "The SnAcH is going to the left now!");
				}
			if(!IsPlayerAdmin(playerid))
  			  {
  			  SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
  			  }
        return 1;
    }
    
    if (strcmp(cmdtext, "/SnAcHforwards", true)==0)
    {
    	if(IsPlayerAdmin(playerid))
    	  {
        new Float:x, Float:y, Float:z;
        GetObjectPos( SnachsDm, x, y, z );
        MoveObject( SnachsDm, x, y+15, z, 5.0 );
        SendClientMessage(playerid, 0x33AA33AA, "The SnAcH is going forwards now!");
				}
  	if(!IsPlayerAdmin(playerid))
  			  {
  			  SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
  			  }
        return 1;
    }
    
    if (strcmp(cmdtext, "/SnAcHbackwards", true)==0)
    {
     if(IsPlayerAdmin(playerid))
    	  {
        new Float:x, Float:y, Float:z;
        GetObjectPos( SnachsDm, x, y, z );
        MoveObject( SnachsDm, x, y-15, z, 5.0 );
        SendClientMessage(playerid, 0x33AA33AA, "The SnAcH is going backwards now!");
        }
 			if(!IsPlayerAdmin(playerid))
  			  {
  			  SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
  			  }
        return 1;
    }
    
    if(strcmp(cmdtext, "/SnAcHreset", true)==0)
    {
    		if(IsPlayerAdmin(playerid))
    	  {
				SetObjectPos( SnachsDm, 1966.6487,1514.3054,25.2428 );
 				SendClientMessage(playerid, 0x33AA33AA, "The SnAcH has been succesfully reset to its original place!");
				}
			if(!IsPlayerAdmin(playerid))
  			  {
  			  SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
  			  }
        return 1;
    }
    
    if(strcmp(cmdtext, "/getSnAcHhere", true)==0)
    {
    	if(IsPlayerAdmin(playerid))
    	  {
        new Float:x, Float:y, Float:z;
				GetPlayerPos(playerid, x, y, z);
				SetObjectPos(SnachsDm, x+3, y+2, z+11);
 				SendClientMessage(playerid, 0x33AA33AA, "The SnAcH has been teleported to you!");
				}
  	if(!IsPlayerAdmin(playerid))
  			  {
  			  SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
  			  }
        return 1;
    }

//////////////////////////////////
 if(strcmp(cmdtext, "/stick", true)==0)
    {
	new Float:oX, Float:oY, Float:oZ;
	new Float:pX, Float:pY, Float:pZ;
	new Float:dX, Float:dY, Float:dZ;
	GetObjectPos(SnachsDm, oX, oY, oZ);
	if(IsPlayerInCube(playerid, oX-25.0, oY-25.0, oZ-15.0, oX+25.0, oY+25.0, oZ+15.0)){
		GetPlayerPos(playerid, pX, pY, pZ);
		dX=floatsub(pX, oX);
		dY=floatsub(pY, oY);
		dZ=floatsub(pZ, oZ);
		Playersticked[playerid]=true;
		PlayerstickData[playerid][0]=dX;
		PlayerstickData[playerid][1]=dY;
		PlayerstickData[playerid][2]=dZ;
	}
	return true;
}

 if(strcmp(cmdtext, "/unstick", true)==0)
 
Playersticked[playerid]=true;
return true;

    if(strcmp(cmdtext, "/moveSnAcHhere", true)==0)
    {
     if(IsPlayerAdmin(playerid))
    	  {
        new Float:x, Float:y, Float:z;
				GetPlayerPos(playerid, x, y, z);
				MoveObject(SnachsDm, x+3, y+2, z+11, 15.0);
 				SendClientMessage(playerid, 0x33AA33AA, "The SnAcH has been moved to you!");
 				}
   	if(!IsPlayerAdmin(playerid))
  			  {
  			  SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
  			  }
        return 1;
    }
    
    if(strcmp(cmdtext, "/teleport", true)==0)
    {
    	if(IsPlayerAdmin(playerid))
    	  {
				SetPlayerInterior(playerid, 0 );
				SetPlayerPos(playerid, 1966.6487,1514.3054,27.2428);
				SendClientMessage(playerid, COLOR_GREEN, "You have been teleported to the SnAcH!");
 		}
 			if(!IsPlayerAdmin(playerid))
  			  {
  			  SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
  			  }
        return 1;
    }
    
    return 0;
}
yup i just gave it all away

(i dont really care it was easy to make)

Reply
#2

Don't return 0 under OnPlayerCommandText in filterscript, only main gamemode.
Reply
#3

view of last command:
Код:
if(strcmp(cmdtext, "/teleport", true)==0)
    {
    	if(IsPlayerAdmin(playerid))
    	  {
				SetPlayerInterior(playerid, 0 );
				SetPlayerPos(playerid, 1966.6487,1514.3054,27.2428);
				SendClientMessage(playerid, COLOR_GREEN, "You have been teleported to the SnAcH!");
 		}
 			if(!IsPlayerAdmin(playerid))
  			  {
  			  SendClientMessage(playerid, COLOR_BRIGHTRED, "You have to be a rcon admin to use this command!");
  			  }
        return 1;
}
like that? it still says i need to close it
Reply
#4

like he said: "Don't return 0 under OnPlayerCommandText in filterscript, only main gamemode."

hint: look at the second to last line of the first script you posted.
Reply
#5

If you need to close it just add closing curly-bracket (back to where it was).

Also another suggestion - IsPlayerAdmin() returns a boolean. It can only be either true (1) or false (0).
So instead of doing two if( IsPlayerAdmin() ) statements you could do

if( IsPlayerAdmin() ) { }
else { ]

This way it would be little bit more optimized
Or even better would be if you would use if ( IsPlayerAdmin() ) only once for all commands..
Reply
#6

Код:
else { ]
?
i think you mean
else { };

also, its also good to make sure you have proper indentation:
Код:
else
{
  //whatever you want.
}
Reply
#7

what is it ? ;x

script on ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)