SA-MP Forums Archive
[Help]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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help]Unknown Command (/showthread.php?tid=116161)



[Help]Unknown Command - jamesb93 - 27.12.2009

Hey,

Well my /carcolor command returns an "[ERROR] Unknown Command" when done IG, can anyone find out why?

pawn Код:
dcmd_carcolor(playerid,params[])
{
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0x33CCFFFF,"[VT ERROR] You're not in a vehicle.");
  new
    color1,
    color2,
    vid=GetPlayerVehicleID(playerid);
    if(sscanf(params,"ii",color1,color2)) return SendClientMessage(playerid,0x33CCFFFF,"Usage: /carcolor [color 1] [color2]");
  if(vInfo[vid][vOwnerId] != PlayerInfo[playerid][pSQLId]) return SendClientMessage(playerid,0x33CCFFFF,"This vehicle does not belong to you.");
    vInfo[vid][vColor1]=color1;
    vInfo[vid][vColor2]=color2;
    ChangeVehicleColor(vid,color1,color2);
    SaveVehicle(vid);
    return 1;
}



Re: [Help]Unknown Command - Backwardsman97 - 27.12.2009

If you have any other scripts running, make sure it says return 0 at the bottom of their OnPlayerCommandText callbacks.


Re: [Help]Unknown Command - M4S7ERMIND - 27.12.2009

Quote:
Originally Posted by Backwardsman97
If you have any other scripts running, make sure it says return 0 at the bottom of their OnPlayerCommandText callbacks.
Did you ever read what he asked for?

Quote:
Originally Posted by ŚĂĞĔ
Well my /carcolor command returns an "[ERROR] Unknown Command" when done IG, can anyone find out why?
What does SaveVehicle function do?


Re: [Help]Unknown Command - Backwardsman97 - 27.12.2009

Quote:
Originally Posted by Μαστερμινδ
Quote:
Originally Posted by Backwardsman97
If you have any other scripts running, make sure it says return 0 at the bottom of their OnPlayerCommandText callbacks.
Did you ever read what he asked for?

Quote:
Originally Posted by ŚĂĞĔ
Well my /carcolor command returns an "[ERROR] Unknown Command" when done IG, can anyone find out why?
What does SaveVehicle function do?
Um...yeah? If you have a filterscript running that has return 1 at the bottom of your OnPlayerCommandText callback, it will return an unknown command for all other scripts when you type in a command. So boom.


Re: [Help]Unknown Command - jamesb93 - 27.12.2009

Theres other commands that work out fine though and I have no FS's running that use OnPlayerCommandText.

SaveVehicle just saves the vehicle to the database.


Re: [Help]Unknown Command - M4S7ERMIND - 27.12.2009

Quote:
Originally Posted by Backwardsman97
Um...yeah? If you have a filterscript running that has return 1 at the bottom of your OnPlayerCommandText callback, it will return an unknown command for all other scripts when you type in a command. So boom.
uhmm.. maybe so, but he said its just his /carcolor command that returns Unknown command :3

Quote:
Originally Posted by ŚĂĞĔ
SaveVehicle just saves the vehicle to the database.
Make sure it doesnt return anything.. if that helps


Re: [Help]Unknown Command - Dark_Kostas - 27.12.2009

pawn Код:
dcmd_carcolor(playerid,params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0x33CCFFFF,"[VT ERROR] You're not in a vehicle.");
    new color1, color2, vid=GetPlayerVehicleID(playerid);
    print("1");
    if(sscanf(params,"ii",color1,color2)) return SendClientMessage(playerid,0x33CCFFFF,"Usage: /carcolor [color 1] [color2]");
    print("2");
    if(vInfo[vid][vOwnerId] != PlayerInfo[playerid][pSQLId]) return SendClientMessage(playerid,0x33CCFFFF,"This vehicle does not belong to you.");
    vInfo[vid][vColor1]=color1;
    vInfo[vid][vColor2]=color2;
    print("3");
    ChangeVehicleColor(vid,color1,color2);
    print("4");
    SaveVehicle(vid);
    print("5");
    return 1;
}
Use these prints to debug your command in each action. Then look your samp_server.exe window and look which of these prints used. If you see 5 then it means the command works good.


Re: [Help]Unknown Command - jamesb93 - 27.12.2009

I can't look in the server window but Theres none of those prints in the server_log atoll.


Re: [Help]Unknown Command - M4S7ERMIND - 27.12.2009

Код:
dcmd(carcolor,8,cmdtext);
Make sure the length of the command is 8 characters


Re: [Help]Unknown Command - jamesb93 - 27.12.2009

Uhmm it was 7,

Stupid mistake by me XD thanks