24.02.2011, 12:42
The bottom part of this (which does not work) is made for when a player presses the horn it attempts to open a gate and depending if player is in rang of point it will determine to open the gate or not. But when i press horn it doesn't even say "You are not near a gate !" which is made to when your not near a gate and even when you are at a gate it doesn't even open, so that tells me something is wrong with the actual application of the
If i change it to
Would that work in theory?
-----------------------------------------------------------
All Code Under OnPlayerKeyStateChange
pawn Код:
if(newkeys & KEY_CROUCH)
pawn Код:
if(PRESSED(KEY_FIRE))
-----------------------------------------------------------
All Code Under OnPlayerKeyStateChange
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(PRESSED(KEY_FIRE))
{
if(PlantedC4OnVault[playerid] == 1) // Vault Rigged
{
TakeWeapon(playerid, 40);
RobStatus[BeingRobbed] = 1;
RobStatus[Setup] = 0;
SetPlayerCheckpoint(RobStatus[RobberID1], -1479.1213,2625.8848,58.7813, 5);
SetPlayerCheckpoint(RobStatus[RobberID2], -1479.1213,2625.8848,58.7813, 5);
SetPlayerCheckpoint(RobStatus[RobberID3], -1479.1213,2625.8848,58.7813, 5);
SetPlayerCheckpoint(RobStatus[RobberID4], -1479.1213,2625.8848,58.7813, 5);
SetPlayerCheckpoint(RobStatus[RobberID5], -1479.1213,2625.8848,58.7813, 5);
SendClientMessage(RobStatus[RobberID1], COLOR_YELLOW, "** You need to load the cash and get the safe point quickly, (( /loadcash ))");
SendClientMessage(RobStatus[RobberID2], COLOR_YELLOW, "** You need to load the cash and get the safe point quickly, (( /loadcash ))");
SendClientMessage(RobStatus[RobberID3], COLOR_YELLOW, "** You need to load the cash and get the safe point quickly, (( /loadcash ))");
SendClientMessage(RobStatus[RobberID4], COLOR_YELLOW, "** You need to load the cash and get the safe point quickly, (( /loadcash ))");
SendClientMessage(RobStatus[RobberID5], COLOR_YELLOW, "** You need to load the cash and get the safe point quickly, (( /loadcash ))");
SendFamilyMessage(1, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(2, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(3, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(4, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(5, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(6, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(7, COLOR_DBLUE, "------------------------------------------------------------");
PlayerInfo[RobStatus[RobberID1]][pWantedLevel] = 6;
PlayerInfo[RobStatus[RobberID2]][pWantedLevel] = 6;
PlayerInfo[RobStatus[RobberID3]][pWantedLevel] = 6;
PlayerInfo[RobStatus[RobberID4]][pWantedLevel] = 6;
PlayerInfo[RobStatus[RobberID5]][pWantedLevel] = 6;
SetPlayerWantedLevel(RobStatus[RobberID1], 6);
SetPlayerWantedLevel(RobStatus[RobberID2], 6);
SetPlayerWantedLevel(RobStatus[RobberID3], 6);
SetPlayerWantedLevel(RobStatus[RobberID4], 6);
SetPlayerWantedLevel(RobStatus[RobberID5], 6);
new string[126];
format(string, sizeof(string), "** The Los Santos Bank and Trust vault has been destroyed **");
SendFamilyMessage(1, COLOR_DCHAT, string);
SendFamilyMessage(2, COLOR_DCHAT, string);
SendFamilyMessage(3, COLOR_DCHAT, string);
SendFamilyMessage(4, COLOR_DCHAT, string);
SendFamilyMessage(5, COLOR_DCHAT, string);
SendFamilyMessage(6, COLOR_DCHAT, string);
SendFamilyMessage(7, COLOR_DCHAT, string);
SendFamilyMessage(1, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(2, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(3, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(4, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(5, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(6, COLOR_DBLUE, "------------------------------------------------------------");
SendFamilyMessage(7, COLOR_DBLUE, "------------------------------------------------------------");
SendClientMessageToAll(COLOR_ORANGE, "** A Bank Hiest has began");
CreateExplosion(2311.6367,-0.4778,26.7422, 2, 4);
DestroyObject(bankvault1);
bankvault2 = CreateObject(2634,2312.11059570,-2.66468596,26.48641968,53.75942993,296.31378174,254.48004150); // Vault Exploded
PlantedC4OnVault[playerid] = 0;
}
if(RampToggle[playerid] == 1)
{ // admin ramp
if((GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER))
{
new Float: X, Float: Y, Float: Z, Float: A;
GetXYInFrontOfPlayer(playerid, X, Y, Z, A);
ramp = CreateObject(RAMP, X, Y, Z, 0.0, 0.0, A);
SetTimerEx("Delete", TIME, 0, "d", ramp);
}
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_DRINK_SPRUNK)
{
if(UseDrinkTimer[playerid]) return 1;
new Float:health;
GetPlayerHealth(playerid,health);
if(health < 100.0)
{
if(health+5 > 100.0)
{
SetPlayerHealth(playerid, 100);
}
else
{
SetPlayerHealth(playerid, health+5);
}
UseDrinkTimer[playerid] = true;
SetTimerEx("UseDrink",2*1000,0,"i",playerid);
}
}
if(BombID[playerid] != 0)
{
if(GetPlayerWeapon(playerid) == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
ClearAnimations(playerid);
ApplyAnimation(playerid,"PED","bomber",4.0,0,0,0,0,0);
}
new Float:X,Float:Y,Float:Z;
GetObjectPos(BombID[playerid],X,Y,Z);
DestroyObject(BombID[playerid]);
CreateExplosion(X,Y,Z,12,1);
BombID[playerid] = 0;
SetPlayerWeapons(playerid);
new killerid = GoChase[playerid];
if(IsPlayerInRangeOfPoint(killerid,3,X,Y,Z))
{
if(GoChase[playerid] == killerid)
{
if(PlayerInfo[killerid][pHeadValue] > 0)
{
new string[128];
new price = PlayerInfo[killerid][pHeadValue];
new name[MAX_PLAYER_NAME];
new killa[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(killerid, killa, sizeof(killa));
PlayerInfo[killerid][pCash] = PlayerInfo[killerid][pCash]-price/2;
GivePlayerMoney(killerid, -price/2);
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+price/2;
GivePlayerMoney(playerid, price/2);
format(string,128,"Hitman %s has fulfilled the contract on %s and collected $%d.",name,killa,price/2);
SendFamilyMessage(8, COLOR_YELLOW, string);
format(string,128,"You have been critically injured by a hitman and lost $%d.",price/2);
SendClientMessage(killerid, COLOR_YELLOW, string);
SetPlayerHealth(killerid, 0);
ClearContract(killerid);
GoChase[playerid] = 999;
PlayerInfo[playerid][pCHits]++;
}
}
}
}
}
}
if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE)
{
if(GetPlayerWeapon(playerid) == 34 && PlayerInfo[playerid][pScope] == 1)
{
if(RecentlyShot[playerid] == 0)
{
RecentlyShot[playerid] = 1;
SetTimerEx("AntiSpam", 1000, false, "d", playerid);
{
new Float:blahx, Float:blahy, Float:blahz;
HeadshotCheck(playerid, blahx, blahy, blahz);
}
}
}
}
if(!gPlayerUsingLoopingAnim[playerid]) { return 1; }
if(IsKeyJustDown(KEY_SPRINT,newkeys,oldkeys))
{
PlayerHurt[playerid] = 0;
StopLoopingAnim(playerid);
TextDrawHideForPlayer(playerid,txtAnimHelper);
}
if(PRESSED(newkeys, KEY_SUBMISSION)&&(IsPlayerInAnyVehicle(playerid))&&(GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
{
new Float:ppX,Float:ppY,Float:ppZ;
GetPlayerPos(playerid,ppX,ppY,ppZ);
new Float:vvX,Float:vvY,Float:vvZ;
new Found=0;
new vid=0;
while((vid<MAX_VEHICLES)&&(!Found))
{
vid++;
GetVehiclePos(vid,vvX,vvY,vvZ);
if ((floatabs(ppX-vvX)<7.0)&&(floatabs(ppY-vvY)<7.0)&&(floatabs(ppZ-vvZ)<7.0)&&(vid!=GetPlayerVehicleID(playerid)))
{
Found=1;
if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
{
DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
}
else
{
AttachTrailerToVehicle(vid,GetPlayerVehicleID(playerid));
}
}
}
if (!Found)
{
SendClientMessage(playerid,COLOR_GREY," There is no car in range !");
}
}
}
if(newkeys & KEY_CROUCH)//Use Horn
{
if(IsPlayerInRangeOfPoint(playerid,9,1588.3058,-1637.9652,13.4227))
{ //POLICE GATE
if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY," You are not a Cop / FBI / SASP !");
if(pdgategar==0)
{
pdgategar = 1;
MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 7.710285, 1.50);
}
else if(pdgategar==1)
{
pdgategar = 0;
MoveObject(pdgaragegateobj, 1588.965698, -1637.882690, 15.260185, 1.50);
}
}
else if(IsPlayerInRangeOfPoint(playerid,9,1544.4913,-1627.2817,13.3828))
{ //POLICE BAR
if(!IsACop(playerid)) return SendClientMessage(playerid,COLOR_GREY," You are not a Cop / FBI / SASP !");
if(pdgatebar==0)
{
pdgatebar = 1;
SetObjectRot( pdbarriergateobj, 0.0000, 360.0000, 90.0000);
SetObjectPos( pdbarriergateobj, 1544.682495, -1630.953003, 13.079567 );
}
else if(pdgatebar==1)
{
pdgatebar = 0;
SetObjectRot( pdbarriergateobj, 0.0000, 90.0000, 90.0000);
SetObjectPos( pdbarriergateobj, 1544.682495, -1630.980000, 13.215000 );
}
}
else if(IsPlayerInRangeOfPoint(playerid,9, 135.35978699,1997.06042480,10.20645332))
{ //PRISON GATE
if(!IsACop(playerid) && PlayerInfo[playerid][pMember] != 5) return SendClientMessage(playerid,COLOR_GREY," You are not a Cop / FBI / SASP / NG !");
if(Prison_Buttons[GateOpened] == 0)
{
MoveObject(Prison_Buttons[PrisonGate], 135.35978699,1997.06042480,10.20645332, 1.50);
Prison_Buttons[GateOpened] = 1;
Prison_Buttons[GateTimerID]= SetTimer("PrisonGateCheck", 60000, 0);
}
else
{
MoveObject(Prison_Buttons[PrisonGate], 135.35978699,1997.06042480,20.20645332, 1.50);
Prison_Buttons[GateOpened] = 0;
KillTimer(Prison_Buttons[GateTimerID]);
}
}
else if(IsPlayerInRangeOfPoint(playerid, 12.0,-80.057670593262, -352.7497253418, 7.6630787467957))
{ //SECRET SOCIETY GATE
if(!(PlayerInfo[playerid][pMember] == 7)) return SendClientMessage(playerid,COLOR_GREY," You are not a member of the Secret Society !");
if(ssgateopen == 0)
{
ssgateopen = 1;
MoveObject(ssgate, -80.057670593262, -352.7497253418, 7.6630787467957, 1.500000);
}
else
{
ssgateopen = 0;
MoveObject(ssgate, -80.057670593262, -352.7497253418, 3.2030787467957, 1.500000);
}
}
else if(IsPlayerInRangeOfPoint(playerid, 12.0, 648.14050293,-1540.10974121,5.32026672))
{ //Taylors Gang
if(!(PlayerInfo[playerid][pFMember] == 2)) return SendClientMessage(playerid,COLOR_GREY," You are not a member of the Secret Society !");
if(tlyganggateopen == 0)
{
tlyganggateopen = 1;
MoveObject(tlygang, 1648.14050293,-1540.10974121,5.32026672, 1.500000);
}
else
{
tlyganggateopen = 0;
MoveObject(tlygang, 1648.14050293,-1540.10974121,15.32026672, 1.500000);
}
}
else if(IsPlayerInRangeOfPoint(playerid, 12.0, 1027.46203613, 1183.29357910, 12.45144653))
{ //FBI GATE
if(!(PlayerInfo[playerid][pMember] == 2)) return SendClientMessage(playerid,COLOR_GREY," You are not a member of the FBI !");
if(fbigateopen == 0)
{
fbigateopen = 1;
MoveObject(FBIGate, 1038.17248535, 1183.50256348, 12.45144653, 1.500000);
}
else
{
fbigateopen = 0;
MoveObject(FBIGate, 1027.46203613,1183.29357910,12.45144653, 1.500000);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are not near a gate !");
}
}
return 1;
}