05.07.2012, 06:50
Here Is The Code To A Gate That Will Open If/When You Press Enter Well It Should Open
Quote:
#include <a_samp> new gate; #define enter 16 new IsGateOpen; public OnFilterScriptInit() { gate = CreateObject(971, -693.51, 965.70, 13.25, 0.00, 0.00, -90.00); CreateObject(2886, -693.63, 960.74, 12.76, 0.00, 0.00, -90.00); CreateObject(2886, -687.16, 971.93, 12.50, 0.00, 0.00, 0.00); return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (newkeys && enter) { new name[24]; GetPlayerName(playerid, name,sizeof(name)); if (strcmp(name, "Your name",true) == 0) if(IsPlayerInRangeOfPoint(playerid, 4.0,-687.1597, 971.9300, 12.5045)) { if (IsGateOpen == 0) { MoveObject(gate,-693.5065, 965.7040, 7.0233,0.90); ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 4.0, 0, 0, 0, 0, 0); IsGateOpen = 1; return 1; } if (IsGateOpen == 1) { MoveObject(gate, -693.51, 965.70, 13.31,0.90); ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 4.0, 0, 0, 0, 0, 0); IsGateOpen = 0; return 1; } } } else if (newkeys && enter) { new name[24]; GetPlayerName(playerid, name,sizeof(name)); if (strcmp(name, "Your name",true) == 0) if(IsPlayerInRangeOfPoint(playerid, 4.0,-693.6265, 960.7364, 12.7582)) { if (IsGateOpen == 0) { MoveObject(gate,-693.5065, 965.7040, 7.0233,0.90); ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 4.0, 0, 0, 0, 0, 0); IsGateOpen = 1; return 1; } if (IsGateOpen == 1) { MoveObject(gate, -693.51, 965.70, 13.31,0.90); ApplyAnimation(playerid, "HEIST9", "Use_SwipeCard", 4.0, 0, 0, 0, 0, 0); IsGateOpen = 0; return 1; } } } return 1; } |