SA-MP Forums Archive
Command coded but not working. - 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)
+--- Thread: Command coded but not working. (/showthread.php?tid=447254)



Command coded but not working. - FShiwani - 29.06.2013

I have implemented some Donator commands and yes I am Donator Rank 3 in game. One of the commands is to enter the donator lounge which is /dlenter shows up as "uNKNOWN COMMAND" even though I am at the spot where it is meant to be used

Код:
	if(strcmp(cmd,"/dlenter",true)==0)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 2, 1797.9247,-1578.6771,14.0893))// LS DONATOR LOUNGE Area near Alhambra and Unity Station
		{
			if(PlayerInfo[playerid][pDonateRank]=1) {
			    SetPlayerPos(playerid, 2262.6274,-1486.6484,1301.0859);
			    SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
			    return 1;
			}
			else if(PlayerInfo[playerid][pDonateRank]=2) {
			    SetPlayerPos(playerid, 2262.6274,-1486.6484,1301.0859);
			    SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
			    return 1;
			}
			else if(PlayerInfo[playerid][pDonateRank]=3) {
			    SetPlayerPos(playerid, 2262.6274,-1486.6484,1301.0859);
			    SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
			    return 1;
			}
			return 1;
	  	}
		else
		{
  			SendClientMessage(playerid,COLOR_GRAD2,"You are not a Donator/VIP. Visit our store to purchase.");
	        return 1;
        }
        return 1;
	}
	
	if(strcmp(cmd,"/dlexit",true)==0)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 2, 2262.6274,-1486.6484,1301.0859))
		{
			    SetPlayerPos(playerid, 1797.9247,-1578.6771,14.0893);
			    SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Exited.");
			    return 1;
		}
		return 1;
	}

	if(strcmp(cmd,"/dlocker",true)==0)
	{
	    if(IsPlayerInRangeOfPoint(playerid, 2, 2276.4619,-1494.6659,1301.0859))
		{
			if(PlayerInfo[playerid][pDonateRank]=1) {
                ShowPlayerDialog(playerid, DLOCKER_DIALOG, DIALOG_STYLE_LIST, "Donator Locker", "Refill Health\n Kevlar Armour     COST:$1500", "Confirm", "Cancel");
			    return 1;
			}
			else if(PlayerInfo[playerid][pDonateRank]=2) {
				ShowPlayerDialog(playerid, DLOCKER_DIALOG, DIALOG_STYLE_LIST, "Donator Locker", "Refill Health\n Kevlar Armour     COST:$1500", "Confirm", "Cancel");
			    return 1;
			}
			else if(PlayerInfo[playerid][pDonateRank]=3) {
				ShowPlayerDialog(playerid, DLOCKER_DIALOG, DIALOG_STYLE_LIST, "Donator Locker", "Refill Health\n Kevlar Armour     COST:$1500", "Confirm", "Cancel");
			    return 1;
			}
			else {
				SendClientMessage(playerid,COLOR_GRAD2,"You are not a Donator. Visit the store to purchase.");
			    return 1;
			}
			return 1;
	    }
	    else {
	        SendClientMessage(playerid,COLOR_GRAD2,"You are not at the Donator Locker.");
	        return 1;
	    }
	    return 1;
	}
Although I am getting no errors, its not working. I didnt try the other commands


Re: Command coded but not working. - Anak - 29.06.2013

make sure that you are not using this
pawn Код:
#include <zcmd>
it blocks onplayercommandtext.


Re: Command coded but not working. - FShiwani - 29.06.2013

Quote:
Originally Posted by Anak
Посмотреть сообщение
make sure that you are not using this
pawn Код:
#include <zcmd>
it blocks onplayercommandtext.
Nope, im not using that include and I have placed it under onplayercommandtext callback. Is it something to do with the return 1; thingy?


Re: Command coded but not working. - Biess - 29.06.2013

Run nativechecker or crashdetect to find the problem


Re: Command coded but not working. - FShiwani - 29.06.2013

