How can I change that key ? -
yaron0600 - 05.05.2013
How can I make also u can type in the command : /engine and only type on "2"
Код:
CMD:engine(playerid, params[])
{
new string[128];
new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleEngine(vehicleid, playerid);
}
else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
{
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
format(string, sizeof(string), "%s is attempting to turn the car on.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid);
return 1;
}
}
Re: How can I change that key ? -
SimpalK - 05.05.2013
Use :-
pawn Код:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_ANALOG_DOWN))
{
new string[128];
new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle.");
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON)
{
SetVehicleEngine(vehicleid, playerid);
}
else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET))
{
SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait...");
format(string, sizeof(string), "%s is attempting to turn the car on.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid);
return 1;
}
}
return 1;
}
Re: How can I change that key ? -
RajatPawar - 05.05.2013
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_SUBMISSION))
{
return cmd_engine(playerid);
}
return 1;
}
Re: How can I change that key ? -
yaron0600 - 05.05.2013
Quote:
Originally Posted by Rajat_Pawar
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (newkeys & KEY_SUBMISSION)) { return cmd_engine(playerid, params); } return 1; }
|
Wheres the 2? here ? Lol
Re: How can I change that key ? -
SimpalK - 05.05.2013
Quote:
Originally Posted by yaron0600
Wheres the 2? here ? Lol
|
Tried My Function?
Re: How can I change that key ? -
RajatPawar - 05.05.2013
Quote:
Originally Posted by yaron0600
Wheres the 2? here ? Lol
|
2 is the KEY_SUBMISSION key. (also the same as MMB)
Re: How can I change that key ? -
yaron0600 - 05.05.2013
Quote:
Originally Posted by SimpalK
Use :-
pawn Код:
#define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (PRESSED(KEY_ANALOG_DOWN)) { new string[128]; new engine,lights,alarm,doors,bonnet,boot,objective,vehicleid; vehicleid = GetPlayerVehicleID(playerid); if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510) return SendClientMessageEx(playerid,COLOR_WHITE,"This command can't be used in this vehicle."); GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective); if(engine == VEHICLE_PARAMS_ON) { SetVehicleEngine(vehicleid, playerid); } else if((engine == VEHICLE_PARAMS_OFF || engine == VEHICLE_PARAMS_UNSET)) { SendClientMessageEx(playerid, COLOR_WHITE, "Vehicle engine starting, please wait..."); format(string, sizeof(string), "%s is attempting to turn the car on.", GetPlayerNameEx(playerid)); ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetTimerEx("SetVehicleEngine", 1000, 0, "dd", vehicleid, playerid); return 1; } } return 1; }
|
But where the also cmd : /engine and where here the "2" ? ? ?
Re: How can I change that key ? -
RajatPawar - 05.05.2013
Quote:
Originally Posted by ******
No it isn't. The KEY_SUBMISSION key is whatever key the player has mapped to that function. There is NO WAY to specify exact keys.
|
Obviously, I meant that. Sure, no one can predict what the control keys layout of the player is going to be.
Re: How can I change that key ? -
RevolutionaryGaming - 05.05.2013
Quote:
Originally Posted by ******
Then say that instead of spreading mis-information.
|
While I agree with the majority of the posts you make, I think you're pressing the issue way too far. The default KEY_SUBMISSION is 2. When someone asks for code which will do some action when number 2 is pressed, it is by no means an unfair assumption that the player will be using the default layout which the majority of players use. By making this assumption, Rajat was in no way spreading misinformation.
If someone needs some form of specialized help (such as having an odd layout), they should mention the circumstances surrounding the issue (such as my number 2 key is actually mapped to ______). Every time someone gets helped on these forums, assumptions are made about the player, their script, and what they are attempting to achieve because topics have become more and more vague.
Besides, when Rajat explained that the number 2 key was KEY_SUBMISSION, if the OP lacks the necessary cognitive abilities to deduce that his
uber l337 southpaw legacy controller layout may use a different key for the action KEY_SUBMISSION, he probably wouldn't have been able to register for the forums in the first place.
Re: How can I change that key ? -
RajatPawar - 05.05.2013
Quote:
Originally Posted by RevolutionaryGaming
I think you're pressing the issue way too far.
|
******, I replied casually, that's it. End of topic.