SA-MP Forums Archive
[Help] Wrong Command Problem - 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] Wrong Command Problem (/showthread.php?tid=106875)



[Help] Wrong Command Problem - jamesb93 - 06.11.2009

Hey,

I have a complete mysql TDM script. Only one problem is when a player does a command that does not exist it, no matter what was entered. Another command shows up(/ranking). Any ideas why?


Re: [Help] Wrong Command Problem - Luka P. - 06.11.2009

Try to
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
    new string[96];
    format(string,sizeof(string),"Command %s doesn't exist!",cmdtext);
    return SendClientMessage(playerid,COLOR,string);
}



Re: [Help] Wrong Command Problem - Redgie - 06.11.2009

Show us the OnPlayerCommandText, if it's long pastebin it.


Re: [Help] Wrong Command Problem - jamesb93 - 06.11.2009

Update: Does it ffor some real commands now too, Only command it does it for seems to be /ahelp

OnPlayerCommandText fuckign hudge, He it is
http://pastebin.com/m77b685ff


Re: [Help] Wrong Command Problem - Luka P. - 06.11.2009

Try it now
http://pastebin.ca/1659965


Re: [Help] Wrong Command Problem - jamesb93 - 06.11.2009

Still the same, It appears that only /ahelp show the /ranking command


Re: [Help] Wrong Command Problem - jamesb93 - 06.11.2009

Update : /admins dose it too


Re: [Help] Wrong Command Problem - Whitetiger - 06.11.2009

i had this problem awhile ago, i think i remember how to fix it.. the problem is because your command(/ranking) is returning the value 0, when it needs to return 1.

this might not be the problem, but i had a similar one and this is how i fixed it


Re: [Help] Wrong Command Problem - jamesb93 - 07.11.2009

Not for me it returns 1 and just as a test I removed it and it did it for the /kills command


Re: [Help] Wrong Command Problem - Redgie - 07.11.2009

Your ranking and kills code were linked together with { and } misplaced. Here is how they should look:

pawn Код:
if(strcmp(cmd,"/ranking",true)==0)
{
  if(IsPlayerConnected(playerid))
  {
    new string[128];
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "|________________ Ranking Goals ________________|");
    format(string, sizeof(string), "** Rank 4 - Helicopter Usage: %s.", CCN[PlayerInfo[playerid][pHeligoal]]);
    SendClientMessage(playerid, COLOR_GREEN, string);
    format(string, sizeof(string), "** Rank 6 - Armour Bar: %s.", CCN[PlayerInfo[playerid][pArmourgoal]]);
    SendClientMessage(playerid, COLOR_GREEN, string);
    format(string, sizeof(string), "** Rank 8 - /Mapvis Command: %s.", CCN[PlayerInfo[playerid][pMapgoal]]);
    SendClientMessage(playerid, COLOR_GREEN, string);
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "|_______________________________________________|");
  }
  return 1;
}
pawn Код:
if(strcmp(cmd,"/kills",true)==0)
{
  if(IsPlayerConnected(playerid))
  {
    new grkills = PlayerInfo[playerid][pGrenadekill];
    new mpkills = PlayerInfo[playerid][pMp5kill];
    new knkills = PlayerInfo[playerid][pKnucklekill];
    new string[128];
    new text1[20];
    new text2[20];
    new text3[20];
    if(PlayerInfo[playerid][pGrenadekill] == 25) { text1 = "Complete!"; } else { text1 = "Not Complete"; }
    if(PlayerInfo[playerid][pMp5kill] == 100) { text2 = "Complete!"; } else { text2 = "Not Complete"; }
    if(PlayerInfo[playerid][pKnucklekill] == 15) { text3 = "Complete!"; } else { text3 = "Not Complete"; }
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "|________________ Kills Goals ________________|");
    format(string, sizeof(string), "** %d /25 Grenades kills: %s.",grkills, text1);
    SendClientMessage(playerid, COLOR_WHITE, string);
    format(string, sizeof(string), "** %d /100 MP5 kills: %s.",mpkills, text2);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    format(string, sizeof(string), "** %d /15 Knuckle Duster kills: %s.",knkills, text3);
    SendClientMessage(playerid, COLOR_GOLD, string);
    SendClientMessage(playerid, COLOR_LIGHTGREEN, "|______________________________________________|");
  }
  return 1;
}
Remember that all commands should have the same number of { as } in them, if there are more or less than there should be, problems like the one you described will occur.