Unknown Command ??!
#1

I made a command but it work me only if anyone else typed it it give him "Unknown Command" here it is
PHP код:
CMD:createbiz(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playeridCOLOR_RED"Command not found on the server! /help");
    new 
pricelevelidintworldstring[128], Float:XiFloat:YiFloat:Ziinti;
    if(
sscanf(params,"ddi",price,level,id)) return SendClientMessage(playeridCOLOR_RED"Make a business: /createbiz [Price] [Type] [ID]");
    if(
level || level 8) return SendClientMessage(playeridCOLOR_RED"Type can't be below than 0 or more than 8");
    if(
price 100000) return SendClientMessage(playeridCOLOR_RED"Price can't be below than $100,000");
    new 
Float:xFloat:yFloat:z;
    new 
Float:a;
    
GetPlayerPos(playeridxyz);
    
GetPlayerFacingAngle(playerida);
    
BusinessInfo[id][bOwned] = 0;
    
BusinessInfo[id][bPrice] = price;
    
BusinessInfo[id][bType] = level;
    
BusinessInfo[id][bEntranceX] = x;
    
BusinessInfo[id][bEntranceY] = y;
    
BusinessInfo[id][bEntranceZ] = z;
    
BusinessInfo[id][bEntranceA] = a;
    if(
level == 1// 24/7
    
{
        new 
rand random(3);
        if(
rand == 1)
        {
            
BusinessInfo[id][bExitX] = -25.9441;
            
BusinessInfo[id][bExitY] = -187.9824;
            
BusinessInfo[id][bExitZ] = 1003.5469;
            
BusinessInfo[id][bInsideInt] = 17;
            
BusinessInfo[id][bInsideWorld] = 2;
        }
        else if(
rand == 2)
        {
            
BusinessInfo[id][bExitX] = 6.0926;
            
BusinessInfo[id][bExitY] = -31.5992;
            
BusinessInfo[id][bExitZ] = 1003.5494;
            
BusinessInfo[id][bInsideInt] = 10;
            
BusinessInfo[id][bInsideWorld] = 2;
        }
        else if(
rand == 3)
        {
            
BusinessInfo[id][bExitX] = -30.9024;
            
BusinessInfo[id][bExitY] = -91.6607;
            
BusinessInfo[id][bExitZ] = 1003.5469;
            
BusinessInfo[id][bInsideInt] = 18;
            
BusinessInfo[id][bInsideWorld] = 2;
        }
    }
    else if(
level == 3// Clothes
    
{
        new 
rand random(3);
        if(
rand == 1)
        {
               
BusinessInfo[id][bExitX] = 207.7771;
            
BusinessInfo[id][bExitY] = -110.9639;
            
BusinessInfo[id][bExitZ] = 1005.1328;
            
BusinessInfo[id][bInsideInt] = 15;
            
BusinessInfo[id][bInsideWorld] = 2;
        }
        if(
rand == 2)
        {
               
BusinessInfo[id][bExitX] = 204.35222;
            
BusinessInfo[id][bExitY] = -168.7473;
            
BusinessInfo[id][bExitZ] = 1000.5234;
            
BusinessInfo[id][bInsideInt] = 14;
            
BusinessInfo[id][bInsideWorld] = 2;
        }
        if(
rand == 3)
        {
            
BusinessInfo[id][bExitX] = 207.0500;
            
BusinessInfo[id][bExitY] = -139.7851;
            
BusinessInfo[id][bExitZ] = 1003.5078;
            
BusinessInfo[id][bInsideInt] = 3;
            
BusinessInfo[id][bInsideWorld] = 2;
        }
    }
    else if(
level == 4//pizza
    
{
        
BusinessInfo[id][bExitX] = 372.3002;
        
BusinessInfo[id][bExitY] = -132.9494;
        
BusinessInfo[id][bExitZ] = 1001.4922;
        
BusinessInfo[id][bInsideInt] = 5;
        
BusinessInfo[id][bInsideWorld] = 2;
    }
    else if(
level == 5//Burger
    
{
        
BusinessInfo[id][bExitX] = 363.3765;
        
BusinessInfo[id][bExitY] = -74.7553;
        
BusinessInfo[id][bExitZ] = 1001.5078;
        
BusinessInfo[id][bInsideInt] = 10;
        
BusinessInfo[id][bInsideWorld] = 2;
    }
    else if(
level == 6//Cluckin'bell
    
{
        
BusinessInfo[id][bExitX] = 364.8929;
        
BusinessInfo[id][bExitY] = -11.1855;
        
BusinessInfo[id][bExitZ] = 1001.8516;
        
BusinessInfo[id][bInsideInt] = 9;
        
BusinessInfo[id][bInsideWorld] = 2;
    }
    else if(
level == 7//Barber
    
{
        
BusinessInfo[id][bExitX] = 411.6246;
        
BusinessInfo[id][bExitY] = -22.8833;
        
BusinessInfo[id][bExitZ] = 1001.8047;
        
BusinessInfo[id][bInsideInt] = 2;
        
BusinessInfo[id][bInsideWorld] = 2;
    }
    else if(
level == 8//Tatoo
    
{
        
BusinessInfo[id][bExitX] = -204.4408;
        
BusinessInfo[id][bExitY] = -26.8013;
        
BusinessInfo[id][bExitZ] = 1002.2734;
        
BusinessInfo[id][bInsideInt] = 16;
        
BusinessInfo[id][bInsideWorld] = 2;
    }
    
BusinessInfo[id][bOutSideIcon] = CreateDynamicPickup(1272,1,BusinessInfo[id][bEntranceX],BusinessInfo[id][bEntranceY],BusinessInfo[id][bEntranceZ],-1);
    
BusinessInfo[id][bInsideIcon] = CreateDynamicPickup(1272,1,BusinessInfo[id][bExitX],BusinessInfo[id][bExitY],BusinessInfo[id][bExitZ],-1);
    new 
msg[128];
    
format(msg,sizeof(msg),"Next id will be %i !",id+1);
    
SendClientMessage(playerid, -1msg);
    new 
file4[40];
    
format(file4,sizeof(file4),BPATHid);
    new 
INI:File INI_Open(file4);
    
INI_SetTag(File,"Data");
    
INI_WriteInt(File,"bOwned",BusinessInfo[id][bOwned]);
    
INI_WriteInt(File,"bPrice",BusinessInfo[id][bPrice]);
    
INI_WriteString(File,"bOwner",BusinessInfo[id][bOwner]);
    
INI_WriteInt(File,"bType",BusinessInfo[id][bType]);
    
INI_WriteInt(File,"bLocked",BusinessInfo[id][bLocked]);
    
INI_WriteInt(File,"bMoney",BusinessInfo[id][bMoney]);
    
INI_WriteFloat(File,"bEntranceX",BusinessInfo[id][bEntranceX]);
    
INI_WriteFloat(File,"bEntranceY",BusinessInfo[id][bEntranceY]);
    
INI_WriteFloat(File,"bEntranceZ",BusinessInfo[id][bEntranceZ]);
    
INI_WriteFloat(File,"bEntranceA",BusinessInfo[id][bEntranceA]);
    
INI_WriteFloat(File,"bExitX",BusinessInfo[id][bExitX]);
    
INI_WriteFloat(File,"bExitY",BusinessInfo[id][bExitY]);
    
INI_WriteFloat(File,"bExitZ",BusinessInfo[id][bExitZ]);
    
INI_WriteFloat(File,"bExitA",BusinessInfo[id][bExitA]);
    
INI_WriteInt(File,"bInt",BusinessInfo[id][bInt]);
    
INI_WriteInt(File,"bWorld",BusinessInfo[id][bWorld]);
    
INI_WriteInt(File,"bInsideInt",BusinessInfo[id][bInsideInt]);
    
INI_WriteInt(File,"bInsideWorld",BusinessInfo[id][bInsideWorld]);
    
INI_WriteInt(File,"bInsideIcon",BusinessInfo[id][bInsideIcon]);
    
INI_WriteInt(File,"bOutSideIcon",BusinessInfo[id][bOutSideIcon]);
    
INI_WriteString(File,"bName","None");
    
INI_Close(File);
    
biz++;
    
SaveBusiness(id);
    return 
1;

It is a little bit long .
Please Help !
Reply
#2

I'm not sure, but return in ZCMD should always contain 1. You use like return SendClientMessage.... Maybe try sending a message and then return 1.
Reply
#3

I have about 40 command in the same way .
And explain more mabye i understood wrong
Reply
#4

6 months ago, when I dowloaded ZCMD, I did the same as you, because I thought it's faster etc.. But then SA-MP started to give me Unknown command. I realized, that when you return 1 on CMD, command works perfectly, but when 0, it shows you Unknown command. After that, I always use return 1 to finish everything in that command and it works perfectly. But in your case, in someway I can be wrong.
Reply
#5

It is already written because return 0 will ive unknow command but it is return 1 and it works for me but no to anyone else
PHP код:
    return 1
Reply
#6

Quote:
Originally Posted by kamiliuxliuxliux
Посмотреть сообщение
I'm not sure, but return in ZCMD should always contain 1. You use like return SendClientMessage.... Maybe try sending a message and then return 1.
This doesn't matter, returning 0 or not returning anything at all will show the command as executed unsuccessfully. (Giving the "unknown cmd"-message)

Also meaning instead of this line:
pawn Код:
if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_RED, "Command not found on the server! /help");
You can just use this:
pawn Код:
if(PlayerInfo[playerid][pAdmin] < 5) return 0;
To give the "unknown"-message.

Regarding the actual problem, im not sure why it happens, just thought i'd say that.
Reply
#7

lol this worked when my friend's level below than 5 it give him this message but after i have made his level 5 it started to send him "Unknown Command" and works with me !!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)