Two annoying errors!!
#1

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pMember] == 10)
{
  if (PRESSED(newkeys == (KEY_HORN)
  {
    if(PlayerToPoint(20.0, playerid, 1811.3328,-1890.3472,13.4070))
    {
    new sendername[24],string[128];
    MoveObject(taxigate,1810.8123779297, -1890.3559570313, 10.59866809845, 1.5);
    GetPlayerName(playerid,sendername, sizeof(sendername));
    format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  }
}
  else if (newkeys == PRESSED(KEY_HORN)
  {
    if(PlayerToPoint(20.0, playerid, 1811.3328,-1890.3472,13.4070))
    {
    new sendername[24],string[128];
    MoveObject(taxigate,1810.927734375, -1890.3482666016, 14.12285900116, 1.5);
    GetPlayerName(playerid,sendername, sizeof(sendername));
    format(string, sizeof(string), "* %s takes his/her remote and closes the gate.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
	}
  return 1;
  }
The Errors :

Код:
C:\Documents and Settings\User\щемзп дтбегд\ощзчйн\LARP New\gamemodes\EmiMod.pwn(43680) : error 017: undefined symbol "PRESSED"
C:\Documents and Settings\User\щемзп дтбегд\ощзчйн\LARP New\gamemodes\EmiMod.pwn(43692) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
That might fix one of them, and you didnt give us the line number of the number 2 warning.
Reply
#3

Try this:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pMember] == 10)
    {
      if (PRESSED(KEY_HORN)
      {
        if(PlayerToPoint(20.0, playerid, 1811.3328,-1890.3472,13.4070))
        {
            new sendername[24],string[128];
            MoveObject(taxigate,1810.8123779297, -1890.3559570313, 10.59866809845, 1.5);
            GetPlayerName(playerid,sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        }
    }
  return 1;
 }
Reply
#4

Quote:
Originally Posted by Johndaone
pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
That might fix one of them, and you didnt give us the line number of the number 2 warning.
yes he did, its this line: else if (newkeys == PRESSED(KEY_HORN)

i guess it should be else if(PRESSED(KEYHORN)
Reply
#5

I already posted fixed code jamesbond007
Reply
#6

Quote:
Originally Posted by TheInnocentOne
Try this:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pMember] == 10)
    {
      if (PRESSED(KEY_HORN)
      {
        if(PlayerToPoint(20.0, playerid, 1811.3328,-1890.3472,13.4070))
        {
            new sendername[24],string[128];
            MoveObject(taxigate,1810.8123779297, -1890.3559570313, 10.59866809845, 1.5);
            GetPlayerName(playerid,sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
        }
    }
  return 1;
 }
Man its no good
Reply
#7

Your script looks like a gate open and close code.
So, here's how you can do it:

Put this at the top:
Код:
new bool: gateopen;
Then under OnGameModeInit()
Код:
gateopen=false;
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new sendername[24];
	GetPlayerName(playerid,sendername, sizeof(sendername));
	if(PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pMember] == 10)
	{
		if ((newkeys & KEY_HORN) && !(oldkeys & KEY_HORN))
		{
			if(PlayerToPoint(20.0, playerid, 1811.3328,-1890.3472,13.4070))
			{
				if(gateopen==false)
				{
					new string[128];
					MoveObject(taxigate,1810.8123779297, -1890.3559570313, 10.59866809845, 1.5);
					format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					gateopen=true;
				}
				if(gateopen==true)
				{
					new string[128];
					MoveObject(taxigate,1810.927734375, -1890.3482666016, 14.12285900116, 1.5);
					format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					gateopen=false;
				}					
			}
		}
		
	}
	return 1;
}
Reply
#8

Quote:
Originally Posted by DJDhan
Your script looks like a gate open and close code.
So, here's how you can do it:

Put this at the top:
Код:
new bool: gateopen;
Then under OnGameModeInit()
Код:
gateopen=false;
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	new sendername[24];
	GetPlayerName(playerid,sendername, sizeof(sendername));
	if(PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pMember] == 10)
	{
		if ((newkeys & KEY_HORN) && !(oldkeys & KEY_HORN))
		{
			if(PlayerToPoint(20.0, playerid, 1811.3328,-1890.3472,13.4070))
			{
				if(gateopen==false)
				{
					new string[128];
					MoveObject(taxigate,1810.8123779297, -1890.3559570313, 10.59866809845, 1.5);
					format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					gateopen=true;
				}
				if(gateopen==true)
				{
					new string[128];
					MoveObject(taxigate,1810.927734375, -1890.3482666016, 14.12285900116, 1.5);
					format(string, sizeof(string), "* %s takes his/her remote and opens the gate.", sendername);
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					gateopen=false;
				}					
			}
		}
		
	}
	return 1;
}
its no good man
Reply
#9

Dude, instead os saying no good to all the codes given, you can tell what's wrong What is the problem with my code?
Reply
#10

http://up203.siz.co.il/up3/vzkmzwmn3i2e.bmp

Look what the problem.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)