I mean all other commands work and I have put these in the same place under the same callback, I am using LSL-RP script


Re : Command coded but not working. - yusei - 29.06.2013

PHP код:
if(strcmp(cmd,"/dlenter",true)==0)
    {
        if(
IsPlayerInRangeOfPoint(playerid21797.9247,-1578.6771,14.0893))// LS DONATOR LOUNGE Area near Alhambra and Unity Station
        
{
            if(
PlayerInfo[playerid][pDonateRank]=1) {
                
SetPlayerPos(playerid2262.6274,-1486.6484,1301.0859);
                
SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
                return 
1;
            }
            else if(
PlayerInfo[playerid][pDonateRank]=2) {
                
SetPlayerPos(playerid2262.6274,-1486.6484,1301.0859);
                
SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
                return 
1;
            }
            else if(
PlayerInfo[playerid][pDonateRank]=3) {
                
SetPlayerPos(playerid2262.6274,-1486.6484,1301.0859);
                
SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
                return 
1;
            }
          }
        else
        {
              
SendClientMessage(playerid,COLOR_GRAD2,"You are not a Donator/VIP. Visit our store to purchase.");
            return 
1;
        }
        return 
1;
    } 



Re: Re : Command coded but not working. - FShiwani - 30.06.2013

Quote:
Originally Posted by yusei
Посмотреть сообщение
PHP код:
if(strcmp(cmd,"/dlenter",true)==0)
    {
        if(
IsPlayerInRangeOfPoint(playerid21797.9247,-1578.6771,14.0893))// LS DONATOR LOUNGE Area near Alhambra and Unity Station
        
{
            if(
PlayerInfo[playerid][pDonateRank]=1) {
                
SetPlayerPos(playerid2262.6274,-1486.6484,1301.0859);
                
SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
                return 
1;
            }
            else if(
PlayerInfo[playerid][pDonateRank]=2) {
                
SetPlayerPos(playerid2262.6274,-1486.6484,1301.0859);
                
SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
                return 
1;
            }
            else if(
PlayerInfo[playerid][pDonateRank]=3) {
                
SetPlayerPos(playerid2262.6274,-1486.6484,1301.0859);
                
SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
                return 
1;
            }
          }
        else
        {
              
SendClientMessage(playerid,COLOR_GRAD2,"You are not a Donator/VIP. Visit our store to purchase.");
            return 
1;
        }
        return 
1;
    } 
Can I ask what you did apart from fixing the layout/indentation.


Re: Command coded but not working. - Abhishek. - 30.06.2013

in your server.cfg, show me what you have on the filterscript line, i had the same problem with commands, and it was caused because of an admin system


Re : Command coded but not working. - yusei - 30.06.2013

Quote:

Can I ask what you did apart from fixing the layout/indentation

Код:
if(IsPlayerInRangeOfPoint(playerid, 2, 1797.9247,-1578.6771,14.0893))// LS DONATOR LOUNGE Area near Alhambra and Unity Station
		{
			if(PlayerInfo[playerid][pDonateRank]=1) {
			    SetPlayerPos(playerid, 2262.6274,-1486.6484,1301.0859);
			    SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
			    return 1;
			}
			else if(PlayerInfo[playerid][pDonateRank]=2) {
			    SetPlayerPos(playerid, 2262.6274,-1486.6484,1301.0859);
			    SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
			    return 1;
			}
			else if(PlayerInfo[playerid][pDonateRank]=3) {
			    SetPlayerPos(playerid, 2262.6274,-1486.6484,1301.0859);
			    SendClientMessage(playerid,COLOR_GRAD2,"Donator Lounge Entered.");
			    return 1;
			}
			return 1;
	  	}



Re: Command coded but not working. - FShiwani - 30.06.2013

Quote:
Originally Posted by Abhishek.
Посмотреть сообщение
in your server.cfg, show me what you have on the filterscript line, i had the same problem with commands, and it was caused because of an admin system
I am using no filterscripts, I am using a gamemode LSL-RP