last thing ...
#1

I'm trying to make a character on OnPlayerText become a command, for type:

pawn Код:
& + text
Instead

pawn Код:
/x + text
here:

pawn Код:
if(text[0] == '&')
   {
         OnPlayerCommandText(playerid, "/x");
     return 0;
   }
And when I type, just shows the character:

pawn Код:
&
PS: My command chose is on dcmd, but I already tried with a command on OnPlayerCommandText, and doesn't works. Any Idea?
Reply
#2

Well you're not passing anything to it, all your send to OnPlayerCommandText is "/x"...there's no text or anything, you need some formatting.

pawn Код:
if(text[0] == '&')
{
    new string[128];
    format(string,sizeof(string),"/x %s",text);
    OnPlayerCommandText(playerid, "/x");
    return 0;
}
Why do you pass it through OnPlayerCommandText anyway? Couldn't you just do:

pawn Код:
if(text[0] == '&')
{
    new string[128];
    format(string,sizeof(string),"Chat: %s",text);
    SendClientMessageToAll(red,string);
    return 0;
}
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
Well you're not passing anything to it, all your send to OnPlayerCommandText is "/x"...there's no text or anything, you need some formatting.

pawn Код:
if(text[0] == '&')
{
    new string[128];
    format(string,sizeof(string),"/x %s",text);
    OnPlayerCommandText(playerid, "/x");
    return 0;
}
Why do you pass it through OnPlayerCommandText anyway? Couldn't you just do:

pawn Код:
if(text[0] == '&')
{
    new string[128];
    format(string,sizeof(string),"Chat: %s",text);
    SendClientMessageToAll(red,string);
    return 0;
}

Since I fixed the command /x 100%, I transfered the command for the:

pawn Код:
&
And now that's ok:

pawn Код:
new string[128],name[30];
   if(text[0] == '&')
{
   GetPlayerName(playerid, name, 30);
   format(string, sizeof(string), "CHAT: %s [ID: %d]: %s", name, playerid, text[1]);
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(GetPlayerTeam(playerid) == GetPlayerTeam(i))
      {
         SendClientMessage(i,agua,string);
         return 0;
      }
   }
   
    return 0;
}
thx
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)