SA-MP Forums Archive
Problem with command. Only returns Server: Unknown Command - 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: Problem with command. Only returns Server: Unknown Command (/showthread.php?tid=357679)



Problem with command. Only returns Server: Unknown Command - Knappen - 08.07.2012

Hello, I've been scripting for a while now I guess, and have never had this problem before. I've had this problem with ALL my commands at once, but not on a single one alone.

To me this command looks just fine, but maybe you guys could help me a bit?

pawn Code:
if(strcmp(cmd, "/asellcar", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] > 5)
        {
            new vehid;
            vehid = GetPlayerVehicleID(playerid);
            new CarQuery[100];
            new OwnerName[MAX_PLAYER_NAME];
            OwnerName = CarInfo[vehid][cOwner];
            new Owner = ReturnUser(OwnerName);
            new Value = CarInfo[vehid][cValue];
            if(gPlayerLogged[Owner] != 0)
            {
                PlayerInfo[Owner][pPcarkey] = 999;
                PlayerInfo[Owner][pAccount] += CarInfo[vehid][cValue];
                SendClientMessage(Owner, COLOR_INFO, "* Your vehicle was sold by and admin. Your money has been wired to your bank account.");
            }
            else
            {
                format(CarQuery, sizeof(CarQuery), "UPDATE `Players` SET `Car`=999, `Bank`=%d WHERE `Name`=`%s`", PlayerInfo[Owner][pAccount] + Value, CarInfo[vehid][cOwner]);
                mysql_query(CarQuery);
            }
            CarInfo[vehid][cOwned] = 0;
            strmid(CarInfo[vehid][cOwner], "Dealership", 0, strlen("Dealership"), 999);
            PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
            GameTextForPlayer(playerid, "~w~You have admin sold the vehicle", 10000, 3);
            CarInfo[vehid][cLocationx] = CarInfo[vehid][cSellLocationx];
            CarInfo[vehid][cLocationy] = CarInfo[vehid][cSellLocationy];
            CarInfo[vehid][cLocationz] = CarInfo[vehid][cSellLocationz];
            CarInfo[vehid][cAngle] = CarInfo[vehid][cSellAngle];
            RemovePlayerFromVehicle(playerid);
            TogglePlayerControllable(playerid, 1);
            SaveCars(vehid, 2);
            DestroyVehicle(vehid);
            CreateVehicle(CarInfo[vehid][cModel], CarInfo[vehid][cLocationx], CarInfo[vehid][cLocationy], CarInfo[vehid][cLocationz]+1.0, CarInfo[vehid][cAngle], CarInfo[vehid][cColorOne], CarInfo[vehid][cColorTwo], 60000);
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "* You are not authorized to use that command.");
        }
        return 1;
    }



Re: Problem with command. Only returns Server: Unknown Command - Kirollos - 08.07.2012

all the commands dont work? or some?


Re: Problem with command. Only returns Server: Unknown Command - coole210 - 08.07.2012

Could easily be a MySQL error. I see a problem with your query:

Code:
WHERE `Name`=`%s`
It should be

Code:
WHERE `Name`='%s'



Re: Problem with command. Only returns Server: Unknown Command - Kirollos - 08.07.2012

Quote:
Originally Posted by coole210
View Post
Could easily be a MySQL error. I see a problem with your query:

Code:
WHERE `Name`=`%s`
It should be

Code:
WHERE `Name`='%s'
you are right but he has also problem here the command didnt success. (it tells him Server: Unknown Command.)


Re: Problem with command. Only returns Server: Unknown Command - coole210 - 08.07.2012

Quote:
Originally Posted by kirollos
View Post
you are right but he has also problem here the command didnt success. (it tells him Server: Unknown Command.)
If the mysql query is incorrect, it can either crash the whole server or in commands it often just sends SERVER: Unknown Command.


Re: Problem with command. Only returns Server: Unknown Command - Knappen - 08.07.2012

Just a minor mistake, but that is not the reason it returns SERVER: Unknown command.
If there is an error in the query, it will show up in the debug

But the command looks fine, doesn't it?

All my other commands work, at least I think they do. I haven't had any trouble using other commands.


Re: Problem with command. Only returns Server: Unknown Command - Kirollos - 08.07.2012

can you try use on a command prossesor ? (like ZCMD) ?

and let's see if it will work or not?


Re: Problem with command. Only returns Server: Unknown Command - Knappen - 08.07.2012

I would prefer not to, I'm going to convert all my commands to ZCMD in due time, but not right now Haven't really studied up on it, so not sure how to do it either.


Re: Problem with command. Only returns Server: Unknown Command - Knappen - 08.07.2012

bump


Re: Problem with command. Only returns Server: Unknown Command - iFiras - 18.12.2013

Removed