Command only available at ammunation?
#1

How can I make a command only available at the ammunation?

I want
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/buylaser", cmdtext, true, 10) == 0)
	{
		ShowMenuForPlayer(waffenmenu,playerid);
		TogglePlayerControllable(playerid,0);
		return 1;
	}
to only be able to be used when inside ammunation...
Reply
#2

Quote:
Originally Posted by Cody9611
Посмотреть сообщение
How can I make a command only available at the ammunation?

I want
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/buylaser", cmdtext, true, 10) == 0)
	{
		ShowMenuForPlayer(waffenmenu,playerid);
		TogglePlayerControllable(playerid,0);
		return 1;
	}
to only be able to be used when inside ammunation...
pawn Код:
//Something like , might work. Just an example :P
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/buylaser", cmdtext, true, 10) == 0)
    {      if(IsPlayerInRangeOfPoint(playerid,range,x,y,z) || GetPlayerInterior(playerid,ammuinteriorid)) //Replace
               {
          ShowMenuForPlayer(waffenmenu,playerid);
          TogglePlayerControllable(playerid,0);

                }
        return 1;
    }
Reply
#3

Testing now thanks

EDIT2 ::
Код:
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : error 001: expected token: ")", but found ";"
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : error 036: empty statement
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
	{		if(IsPlayerInRangeOfPoint(playerid,10,292.5413,-34.4905,1001.5156); || GetPlayerInterior(playerid,1))
Reply
#4

Quote:
Originally Posted by Cody9611
Посмотреть сообщение
Testing now thanks
Did that compile!? It shouldn't, I updated my post . it should work now

sorry my fault
Reply
#5

Quote:
Originally Posted by Cody9611
Посмотреть сообщение
Testing now thanks

EDIT2 ::
Код:
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : error 001: expected token: ")", but found ";"
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : error 036: empty statement
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
	{		if(IsPlayerInRangeOfPoint(playerid,10,292.5413,-34.4905,1001.5156); || GetPlayerInterior(playerid,1))
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,10,292.5413,-34.4905,1001.5156) || GetPlayerInterior(playerid,1))
Reply
#6

Quote:
Originally Posted by Jay.
Посмотреть сообщение
pawn Код:
if(IsPlayerInRangeOfPoint(playerid,10,292.5413,-34.4905,1001.5156) || GetPlayerInterior(playerid,1))
Код:
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(52) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(52) : error 004: function "OnPlayerUpdate" is not implemented
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(672) : warning 225: unreachable code
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(672) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(672) : error 004: function "OnPlayerSelectedMenuRow" is not implemented
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(677) : error 017: undefined symbol "row"
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(784) : warning 225: unreachable code
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(784) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(784) : error 004: function "OnPlayerExitedMenu" is not implemented
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(789) : error 030: compound statement not closed at the end of file (started at line 42)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
:/
Reply
#7

Quote:
Originally Posted by Cody9611
Посмотреть сообщение
Код:
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(43) : warning 202: number of arguments does not match definition
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(52) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(52) : error 004: function "OnPlayerUpdate" is not implemented
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(672) : warning 225: unreachable code
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(672) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(672) : error 004: function "OnPlayerSelectedMenuRow" is not implemented
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(677) : error 017: undefined symbol "row"
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(784) : warning 225: unreachable code
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(784) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(784) : error 004: function "OnPlayerExitedMenu" is not implemented
C:\Documents and Settings\Administrator\Desktop\SARP\filterscripts\Laser.pwn(789) : error 030: compound statement not closed at the end of file (started at line 42)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


8 Errors.
:/
Can you show those lines?
Reply
#8

Quote:
Originally Posted by Jay.
Посмотреть сообщение
Can you show those lines?
52
Код:
public OnPlayerUpdate(playerid)
672
Код:
public OnPlayerSelectedMenuRow(playerid, row)
784
Код:
public OnPlayerExitedMenu(playerid)
789 There is none....
Reply
#9

I think it should be
pawn Код:
if((GetPlayerInterior(playerid) == 1) && IsPlayerInRangeOfPoint(playerid,10,292.5413,-34.4905,1001.5156)) {}
Reply
#10

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
I think it should be
pawn Код:
if((GetPlayerInterior(playerid) == 1) && IsPlayerInRangeOfPoint(playerid,10,292.5413,-34.4905,1001.5156)) {}
Nero , I'm learning pawn still.. And I have a question can you help me out ?

Whats the difference between && and || ?

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)