Well i have been haveing this, but for some reason non of these keys working at all. Please help
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new playername[MAX_PLAYER_NAME];
new Float:tmparmour, Float:tmphealth;
GetPlayerName(playerid, playername, sizeof(playername));
GetPlayerArmour(playerid, tmparmour);
GetPlayerHealth(playerid, tmphealth);
if (PRESSED(KEY_SECONDARY_ATTACK))
{
if(GetPlayerState(playerid) == 1) // On-Foot
{
if(actionTime[playerid] == 0)
{
actionTime[playerid] = 2;
if (IsALawEnforcer(playerid))
{
if (IsAtGearPoint(playerid) > 0)
{
ShowGearMenu(playerid);
actionTime[playerid] = 5;
}
}
RequestNPCTalk(playerid,2.5);
for(new i = 0; i < sizeof(DIntInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid,3.0,DIntInfo[i][doorEntranceX], DIntInfo[i][doorEntranceY], DIntInfo[i][doorEntranceZ]))
{
if(PlayerInfo[playerid][pPropertykey] == i || DIntInfo[i][doorLocked] == 0)
{
HidePlayerDialog(playerid);
PlayerPlaySound(playerid, 1095, 0.0, 0.0, 0.0);
SetPlayerInterior(playerid,DIntInfo[i][doorInterior]);
SetPlayerPos(playerid,DIntInfo[i][doorExitX],DIntInfo[i][doorExitY],DIntInfo[i][doorExitZ]);
SetPlayerFacingAngle(playerid, DIntInfo[i][doorEntAngle]);
PlayerInfo[playerid][pInt] = DIntInfo[i][doorInterior];
SetPlayerVirtualWorld(playerid, DIntInfo[i][doorVirtual]);
PlayerInfo[playerid][pLocal] = i;
actionTime[playerid] = 2;
}
else
{
GameTextForPlayer(playerid, "~r~Door Locked", 5000, 1);
}
}
}
for(new i = 0; i < sizeof(DIntInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid,3.0,DIntInfo[i][doorExitX], DIntInfo[i][doorExitY], DIntInfo[i][doorExitZ]) && PlayerInfo[playerid][pLocal] == i)
{
HidePlayerDialog(playerid);
PlayerPlaySound(playerid, 1095, 0.0, 0.0, 0.0);
new x = PlayerInfo[playerid][pLocal];
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,DIntInfo[x][doorEntranceX],DIntInfo[x][doorEntranceY],DIntInfo[x][doorEntranceZ]);
SetPlayerFacingAngle(playerid, DIntInfo[x][doorExitAngle]);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pLocal] = 9999;
actionTime[playerid] = 2;
}
}
for(new i = 0; i < sizeof(HIntInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid,3.0,HIntInfo[i][doorEntranceX], HIntInfo[i][doorEntranceY], HIntInfo[i][doorEntranceZ]))
{
if(PlayerInfo[playerid][pPhousekey] == i || HIntInfo[i][doorLocked] == 0)
{
HidePlayerDialog(playerid);
PlayerPlaySound(playerid, 1095, 0.0, 0.0, 0.0);
SetPlayerInterior(playerid,HIntInfo[i][doorInterior]);
SetPlayerPos(playerid,HIntInfo[i][doorExitX],HIntInfo[i][doorExitY],HIntInfo[i][doorExitZ]);
SetPlayerFacingAngle(playerid, HIntInfo[i][doorEntAngle]);
PlayerInfo[playerid][pInt] = HIntInfo[i][doorInterior];
SetPlayerVirtualWorld(playerid, i);
PlayerInfo[playerid][pHLocal] = i;
actionTime[playerid] = 2;
}
else
{
GameTextForPlayer(playerid, "~r~Door Locked", 5000, 1);
}
}
}
for(new i = 0; i < sizeof(HIntInfo); i++)
{
if (IsPlayerInRangeOfPoint(playerid,3.0,HIntInfo[i][doorExitX], HIntInfo[i][doorExitY], HIntInfo[i][doorExitZ]) && PlayerInfo[playerid][pHLocal] == i)
{
HidePlayerDialog(playerid);
PlayerPlaySound(playerid, 1095, 0.0, 0.0, 0.0);
new x = PlayerInfo[playerid][pHLocal];
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,HIntInfo[x][doorEntranceX],HIntInfo[x][doorEntranceY],HIntInfo[x][doorEntranceZ]);
SetPlayerFacingAngle(playerid, HIntInfo[x][doorExitAngle]);
PlayerInfo[playerid][pInt] = 0;
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pHLocal] = 9999;
actionTime[playerid] = 2;
}
}
specialItem[playerid] = 0;
}
}
}
if (PRESSED(4)) // Punch/Fire
{
if(GetPlayerState(playerid) == 1) // On-Foot
{
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_WINE)
{
if(tmparmour <= 50)
{
if(PlayerInfo[playerid][pDrunkNess] < 50*2000)
{
SetPlayerWalkingStyle(playerid, 12);
SetPlayerArmour(playerid, tmparmour + 1.0);
if(specialItem[playerid] == 4)
{
SetPlayerArmour(playerid, tmparmour + 2.0);
}
if(specialItem[playerid] == 5)
{
SetPlayerArmour(playerid, tmparmour + 3.0);
}
PlayerInfo[playerid][pDrunkNess] += 1000;
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 1000);
}
}
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_BEER)
{
if(tmparmour <= 50)
{
if(PlayerInfo[playerid][pDrunkNess] < 50*2000)
{
SetPlayerWalkingStyle(playerid, 12);
if(specialItem[playerid] == 3)
{
SetPlayerArmour(playerid, tmparmour + 1.0);
}
PlayerInfo[playerid][pDrunkNess] += 1000;
SetPlayerDrunkLevel(playerid, GetPlayerDrunkLevel(playerid) + 1000);
}
}
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_SPRUNK)
{
if(tmphealth < 100)
{
SetPlayerHealth(playerid, tmphealth + 1.0);
}
}
}
}
if (PRESSED(512)) // Auto Vehicle Menu
{
if(PlayerInfo[playerid][pCarKeys] == 9999) return 1;
if(GetPlayerState(playerid) == 2)
{
new currentveh = GetPlayerVehicleID(playerid);
if(PlayerInfo[playerid][pCarKeys] == currentveh)
{
ShowVehicleMainMenu(playerid);
}
else
{
SendClientMessage(playerid,COLOR_GREY, "You have to be in your vehicle to access the vehicle menu!");
}
}
}
if (PRESSED(KEY_CROUCH)) // Auto Gate Toggle
{
if(GetPlayerState(playerid) == 2 || GetPlayerState(playerid) == 3)
{
if (IsPlayerInRangeOfPoint(playerid,10.0,1534.885986, -1451.428589, 16.386175))
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pDonateRank] > 0 || PlayerInfo[playerid][pAdmin] > 2 || IsPlayerAdmin(playerid))
{
MoveDynamicObject (Premgate, 1534.885985, -1451.428588, 21.268284,0.992236);
SetTimer("Premgates2",10000,false);
}
}
}
if(IsALawEnforcer(playerid) || PlayerInfo[playerid][pAdmin] > 2 || IsPlayerAdmin(playerid))
{
if(IsPlayerInRangeOfPoint(playerid,10.0,-1530.018066,481.974792,9.187500))
{
MoveDynamicObject (nggate,-1530.247559, 482.595734,1.187500,0.992236);
SetTimer("nggates2",13000,false);
}
else if(IsPlayerInRangeOfPoint(playerid,10.0,1588.604125,-1638.543823,15.417510))
{
MoveDynamicObject (pdgate,1589.320557, -1638.084351,19.417510,0.992236);
SetTimer("pdgates2",8000,false);
}
else if(IsPlayerInRangeOfPoint(playerid,10.0,-1632.020141,688.373657,7.187500))
{
MoveDynamicObject (fbigate2,-1620.016602, 688.362183, 14.186716,0.992236);
MoveDynamicObject (fbigate,-1633.339966, 688.362183, 14.186716,0.992236);
SetTimer("fbigates2",8000,false);
}
}
RequestNPCTalk(playerid,10.0);
}
}
if(cbug == 0)
{
if(newkeys & KEY_FIRE && oldkeys & KEY_CROUCH && BuggedWeapons(playerid) && GetPlayerState(playerid) != 2)
{
if(CBugPool[playerid] >= 10 )
{
format(cockreason, 256, "Unauthorized C-Bug Exploiting",playerid);
cockkick(playerid, cockreason);
CockCBug++;
SaveStuff();
}
CBugPool[playerid] += 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SetPlayerHealth(playerid, tmphealth - 25.0);
//ApplyAnimation(playerid,"COLT45", "colt45_reload",4.0,0,1,1,0,0);
SetPlayerArmedWeapon(playerid,0);
}
if(newkeys & KEY_CROUCH && oldkeys & KEY_FIRE && BuggedWeapons(playerid) && GetPlayerState(playerid) != 2)
{
if(CBugPool[playerid] >= 10 )
{
format(cockreason, 256, "Unauthorized C-Bug Exploiting",playerid);
cockkick(playerid, cockreason);
CockCBug++;
SaveStuff();
}
CBugPool[playerid] += 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SetPlayerHealth(playerid, tmphealth - 25.0);
//ApplyAnimation(playerid,"COLT45", "colt45_reload",4.0,0,1,1,0,0);
SetPlayerArmedWeapon(playerid,0);
}
if(newkeys & KEY_CROUCH && oldkeys & KEY_FIRE && BuggedWeapons(playerid) && GetPlayerState(playerid) != 2)
{
if(CBugPool[playerid] >= 10 )
{
format(cockreason, 256, "Unauthorized C-Bug Exploiting",playerid);
cockkick(playerid, cockreason);
CockCBug++;
SaveStuff();
}
CBugPool[playerid] += 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SetPlayerHealth(playerid, tmphealth - 25.0);
//ApplyAnimation(playerid,"COLT45", "colt45_reload",4.0,0,1,1,0,0);
SetPlayerArmedWeapon(playerid,0);
}
if(newkeys & KEY_CROUCH && oldkeys & KEY_JUMP && BuggedWeapons(playerid) && GetPlayerState(playerid) != 2)
{
if(CBugPool[playerid] >= 10 )
{
format(cockreason, 256, "Unauthorized C-Bug Exploiting",playerid);
cockkick(playerid, cockreason);
CockCBug++;
SaveStuff();
}
CBugPool[playerid] += 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SetPlayerHealth(playerid, tmphealth - 10.0);
//ApplyAnimation(playerid,"COLT45", "colt45_reload",4.0,0,1,1,0,0);
SetPlayerArmedWeapon(playerid,0);
}
if(newkeys & KEY_JUMP && oldkeys & KEY_CROUCH && BuggedWeapons(playerid) && GetPlayerState(playerid) != 2)
{
if(CBugPool[playerid] >= 10 )
{
format(cockreason, 256, "Unauthorized C-Bug Exploiting.",playerid);
cockkick(playerid, cockreason);
CockCBug++;
SaveStuff();
}
CBugPool[playerid] += 1;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SetPlayerHealth(playerid, tmphealth - 25.0);
//ApplyAnimation(playerid,"COLT45", "colt45_reload",4.0,0,1,1,0,0);
SetPlayerArmedWeapon(playerid,0);
}
}
if(!gPlayerUsingLoopingAnim[playerid]) return 0;
if(IsKeyJustDown(KEY_HANDBRAKE,newkeys,oldkeys))
{
StopLoopingAnim(playerid);
TextDrawHideForPlayer(playerid,txtAnimHelper);
animation[playerid] = 0;
}
return 1;
}
Hmm..