SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/07/2012, 01:14 AM   #1
Knappen
Huge Clucker
 
Knappen's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 231
Reputation: 12
Default Problem with command. Only returns Server: Unknown Command

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;
    }
Knappen is offline   Reply With Quote
Old 08/07/2012, 01:15 AM   #2
Kirollos
Gangsta
 
Kirollos's Avatar
 
Join Date: Jun 2010
Location: Cairo, Egypt
Posts: 590
Reputation: 80
Default Re: Problem with command. Only returns Server: Unknown Command

all the commands dont work? or some?
Kirollos is offline   Reply With Quote
Old 08/07/2012, 01:22 AM   #3
coole210
High-roller
 
Join Date: Jul 2008
Location: Canada
Posts: 1,033
Reputation: 84
Default Re: Problem with command. Only returns Server: Unknown Command

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

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

Code:
WHERE `Name`='%s'
coole210 is offline   Reply With Quote
Old 08/07/2012, 01:25 AM   #4
Kirollos
Gangsta
 
Kirollos's Avatar
 
Join Date: Jun 2010
Location: Cairo, Egypt
Posts: 590
Reputation: 80
Default Re: Problem with command. Only returns Server: Unknown Command

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.)
Kirollos is offline   Reply With Quote
Old 08/07/2012, 01:30 AM   #5
coole210
High-roller
 
Join Date: Jul 2008
Location: Canada
Posts: 1,033
Reputation: 84
Default Re: Problem with command. Only returns Server: Unknown Command

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.
coole210 is offline   Reply With Quote
Old 08/07/2012, 02:23 AM   #6
Knappen
Huge Clucker
 
Knappen's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 231
Reputation: 12
Default Re: Problem with command. Only returns Server: Unknown Command

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.
Knappen is offline   Reply With Quote
Old 08/07/2012, 02:58 AM   #7
Kirollos
Gangsta
 
Kirollos's Avatar
 
Join Date: Jun 2010
Location: Cairo, Egypt
Posts: 590
Reputation: 80
Default Re: Problem with command. Only returns Server: Unknown Command

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

and let's see if it will work or not?
Kirollos is offline   Reply With Quote
Old 08/07/2012, 03:03 AM   #8
Knappen
Huge Clucker
 
Knappen's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 231
Reputation: 12
Default Re: Problem with command. Only returns Server: Unknown Command

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.
Knappen is offline   Reply With Quote
Old 08/07/2012, 03:29 PM   #9
Knappen
Huge Clucker
 
Knappen's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 231
Reputation: 12
Default Re: Problem with command. Only returns Server: Unknown Command

bump
Knappen is offline   Reply With Quote
Old 18/12/2013, 07:09 PM   #10
iFiras
Huge Clucker
 
iFiras's Avatar
 
Join Date: Oct 2013
Location: Tunisia.
Posts: 431
Reputation: 18
Default Re: Problem with command. Only returns Server: Unknown Command

Removed

Last edited by iFiras; 19/12/2013 at 08:54 AM.
iFiras is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
This returns Server Unknown Command, But still executes? Dokins Scripting Help 7 28/01/2012 11:37 PM
Executed ZCMD command returns SERVER: Unknown Command SexTourist Scripting Help 12 03/01/2012 04:38 PM
Command returns SERVER: Unknown command admantis Help Archive 7 09/12/2010 07:52 AM
Command that returns SERVER: Unknown Command. pagie1111 Help Archive 11 11/04/2010 09:55 AM
Commands working, but returns Server: Unknown Command WickWoody Help Archive 1 09/09/2009 12:13 AM


All times are GMT. The time now is 08:57 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.