OnPlayerCommandText problem...
#1

Hi all, again.

Im having a few problems with some commands in an OnPlayerCommandText section. All commands around the problem in question work, and im not having problems with them. However the problem im having is with commands that have 'if' in them.

Here's the section that doesnt work:

pawn Код:
// Most Valued Workers...
    if (strcmp("/mvw", cmdtext, true) == 0)
    {
        if (GetPlayerScore(playerid) < 99)
        {
            SendClientMessage(playerid, MVW, "You are a Most Valued Worker");
            SendClientMessage(playerid, MVW, "Here are commands that you can use:");
            SendClientMessage(playerid, MVW, "-----------------------------------");
            SendClientMessage(playerid, MVW, "/fix /nos /hy /tune");
            return 1;
        }
    }

    if (strcmp("/fix", cmdtext, true))
    {
        if (GetPlayerScore(playerid) < 99)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            return 1;
        }
    }

    if (strcmp("/nos", cmdtext, true))
    {
        if (GetPlayerScore(playerid) < 99)
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
            return 1;
        }
    }
    if (strcmp("/hy", cmdtext, true))
    {
        if (GetPlayerScore(playerid) < 99)
        {
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
            return 1;
        }
    }
    if (strcmp("/tune", cmdtext, true))
    {
        if (GetPlayerScore(playerid) < 99)
        {
            RepairVehicle(GetPlayerVehicleID(playerid));
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); // NOS
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1087); // Hydraulics
            AddVehicleComponent(GetPlayerVehicleID(playerid), 1082); //Wheels
            ChangeVehicleColor(GetPlayerVehicleID(playerid), -1, -1); //Colour
            return 1;
        }
    }
I would be very grateful if you could help me get this working. If you require the whole script let me know, although the rest of the script works.

EDIT: I have fixed the script by turning all the math symbols around. (Maths isnt my strong point) However the only command that works is /nos - Could somebody please take a look?

Thanks
Ash!
Reply
#2

The commands should work when the player has LESS than 99 score?
Reply
#3

Quote:
Originally Posted by Jeffry
Посмотреть сообщение
The commands should work when the player has LESS than 99 score?
No, it should be more, i looked at the symbols myself afterwards and kicked myself

Read my edit on the first post.
Reply
#4

*Sorry about the bump

Should i add
pawn Код:
return 1;
at the end of the
pawn Код:
if (GetPlayerScore(playerid) > 99)
{
   //Stuff here
}
that?

Like this:
pawn Код:
if (GetPlayerScore(playerid) > 99)
{
   //Stuff here
}
return 1;
-or-

pawn Код:
if (GetPlayerScore(playerid) > 99)
{
   //Stuff here
   return 1;
}
??
Reply
#5

You can PM me the full GM/FS if you want. It will be easy for me to fix it then.

PS: I wont steal it, or give it away. I have my own server, so I dont need it. ^^
Reply
#6

Its a "Commands" filterscript. Ill PM you the .pwn file now.
Reply
#7

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Its a "Commands" filterscript. Ill PM you the .pwn file now.
Okay. Iґll fix it then.
Reply


Forum Jump:


Users browsing this thread: