[Help] Wrong Command Problem
#1

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?
Reply
#2

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);
}
Reply
#3

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

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
Reply
#5

Try it now
http://pastebin.ca/1659965
Reply
#6

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

Update : /admins dose it too
Reply
#8

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
Reply
#9

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)