16.01.2015, 15:33
So when i try to use taser, sprunk or enter house with "F" it doesnt work.
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(IsPlayerNPC(playerid)) return 1;
// Enter System
if ((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
{
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
SendToEnter(playerid);
SendToExit(playerid);
}
}
if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(gPlayerUsingLoopingAnim[playerid] && (newkeys & KEY_SPRINT) && !(oldkeys & KEY_SPRINT))
{
StopLoopingAnim(playerid);
TextDrawHideForPlayer(playerid,txtAnimHelper);
return 1;
}
}
// Galaxy S3
if(newkeys & KEY_YES)
{
if(GetPVarInt(playerid,"cameramode") == 1)
{
for(new i = 0; i < 32; i++) TextDrawHideForPlayer(playerid,Galaxy3Camera[i]);
GalaxyS3Phone(playerid,1);
for(new i = 0; i < 11; i++) TextDrawShowForPlayer(playerid,Galaxy3StartMenu[i]);
PlayerTextDrawShow(playerid,Galaxy3StartMenu2);
for(new i = 0; i < 13; i++) TextDrawShowForPlayer(playerid,Galaxy3SMainMenu[i]);
SelectTextDraw(playerid,0x33AA33AA);
DeletePVar(playerid,"cameramode");
SetCameraBehindPlayer(playerid);
DestroyObject(firstpersona[playerid]);
}
}
// For Extinguishing Fire
if(PRESSED(newkeys & KEY_FIRE) && IsNearFire(playerid) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && HasExtinguisher(playerid))
{
new Float:pox, Float:poy, Float:poz;
GetPlayerPos(playerid, pox, poy, poz);
new fiire = GetFireID(pox, poy, poz, 10.0);
if(IsPlayerAimingAt(playerid, Fire[fiire][Fire_X], Fire[fiire][Fire_Y], Fire[fiire][Fire_Z], 10))
{
new putouttype = 1;
ExtinguishFire[fiire] = SetTimerEx("PutOutFire",1000, true, "ii", fiire, putouttype);
}
}
if(RELEASED(newkeys & KEY_FIRE) && IsNearFire(playerid) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && HasExtinguisher(playerid))
{
new Float:pox, Float:poy, Float:poz;
GetPlayerPos(playerid, pox, poy, poz);
new fiire = GetFireID(pox, poy, poz, 10.0);
KillTimer(ExtinguishFire[fiire]);
}
if(PRESSED(newkeys & KEY_FIRE) && IsNearFire(playerid) && IsInWaterCar(playerid))
{
new Float:pox, Float:poy, Float:poz;
GetPlayerPos(playerid, pox, poy, poz);
new fiire = GetFireID(pox, poy, poz, 10.0);
if(IsPlayerAimingAt(playerid, Fire[fiire][Fire_X], Fire[fiire][Fire_Y], Fire[fiire][Fire_Z], 10))
{
new putouttype = 2;
ExtinguishFire[fiire] = SetTimerEx("PutOutFire",1000, true, "ii", fiire, putouttype);
}
}
if(RELEASED(newkeys & KEY_FIRE) && IsNearFire(playerid) && IsInWaterCar(playerid))
{
new Float:pox, Float:poy, Float:poz;
GetPlayerPos(playerid, pox, poy, poz);
new fiire = GetFireID(pox, poy, poz, 10.0);
KillTimer(ExtinguishFire[fiire]);
}
if(newkeys & KEY_YES)
{
if(GetPlayerTargetPlayer(playerid) != INVALID_PLAYER_ID && ProxDetectorS(5.0, playerid, GetPlayerTargetPlayer(playerid)) && !IsPlayerNPC(GetPlayerTargetPlayer(playerid)))
{
new string[64];
new name[MAX_PLAYER_NAME+8];
format(name, sizeof(name), "{33CCFF}%s", GetPlayerNameEx(GetPlayerTargetPlayer(playerid)));
SetPVarString(playerid, "pInteractName", name);
SetPVarInt(playerid, "pInteractID", GetPlayerTargetPlayer(playerid));
format(string, sizeof(string), "Pay\nGive\n");
if(PlayerInfo[playerid][pJob] == 4 || PlayerInfo[playerid][pJob2] == 4)
{
format(string, sizeof(string), "%sSell\n", string);
}
if(IsACop(playerid) || IsALVPDCop(playerid))
{
format(string, sizeof(string), "%sFrisk\n", string);
}
ShowPlayerDialog(playerid, INTERACTMAIN, DIALOG_STYLE_LIST, name, string, "Select", "Cancel");
}
}
if((newkeys & KEY_FIRE) && GetPVarInt(playerid, "SpeedRadar") == 1 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(GetPVarInt(playerid, "RadarTimeout") == 0)
{
if(GetPlayerWeapon(playerid) == SPEEDGUN)
{
new Float:x,Float:y,Float:z;
for(new veh = 1; veh < MAX_VEHICLES; veh++)
{
if(IsVehicleStreamedIn(veh, playerid))
{
GetVehiclePos(veh,x,y,z);
if(IsPlayerAimingAt(playerid,x,y,z,10))
{
new Float: Speed = GetVehicleSpeed(veh, 0);
new string[68];
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~b~License Plate: ~w~%d~n~~b~Speed: ~w~%d MPH", veh, floatround(Speed/1.609));
GameTextForPlayer(playerid, string,3500, 3);
format(string, sizeof(string), "License Plate: %d Speed: %d MPH", veh, floatround(Speed/1.609));
SendClientMessageEx(playerid, COLOR_GRAD4, string);
SetPVarInt(playerid, "RadarTimeout", 1);
SetTimerEx("RadarCooldown", 3000, 0, "i", playerid);
return 1;
}
}
}
}
}
}
if(newkeys == 16 && Injourney[playerid] > 0)
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(Injourney[playerid], X, Y, Z);
SetPlayerPos(playerid, X+4, Y, Z);
SetPlayerInterior(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
PlayerInfo[playerid][pVW] = 0;
Injourney[playerid] = 0;
}
if((newkeys & KEY_NO) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(IsACop(playerid) || IsALVPDCop(playerid) || PlayerInfo[playerid][pMember] == 20)
{
VehicleLightSwitch(playerid);
GameTextForPlayer(playerid, "~y~TOGGLED LIGHTS", 1000, 3);
}
}
if((newkeys & KEY_FIRE) && pTazer[playerid] == 1 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
if(TazerTimeout[playerid] > 0)
{
return 1;
}
new Float:X, Float:Y, Float:Z;
foreach(Player, i)
{
if(IsPlayerStreamedIn(i, playerid))
{
GetPlayerPos(i, X, Y, Z);
if(IsPlayerAimingAt(playerid,X,Y,Z,1) && PlayerCuffed[i] == 0 && GetPlayerState(i) == PLAYER_STATE_ONFOOT && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
{
if(PlayerInfo[i][pAdmin] >= 99999 && PlayerInfo[i][pTogReports] != 1)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Executive Admins can not be tazed!");
return 1;
}
new string[44 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s gets hit by %s's tazer shot, stunning them.", GetPlayerNameEx(i), GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(i, "~r~Tazed", 3500, 3);
TogglePlayerControllable(i, 0);
ApplyAnimation(i,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
PlayerPlaySound(i, 1085, X, Y, Z);
PlayerPlaySound(playerid, 1085, X, Y, Z);
PlayerCuffed[i] = 1;
SetPVarInt(i, "PlayerCuffed", 1);
PlayerCuffedTime[i] = 16;
SetPVarInt(i, "IsFrozen", 1);
//Frozen[i] = 1;
TazerTimeout[playerid] = 4;
SetTimerEx("TazerTimer",1000,false,"d",playerid);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~r~Tazer reloading... ~w~5", 1500,3);
return 1;
}
}
}
new string[44 + (MAX_PLAYER_NAME * 2)];
format(string, sizeof(string), "* %s fires a tazer shot, which doesn't hit anybody.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
TazerTimeout[playerid] = 4;
SetTimerEx("TazerTimer",1000,false,"d",playerid);
GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~r~Tazer reloading... ~w~5", 1500,3);
}
if((newkeys & 16) && GetPVarInt(playerid,"UsingAnim") == 1 && GetPVarInt(playerid, "IsFrozen") == 0 && GetPlayerState(playerid) == 1 && PlayerCuffed[playerid] == 0 && PlayerInfo[playerid][pBeingSentenced] == 0)
{
ClearAnimations(playerid);
DeletePVar(playerid,"UsingAnim");
}
#define KEY_AIM KEY_HANDBRAKE
if((newkeys & KEY_AIM) && GetPVarInt(playerid,"UsingAnim") == 1 && GetPVarInt(playerid, "IsFrozen") == 0 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT && PlayerCuffed[playerid] == 0 && PlayerInfo[playerid][pBeingSentenced] == 0)
{
ClearAnimations(playerid);
DeletePVar(playerid,"UsingAnim");
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_BEER && (newkeys & KEY_FIRE))
{
if(GetPVarInt(playerid, "DrinkCooledDown") == 1)
{
new Float: cHealth;
GetPlayerHealth(playerid, cHealth);
if(cHealth < 100)
{
SetPlayerHealth(playerid, cHealth+5);
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "* You finish up the drink and throw it away.");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
DeletePVar(playerid, "DrinkCooledDown");
SetTimerEx("DrinkCooldown", 2500, 0, "i", playerid);
return 1;
}
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_WINE && (newkeys & KEY_FIRE))
{
if(GetPVarInt(playerid, "DrinkCooledDown") == 1)
{
new Float: cHealth;
GetPlayerHealth(playerid, cHealth);
if(cHealth < 100)
{
SetPlayerHealth(playerid, cHealth+8);
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "* You finish up the drink and throw it away.");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
DeletePVar(playerid, "DrinkCooledDown");
SetTimerEx("DrinkCooldown", 2500, 0, "i", playerid);
return 1;
}
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_SPRUNK && (newkeys & KEY_FIRE))
{
if(GetPVarInt(playerid, "DrinkCooledDown") == 1)
{
new Float: cHealth;
GetPlayerHealth(playerid, cHealth);
if(cHealth < 100)
{
SetPlayerHealth(playerid, cHealth+2);
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "* You finish up the drink and throw it away.");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
}
DeletePVar(playerid, "DrinkCooledDown");
SetTimerEx("DrinkCooldown", 2500, 0, "i", playerid);
return 1;
}
}
if(IsKeyJustDown(KEY_SECONDARY_ATTACK, newkeys, oldkeys))
{
if(GetPVarInt(playerid, "NGPassenger") == 1)
{
TogglePlayerSpectating(playerid, 0);
}
if(GetPVarInt(playerid, "UsingSprunk"))
{
DeletePVar(playerid, "UsingSprunk");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
return 1;
}
}
if (IsKeyJustDown(KEY_FIRE, newkeys, oldkeys))
{
if( PlayerInfo[playerid][pC4Used] == 1 )
{
if(GoChase[playerid] < 999)
{
if(IsPlayerInRangeOfPoint(GoChase[playerid], 12.0, GetPVarFloat(playerid, "DYN_C4_FLOAT_X"), GetPVarFloat(playerid, "DYN_C4_FLOAT_Y"), GetPVarFloat(playerid, "DYN_C4_FLOAT_Z")))
{
if(PlayerInfo[GoChase[playerid]][pHeadValue] >= 1)
{
if(PlayerInfo[playerid][pMember] == 8 || PlayerInfo[playerid][pLeader] == 8)
{
new string[128];
new takemoney = PlayerInfo[GoChase[playerid]][pHeadValue] / 4 * 2;
GivePlayerCash(playerid, takemoney);
GivePlayerCash(GoChase[playerid], -takemoney);
format(string,sizeof(string),"Hitman %s has fulfilled the contract on %s and collected $%d",GetPlayerNameEx(playerid),GetPlayerNameEx(GoChase[playerid]),PlayerInfo[GoChase[playerid]][pHeadValue] / 4 * 2);
SendFamilyMessage(8, COLOR_YELLOW, string);
format(string,sizeof(string),"You have been critically injured by a Hitman and lost $%d!",takemoney);
ResetPlayerWeaponsEx(GoChase[playerid]);
// SpawnPlayer(GoChase[playerid]);
SendClientMessageEx(GoChase[playerid], COLOR_YELLOW, string);
PlayerInfo[GoChase[playerid]][pHeadValue] = 0;
PlayerInfo[playerid][pCHits] += 1;
SetPlayerHealth(GoChase[playerid], 0.0);
// KillEMSQueue(GoChase[playerid]);
GotHit[GoChase[playerid]] = 0;
GetChased[GoChase[playerid]] = 999;
GoChase[playerid] = 999;
}
}
}
}
PlayerInfo[playerid][pC4Used] = 0;
CreateExplosion(GetPVarFloat(playerid, "DYN_C4_FLOAT_X"), GetPVarFloat(playerid, "DYN_C4_FLOAT_Y"), GetPVarFloat(playerid, "DYN_C4_FLOAT_Z"), 7, 8);
PickUpC4(playerid);
SendClientMessageEx(playerid, COLOR_YELLOW, " Bomb has been detonated!");
PlayerInfo[playerid][pC4Used] = 0;
return 1;
}
if(GetPVarInt(playerid, "MovingStretcher") != -1)
{
KillTimer(GetPVarInt(playerid, "TickEMSMove"));
MoveEMS(playerid);
return 1;
}
if(GetPVarInt(playerid, "DraggingPlayer") != -1)
{
MoveCOP(playerid);
return 1;
}
if(GetPVarInt(playerid, "editingcdvehpos"))
{
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid,DIALOG_CDEDITPARK,DIALOG_STYLE_MSGBOX,"Warning:","Is this the new position you want?","Ok","Cancel");
}
if(GetPVarInt(playerid, "editingcdvehnew"))
{
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid,DIALOG_CDEDITPARK,DIALOG_STYLE_MSGBOX,"Warning:","Is this the new position you want?","Ok","Cancel");
}
if(GetPVarInt(playerid, "editingfamhq") != 255)
{
if(GetPVarInt(playerid, "editingfamhqaction") == 1)
{
DeletePVar(playerid, "editingfamhqaction");
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid,HQENTRANCE,DIALOG_STYLE_MSGBOX,"Warning:","Is this the entrance you want?","Ok","Cancel");
}
else if(GetPVarInt(playerid, "editingfamhqaction") == 2)
{
DeletePVar(playerid, "editingfamhqaction");
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid,HQEXIT,DIALOG_STYLE_MSGBOX,"Warning:","Is this the exit you want?","Ok","Cancel");
}
else if(GetPVarInt(playerid, "editingfamhqaction") == 5)
{
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid,HQENTRANCE,DIALOG_STYLE_MSGBOX,"Warning:","Is this the entrance you want?","Ok","Cancel");
}
else if(GetPVarInt(playerid, "editingfamhqaction") == 6)
{
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid,HQEXIT,DIALOG_STYLE_MSGBOX,"Warning:","Is this the exit you want?","Ok","Cancel");
}
}
new Float:health;
GetPlayerHealth(playerid, health);
if(GetPVarInt(playerid, "UsingSprunk"))
{
new hpint = floatround( health, floatround_round );
if( hpint >= 100 )
{
SendClientMessageEx(playerid, COLOR_GREY, " You already have full health.");
return 1;
}
else
{
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health+1.0);
}
}
}
return 1;
}