CarColour doesn't function good!
#1

Hello everyone,

I have make a simple FS:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  return 1;
}
No errors but Ingame EX: /mycommand in FS works, the others in GM doesn't works!
Please
Reply
#2

Bump
Reply
#3

What the, and what should just a return 1; do ??
You should make a command...
Reply
#4

Quote:
Originally Posted by Mean
Посмотреть сообщение
What the, and what should just a return 1; do ??
You should make a command...
I have a /carcolour under the OnPlayerCommandText just I make it hidden, I've just post the form of it here

When I'm ingame and type /carcolour & it's return 1; it function good but the other Cmds I have in the main GM not works
& When I set it to return 0; and in game tape /carcolour it works but it send also an UNKNOWN COMMAND under the USAGE: ........

Okay !
Reply
#5

Put return 0 at the end of the OnPlayerCommandText and return 1 at the end of the command.
Reply
#6

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Put return 0 at the end of the OnPlayerCommandText and return 1 at the end of the command.
Still the same error !
Reply
#7

it actually doesn't matter what he returns at the end of it. show us the carcolour cmd, maybe a mistake is in that.
Reply
#8

This is my car colour command:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], idx;
    cmd = strtok(cmdtext, idx);
    if (strcmp("/carcolour", cmd, true) == 0)
    {
      new Colour1[128];
      new Colour2[128];
      new currentveh;
      Colour1 = strtok(cmdtext, idx);
      Colour2 = strrest(cmdtext, idx);
      currentveh = GetPlayerVehicleID(playerid);
      if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,RED,"You're not in a car.");
 if(IsPlayerInAnyVehicle(playerid))
    {
    if (!strval(Colour1) || strval(Colour1)> 255)
        {
        SendClientMessage(playerid, YELLOW, "Invalid colour1.");
        return 1;
        }
    else if (!strval(Colour2) || strval(Colour2) > 255)
        {
        SendClientMessage(playerid, YELLOW, "Invalid colour2.");
        return 1;
        }
 else {
    ChangeVehicleColor(currentveh, strval(Colour1), strval(Colour2));
    }
    }
    }
    return 0;
}
+ When I'm in a car and tape /carcolour and need to give for player USAGE: /carcolour id1 id2
because now, if I tape /carcolour it give me Invalid ID1 ?!
and when I write the full form Ex: /carcolour 3 6 it change my car's colour and give an Error msg: UNKNOWN COMMAND !

Please
Reply
#9

Quote:
Originally Posted by Macluawn
Посмотреть сообщение
it actually doesn't matter what he returns at the end of it.
It does matter.

https://sampwiki.blast.hk/wiki/Category:Scripting_Callbacks

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], idx;
    cmd = strtok(cmdtext, idx);
    if (strcmp("/carcolour", cmd, true) == 0)
    {
        new Colour1[128];
        new Colour2[128];
        new currentveh;
        Colour1 = strtok(cmdtext, idx);
        Colour2 = strrest(cmdtext, idx);
        currentveh = GetPlayerVehicleID(playerid);
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,RED,"You're not in a car.");
        if(IsPlayerInAnyVehicle(playerid))
        {
            if (!strval(Colour1) || strval(Colour1)> 255)
            {
                SendClientMessage(playerid, YELLOW, "Invalid colour1.");
                return 1;
            }
            else if (!strval(Colour2) || strval(Colour2) > 255)
            {
                SendClientMessage(playerid, YELLOW, "Invalid colour2.");
                return 1;
            }
            else
            {
                ChangeVehicleColor(currentveh, strval(Colour1), strval(Colour2));
            }
        }
        return 1;
    }
    return 0;
}
Reply
#10

Quote:
Originally Posted by Yaszine
Посмотреть сообщение
This is my car colour command:
+ When player in a car and tape /carcolour it well give to him USAGE: /carcolour id1 id2
because now, if I tape /carcolour it give me Invalid ID1 ?!
and /carcolour 158 it give me Invalid ID2?!
And what about that ?!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)