Use key for cmd -
mamalzeus - 19.03.2015
Hi!
How to use key for cmd?
//------------------------------------------
if(!strcmp(cmd, "/engine", true))
{
if(EngineSTATE[vid] == 0)
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,al arm,doors,bonnet,boot,objective);
EngineSTATE[vid] = 1;
SCM("you starts the engine of vehicle.");
}
else
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,a larm,doors,bonnet,boot,objective);
EngineSTATE[vid] = 0;
SCM("you stop the engine of vehicle.");
}
return 1;
}
//------------------------------------
How can it write
if (PRESSED( MyKey ))
read /engine ?
i read some tutorials and post but they didn't work.
Sorry For Bad ENG.
AW: Use key for cmd -
Kaliber - 19.03.2015
Quote:
Originally Posted by mamalzeus
i read some tutorials and post but they didn't work.
|
Then read this mate:
https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Pls read the page to the end
Re: AW: Use key for cmd -
mamalzeus - 19.03.2015
Quote:
Originally Posted by Kaliber
|
I read it!
I think all my /engine line should be in press key if...
is it true?
Re: Use key for cmd -
Karan007 - 19.03.2015
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_LOOK_BEHIND) && !(oldkeys & KEY_LOOK_BEHIND))
if(EngineSTATE[vid] == 0)
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,al arm,doors,bonnet,boot,objective);
EngineSTATE[vid] = 1;
SendClientMessage(playerid, -1, "You have started the engine!");
}
else
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,a larm,doors,bonnet,boot,objective);
EngineSTATE[vid] = 0;
SendClientMessage(playerid, -1, "You have stopped the vehicle!");
return 1;
}
Try this
Re: Use key for cmd -
mamalzeus - 19.03.2015
Quote:
Originally Posted by karan007
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if ((newkeys & KEY_LOOK_BEHIND) && !(oldkeys & KEY_LOOK_BEHIND))
if(EngineSTATE[vid] == 0)
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,al arm,doors,bonnet,boot,objective);
EngineSTATE[vid] = 1;
SendClientMessage(playerid, -1, "You have started the engine!");
}
else
{
GetVehicleParamsEx(vid,engine,lights,alarm,doors,b onnet,boot,objective);
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,a larm,doors,bonnet,boot,objective);
EngineSTATE[vid] = 0;
SendClientMessage(playerid, -1, "You have stopped the vehicle!");
return 1;
}
Try this 
|
My /engine CMD is 119 line

Do you have any ideal?
AW: Re: AW: Use key for cmd -
Kaliber - 19.03.2015
Quote:
Originally Posted by mamalzeus
is it true?
|
You can do simply sth like this:
Код:
if(newkeys & KEY_NO) OnPlayerCommandText(playerid,"/engine");
So if you press N ... your engine start / stop
Re: AW: Re: AW: Use key for cmd -
mamalzeus - 19.03.2015
Quote:
Originally Posted by Kaliber
You can do simply sth like this:
Код:
if(newkeys & KEY_NO) OnPlayerCommandText(playerid,"/engine");
So if you press N ... your engine start / stop 
|
You are the Best.
kiss You can change the world