24.07.2011, 14:32
So I have a /lock command.. (and it's not in DCMD or ZCMD, which I know isn't good so please don't remind me about that). Anyway, the first half works, if the player is in range of the "l1" point, it works, but it doesn't detect the other half, if the player is in range of the "l2" point, it just acts like that code isn't even working.
pawn Код:
if(strcmp(cmd, "/lock", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new linkcar1 = PlayerInfo[playerid][CarLinkID];
new linkcar2 = PlayerInfo[playerid][Car2LinkID];
new Float:l1x, Float:l1y, Float:l1z;
new Float:l2x, Float:l2y, Float:l2z;
GetVehiclePos(linkcar2, l2x, l2y, l2z);
GetVehiclePos(linkcar1, l1x, l1y, l1z);
if(IsPlayerInRangeOfPoint(playerid, 4, l1x, l1y, l1z))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
if(gCarLock[linkcar1] == 1)
{
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger has unlocked their vehicle.");
else format(string, sizeof(string), "* %s has unlocked their vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
UnLockCar(linkcar1);
}
else
{
if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger has locked their vehicle.");
else format(string, sizeof(string), "* %s has locked their vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
LockCar(linkcar1);
}
if(IsPlayerInRangeOfPoint(playerid, 4, l2x, l2y, l2z))
{
if(gCarLock[linkcar2] == 1)
{
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger has unlocked their vehicle.");
else format(string, sizeof(string), "* %s has unlocked their vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
UnLockCar(linkcar2);
}
else
{
if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger has locked their vehicle.");
else format(string, sizeof(string), "* %s has locked their vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
LockCar(linkcar2);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are too far away from your vehicle !");
return 1;
}
}
return 1;
}