Use key for cmd
#1

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.
Reply
#2

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
Reply
#3

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Then read this mate: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange

Pls read the page to the end
I read it!
I think all my /engine line should be in press key if...
is it true?
Reply
#4

Код:
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
Reply
#5

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?
Reply
#6

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
Reply
#7

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)