Key 2= /engine and Key LCTRL = /lights -
qUneT - 25.06.2013
Hi
sorry my bad english but i'm romanian
ok,in title is my problem.
i have in OnGameModeInit ManualVehicleEngineAndLights and comands /engine /lights
what I do: When I press LCTRL say the command /lights and you press 2 say the command /engine
commands
CMD:lights(playerid, params[])
{
new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,d oors,bonnet,boot,objective);
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_RED, "[ERROR] - Nu esti in o masina.");
if(GetPlayerVehicleSeat(playerid) != 0)
return SendClientMessage(playerid, COLOR_RED, "[ERROR] - Tu nu conduci.");
if(lights == 1)
{
SetVehicleParamsEx(vehicleid,engine,0,alarm,doors, bonnet,boot,objective);
}
else
{
SetVehicleParamsEx(vehicleid,engine,1,alarm,doors, bonnet,boot,objective);
}
return 1;
}
CMD:engine(playerid, params[])
{
new vehicleid, engine,lights,alarm,doors,bonnet,boot,objective;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,d oors,bonnet,boot,objective);
if(!IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid, COLOR_RED, "[ERROR] - Nu esti in o masina.");
if(GetPlayerVehicleSeat(playerid) != 0)
return SendClientMessage(playerid,COLOR_RED, "[ERROR] - Tu nu conduci.");
if(engine == 1)
{
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors, bonnet,boot,objective);
}
else
{
SetVehicleParamsEx(vehicleid,1,lights,alarm,doors, bonnet,boot,objective);
}
return 1;
}
please Help me
thanks
Re: Key 2= /engine and Key LCTRL = /lights -
SMW - 25.06.2013
use it at OnPlayerKeyChange
pawn Код:
if(IsKeyJustDown(KEY_SUBMISSION, newkeys, oldkeys)) { //start engine
return cmd_engine(playerid," ");
}
if(IsKeyJustDown(KEY_FIRE, newkeys, oldkeys)) {
return cmd_lights(playerid,"");
}
Re: Key 2= /engine and Key LCTRL = /lights -
qUneT - 25.06.2013
C:\DOCUME~1\Edy\Desktop\SERVER~4\GAMEMO~1\rpg.pwn( 361) : error 017: undefined symbol "IsKeyJustDown"
C:\DOCUME~1\Edy\Desktop\SERVER~4\GAMEMO~1\rpg.pwn( 365) : error 017: undefined symbol "IsKeyJustDown"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
((
Re: Key 2= /engine and Key LCTRL = /lights -
SMW - 25.06.2013
pawn Код:
stock IsKeyJustDown(key, newkeys, oldkeys)
{
if((newkeys & key) && !(oldkeys & key))
return 1;
return 0;
}
i forgot this..
Re: Key 2= /engine and Key LCTRL = /lights -
qUneT - 25.06.2013
Quote:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsKeyJustDown(KEY_SUBMISSION, newkeys, oldkeys)) { //start engine
return cmd_engine(playerid,"/engine");
}
if(IsKeyJustDown(KEY_FIRE, newkeys, oldkeys)) {
return cmd_lights(playerid,"/lights");
}
return 1;
}
|
You can do this for me please I did not understand
Re: Key 2= /engine and Key LCTRL = /lights -
SMW - 25.06.2013
thats all i do for you, can't you just copy and paste ?
learn some scripting basic dude ..
Re: Key 2= /engine and Key LCTRL = /lights -
qUneT - 25.06.2013
stock IsKeyJustDown(key, newkeys, oldkeys)
{
if((newkeys & KEY_SUBMISSION) && !(oldkeys & key))
{
return cmd_engine(playerid,"/engine");
}
if((newkeys & KEY_FIRE) && !(oldkeys & key))
{
return cmd_lights(playerid,"/lights");
}
return 1;
return 0;
}
Dont work
Re: Key 2= /engine and Key LCTRL = /lights -
SMW - 25.06.2013
PUT THIS AT OnPlayerKeyChange
pawn Код:
if(IsKeyJustDown(KEY_SUBMISSION, newkeys, oldkeys)) { //start engine
return cmd_engine(playerid," ");
}
if(IsKeyJustDown(KEY_FIRE, newkeys, oldkeys)) {
return cmd_lights(playerid,"");
}
AND PUT THIS ABOVE OnPlayerStateChange (actually you can put this anywhere)
pawn Код:
stock IsKeyJustDown(key, newkeys, oldkeys)
{
if((newkeys & key) && !(oldkeys & key))
return 1;
return 0;
}
Seriously dude its very very very basic, you should learn first before you start script ..
Re: Key 2= /engine and Key LCTRL = /lights -
qUneT - 25.06.2013
It works
but lights is on RCTRL no LCTRL
Re: Key 2= /engine and Key LCTRL = /lights -
DobbysGamertag - 25.06.2013
Why use an extra stock when you can do that with basic funtions?
pawn Код:
if(PRESSED(KEY_NAME))
{
//stuff
}