onplayerkeystatechange "PRESSED" unexpected token
#1

PHP код:
// PRESSED(keys)
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0))*!= (%0))
if (
PRESSEDnewkeysKEY_JUMP )) // error line
    
{
        if(
DB[playerid][SuperJumpLevel] == 1)
        {
            
GetPlayerVelocity(playeridF[0], F[1], F[2]);
            
SetPlayerVelocity(playeridF[0]*1.3F[1]*2F[2]+0.1);
            
Message(playeridTYPE_SERVER"Jump recognized.");
        }
    } 
PHP код:
error 001expected token")"but found "*"
error 029invalid expressionassumed zero 
Reply
#2

PHP код:
if(PRESSED(KEY_JUMP)) 
Reply
#3

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
if(PRESSED(KEY_JUMP)) 
PHP код:
error 001expected token")"but found "*"
error 029invalid expressionassumed zero
error 029
invalid expressionassumed zero
fatal error 107
too many error messages on one line 
Reply
#4

PHP код:
replace
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0))*!= (%0)) 
to
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)) 
Reply
#5

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
replace
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0))*!= (%0)) 
to
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)) 
Код:
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
There was still a bracket missing. Uneven count is a good indicator for that.
Reply
#6

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
replace
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0))*!= (%0)) 
to
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)) 

Quote:
Originally Posted by NaS
Посмотреть сообщение
Код:
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
There was still a bracket missing. Uneven count is a good indicator for that.
PHP код:
error 029invalid expressionassumed zero 
Reply
#7

Quote:
Originally Posted by Lirbo
Посмотреть сообщение
PHP код:
error 029invalid expressionassumed zero 
Did you use

Код:
if(PRESSED(KEY_JUMP))
like AbyssMorgan already suggested,

or the old code?

The macro just accepts one argument (the key), not two.
Reply
#8

Quote:
Originally Posted by NaS
Посмотреть сообщение
Did you use

Код:
if(PRESSED(KEY_JUMP))
like AbyssMorgan already suggested,

or the old code?

The macro just accepts one argument (the key), not two.
if(PRESSED(KEY_JUMP))*

okay seems like the "*" just appeared once I pasted it here it appeared to be a blank space over pawn, it solved the issue, it was an invisible character....

edit: seems like it does not detect in game the jump, it does not send the message and does not increase the velocity
Reply
#9

This should work.

Note: I just reworked your "Message" function so I could see if it would spit any errors when compiling. Simply replace this with your message function or test it with it, I don't care. :P

Код:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) {

	if ( newkeys & KEY_JUMP ) {

		if ( DB[playerid][SuperJumpLevel] == 1 ) {

			GetPlayerVelocity( playerid, F[0], F[1], F[2] );
			SetPlayerVelocity( playerid, F[0] * 1.3, F[1] * 2, F[2] + 0.1 );
			SendClientMessage( playerid, -1, "Super Jump Established." );

		}

	}

	return 1;

}
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

[Finished in 0.1s]
Reply
#10

Quote:
Originally Posted by Daymen
Посмотреть сообщение
This should work.

Note: I just reworked your "Message" function so I could see if it would spit any errors when compiling. Simply replace this with your message function or test it with it, I don't care. :P

Код:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys ) {

	if ( newkeys & KEY_JUMP ) {

		if ( DB[playerid][SuperJumpLevel] == 1 ) {

			GetPlayerVelocity( playerid, F[0], F[1], F[2] );
			SetPlayerVelocity( playerid, F[0] * 1.3, F[1] * 2, F[2] + 0.1 );
			SendClientMessage( playerid, -1, "Super Jump Established." );

		}

	}

	return 1;

}
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

[Finished in 0.1s]
no errors but it does not recognize when I jump in the game. no idea why.
I have SuperJump on my account so it's not the problem, also made sure and took the message out of the superjump dependence, still nothing.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)