OnPlayerCommandText problem... - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerCommandText problem... (
/showthread.php?tid=160923)
OnPlayerCommandText problem... -
Ash. - 18.07.2010
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!
Re: OnPlayerCommandText problem... -
Jeffry - 18.07.2010
The commands should work when the player has
LESS than 99 score?
Re: OnPlayerCommandText problem... -
Ash. - 18.07.2010
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.
Re: OnPlayerCommandText problem... -
Ash. - 18.07.2010
*Sorry about the bump
Should i add
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;
}
??
Re: OnPlayerCommandText problem... -
Jeffry - 18.07.2010
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. ^^
Re: OnPlayerCommandText problem... -
Ash. - 18.07.2010
Its a "Commands" filterscript. Ill PM you the .pwn file now.
Re: OnPlayerCommandText problem... -
Jeffry - 18.07.2010
Quote:
Originally Posted by funky1234
Its a "Commands" filterscript. Ill PM you the .pwn file now.
|
Okay. Iґll fix it then.