Sorry my noobish.
#1

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/maps", cmdtext, true))
    {
      if(HasUsedMaps[playerid] == 1)
      {
            HasUsedMaps[playerid] = 1;
        TextDrawShowForPlayer(playerid, Maps);
        SendClientMessage(playerid, 0xFFFFFF, "* To close this box, type '/maps' again.");
            return 1;
        }
        else TextDrawHideForPlayer(playerid, Maps); HasUsedMaps[playerid] = 0;
    }
    return 0;
}
Код:
SERVER: Unkwnown Command.
What's wrong?
Reply
#2

[quote=Hot ]
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/maps", cmdtext, true))
    {
      if(HasUsedMaps[playerid] == 1)
      {
            HasUsedMaps[playerid] = 1;
        TextDrawShowForPlayer(playerid, Maps);
        SendClientMessage(playerid, 0xFFFFFF, "* To close this box, type '/maps' again.");
            return 1;
        }
        else TextDrawHideForPlayer(playerid, Maps); HasUsedMaps[playerid] = 0;
    return 1;
    }
    return 0;
}
Reply
#3

Now nothing happens :S
Reply
#4

pawn Код:
if(!strcmp("/maps", cmdtext, true))
To

pawn Код:
if(strcmp("/maps", cmdtext, true) == 0)
Reply
#5

Quote:
Originally Posted by RaFsTar
pawn Код:
if(!strcmp("/maps", cmdtext, true))
To

pawn Код:
if(strcmp("/maps", cmdtext, true) == 0)
!strcmp() and strcmp() == 0 is the same...
Reply
#6

have u tried
pawn Код:
if(strcmp(cmdtext,"/maps", true) == 0)
Reply
#7

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
Should have return 1;

e.g:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
//STUFF

return 1;
}
Reply
#8

Quote:
Originally Posted by RaFsTar
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
Should have return 1;

e.g:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
//STUFF

return 1;
}
There is no difference...return 1 just shows the player command has been found. If he write /help and there is no command called /help it will still show that the command has been found.

That's why he should return 0; because it will send "SERVER: Unknown command." if there is no such command...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)