Binding something to public OnPlayerKeyStateChange (ERROR)
#1

How can i bind this code
Quote:

if (IsKeyJustDown(KEY_FIRE, newkeys, oldkeys))
{
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pMember] == 8 && PlayerInfo[playerid][pLeader] ==
{
if(PlayerInfo[playerid][pC4Used] == 0)
{
CreateExplosion(bx, by, bz, 7, 4);
PickUpC4(playerid);
PlayerInfo[playerid][pC4Used] = 1;
}
}


To here
Quote:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
new pveh = GetVehicleModel(GetPlayerVehicleID(playerid));
new newcar = GetPlayerVehicleID(playerid);
if(newkeys == KEY_JUMP)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(IsPlayerConnected(playerid))
{
if(!engineOn[GetPlayerVehicleID(playerid)])
{
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
return 1;
}
if(IsAnOwnableCar(newcar))
{
if(PlayerInfo[playerid][pPcarkey] == newcar) { }
else if(PlayerInfo[playerid][pPcarkey2] == newcar) { }
else if(PlayerInfo[playerid][pPcarkey3] == newcar) { }
else { return 1; }
}
if(pveh == 510 || pveh == 462 || pveh == 481 || pveh == 509)
{
return 1;
}
if(newcar == 59 || newcar == 60)
{
return 1;
}
if(newcar >= 135 && newcar <= 154)
{
if(HireCar[playerid] != newcar)
{
return 1;
}
}
if(IsAHarvest(newcar))
{
return 1;
}
if(IsADrugHarvest(newcar))
{
return 1;
}
if(IsAPlane(newcar))
{
return 1;
}
if(IsASweeper(newcar))
{
return 1;
}
if(gEngine[playerid] == 1) { return 1; }

PutPlayerInVehicle(playerid, newcar, 0);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "* %s attempts to start the vehicle engine.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPL E,COLOR_PURPLE);
SetTimerEx("StartingTheVehicle",2000,0,"i",playeri d);
GameTextForPlayer(playerid, "~g~Starting vehicle engine...",3500,5);
gEngine[playerid] = 1;
return 1;
}
}
}
}
else if(newkeys == KEY_SECONDARY_ATTACK)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(gEngine[playerid] == 0 && engineOn[newcar] == 0)
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
return 1;
}
else if(NoFuel[playerid] == 1)
{
TogglePlayerControllable(playerid, 1);
RemovePlayerFromVehicle(playerid);
NoFuel[playerid] = 0;
return 1;
}
}
}
return 1;
}

Reply
#2

none has an idea ?
Reply
#3

if(newkeys == KEY_FIRE) or if(newkeys & KEY_FIRE) ?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)