Error at "pressed"
#1

I defined "pressed", but it isn't ok. Can somebody help me with this?

Quote:

D:\server\altele\CGRP\4legends.pwn(29119) : warning 206: redundant test: constant expression is non-zero
D:\server\altele\CGRP\4legends.pwn(60673) : error 017: undefined symbol "PRESSED"
D:\server\altele\CGRP\4legends.pwn(60704) : error 017: undefined symbol "PRESSED"
D:\server\altele\CGRP\4legends.pwn(66903) : error 017: undefined symbol "PRESSED"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

Код:
#define PRESSED(%0) \
	(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
	
	if(strcmp(cmd, "/engine", true) == 0 || strcmp(PRESSED, "PED_DUCK",true) == 0)
	{
        new vid = GetPlayerVehicleID(playerid);
        GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
		if(vid != INVALID_VEHICLE_ID)
		if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GRAD2, "You must be in a vehicle before you can do this!");
		if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_GRAD2, "Only the driver can do this!");
		if(engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)
		{
            SendClientMessage(playerid, -1, ""#COL_WHITE"> You have "#COL_GREEN" started"#COL_WHITE" the engine");
            GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "* %s takes out the keys - inserts it into the ignition and twists it.", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
        }
        else if(engine == VEHICLE_PARAMS_ON)
		{
            SendClientMessage(playerid, -1, ""#COL_WHITE"> You have "#COL_RED"stopped"#COL_WHITE" the engine");
            GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "* %s extends his hand towards the ignition, twisting the keys.", sendername);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
        }
		return 1;
    }
Reply
#2

Put the macro to the top of your script.
Reply
#3

Quote:
Originally Posted by Andrew81003
Посмотреть сообщение
Код:
strcmp(PRESSED, "PED_DUCK",true)
That's not how it works. At all. The macro can only be used inside OnPlayerKeyStateChange.
Reply
#4

I don't understand very well.. can you give me an exemple?
Reply
#5

https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (PRESSED(KEY_JUMP))
    {
        SendClientMessage(playerid, -1, "You pressed jump");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)