Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new string[128];
if (newkeys == KEY_FIRE) // You can also add more checks that TD is shown to the player or not!
{
TextDrawDestroy(Textdraw0);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw1);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw2);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw3);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw4);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw5);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw6);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw7);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw8);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw9);//Change TextDraw Name here! this this
TextDrawDestroy(Textdraw10);//Change TextDraw Name here! this this
}
return 1;
}
if(newkeys == KEY_LOOK_BEHIND) //Starting / Stoping vehicle engine
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new vid = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON && !IsAPlane(vid) && !IsACycleBike(vid))
{
SpamStrings[playerid] +=2;
if(SpamStrings[playerid] >= MAX_SPAM)
{
SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before trying to turn on/off the engine again.");
return 0;
}
SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid,i) < 10)
{
format(string,sizeof(string),"%s(%d) spins the vehicle's engine key and turns off the engine.",PlayerName(playerid),playerid);
SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
}
return 1;
}
if(engine != VEHICLE_PARAMS_ON && !IsAPlane(vid) && !IsACycleBike(vid))
{
SpamStrings[playerid] +=2;
if(SpamStrings[playerid] >= MAX_SPAM)
{
SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before trying to turn on/off the engine again.");
return 0;
}
SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(GetDistanceBetweenPlayers(playerid,i) < 10)
{
format(string,sizeof(string),"%s(%d) spins the vehicle's engine key and turns on the engine.",PlayerName(playerid),playerid);
SendClientMessage(i,COLOR_LIGHTBLUE,string);
}
}
return 1;
}
}
return 1;
}
if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, -1619.1694,689.5911,7.1875)) //SFPD Shutter Inside
{
if(gTeam[playerid] != TEAM_SWAT && gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY)
{
SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
return 1;
}
SpamStrings[playerid] +=2;
if(SpamStrings[playerid] >= MAX_SPAM)
{
SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
return 0;
}
SetPlayerPos(playerid, -1619.1694,689.5911,7.1875);
SetPlayerFacingAngle(playerid, 269.9927);
LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
if(SFPDShutterOpen == 0)
{
MoveObject(SFPDShutter, -1620.61669922,688.17712402,12.80728531, 4);
SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
SFPDShutterOpen =1;
return 1;
}
if(SFPDShutterOpen == 1)
{
MoveObject(SFPDShutter, -1620.61669922,688.17712402,7.80728531, 4);
SFPDShutterOpen =0;
return 1;
}
return 1;
}
if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, -1622.1335,687.1992,7.1875)) //SFPD Shutter Outside
{
if(gTeam[playerid] != TEAM_SWAT && gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY)
{
SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
return 1;
}
SpamStrings[playerid] +=2;
if(SpamStrings[playerid] >= MAX_SPAM)
{
SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
return 0;
}
SetPlayerPos(playerid, -1622.1335,687.1992,7.1875);
SetPlayerFacingAngle(playerid, 0.2336);
LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
if(SFPDShutterOpen == 0)
{
MoveObject(SFPDShutter, -1620.61669922,688.17712402,12.80728531, 4);
SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
SFPDShutterOpen =1;
return 1;
}
if(SFPDShutterOpen == 1)
{
MoveObject(SFPDShutter, -1620.61669922,688.17712402,7.80728531, 4);
SFPDShutterOpen =0;
return 1;
}
return 1;
}
if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, 245.3787,73.5715,1003.6406)) //FBI Shutter Inside
{
if(GetPlayerSkin(playerid) != 286)
{
SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
return 1;
}
SpamStrings[playerid] +=2;
if(SpamStrings[playerid] >= MAX_SPAM)
{
SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
return 0;
}
SetPlayerPos(playerid, 245.3787,73.5715,1003.6406);
SetPlayerFacingAngle(playerid, 91.2136);
LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
if(FBIShutterOpen == 0)
{
MoveObject(FBIShutter, 246.42794800,72.70855713,1009.26043701, 3);
SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
FBIShutterOpen =1;
return 1;
}
if(FBIShutterOpen == 1)
{
MoveObject(FBIShutter, 246.42794800,72.70855713,1004.26043701, 3);
FBIShutterOpen =0;
return 1;
}
return 1;
}
if(newkeys & KEY_SECONDARY_ATTACK && PlayerToPoint(1.0, playerid, 247.7420,71.6222,1003.6406)) //FBI Shutter Outside
{
if(GetPlayerSkin(playerid) != 286)
{
SendClientMessage(playerid,COLOR_WHITE,"{FF0000}[ERROR]: {FFFFFF}Access Denied");
return 1;
}
SpamStrings[playerid] +=2;
if(SpamStrings[playerid] >= MAX_SPAM)
{
SendClientMessage(playerid, COLOR_WHITE, "Please do not spam. Please wait before opening/closing again.");
return 0;
}
SetPlayerPos(playerid, 247.7420,71.6222,1003.6406);
SetPlayerFacingAngle(playerid, 3.7928);
LoopingAnim(playerid, "HEIST9", "Use_SwipeCard", 3.0, 0, 0, 0, 0, 0);
if(FBIShutterOpen == 0)
{
MoveObject(FBIShutter, 246.42794800,72.70855713,1009.26043701, 3);
SendClientMessage(playerid, COLOR_DODGERBLUE, "Access Granted");
FBIShutterOpen =1;
return 1;
}
if(FBIShutterOpen == 1)
{
MoveObject(FBIShutter, 246.42794800,72.70855713,1004.26043701, 3);
FBIShutterOpen =0;
return 1;
}
return 1;
}
return 1;
}