13.07.2014, 14:28
pawn Код:
CMD:breakin(playerid,params[])
{
if(PlayerInfo[playerid][pScrew] >= 1 || PlayerInfo[playerid][pAdmin] >= 1337)
{
new biz = IsPlayerNearBiz(playerid);
new house = IsPlayerNearHouse(playerid);
new car = -1;
new Float:vX, Float:vY, Float:vZ;
for(new i = 0; i < MAX_VEHICLES; i++)
{
GetVehiclePos(i, vX, vY, vZ);
if(IsPlayerInRangeOfPoint(playerid, 5.0, vX, vY, vZ))
{
car = i;
break;
}
}
strmid(sendername, PlayerRPName(playerid), 0, MAX_PLAYER_NAME);
if(biz == -1 && house == -1 && car == -1) return SendClientMessage(playerid, COLOR_GREY, " You aren't at a house/business/vehicle.");
if(LockPickingBiz[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a business.");
if(LockPickingHouse[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a house.");
if(LockPickingCar[playerid] != 999) return SendClientMessage(playerid, COLOR_GREY, " You are already lockpicking a car.");
if(biz != -1) //they are picking a biz
{
if(BizInfo[biz][bOwned] == 0) return SendClientMessage(playerid,COLOR_GREY," This business is not owned.");
if(BizInfo[biz][bLocked] == 0) return SendClientMessage(playerid,COLOR_GREY," This business is already unlocked.");
// for(new i = 0; i < MAX_PLAYERS; i++)
foreach (Player, i)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pBizKey] == biz)
{
format(string, sizeof(string), "SMS: This is an automated message informing you that your business alarm has been activated.",giveplayer);
SendClientMessage(i, COLOR_YELLOW, string);
break;
}
}
}
if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; }
format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the business.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
LockPickingBiz[playerid] = biz;
}
else if(house != -1) //they are picking a home
{
if(HouseInfo[house][hOwned] == 0) return SendClientMessage(playerid,COLOR_GREY," This house is not owned.");
if(HouseInfo[house][hLocked] == 0) return SendClientMessage(playerid,COLOR_GREY," This house is already unlocked.");
// for(new i = 0; i < MAX_PLAYERS; i++)
foreach (Player, i)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pHouseID] == house)
{
format(string, sizeof(string), "SMS: This is an automated message informing you that your house alarm has been activated.",giveplayer);
SendClientMessage(i, COLOR_YELLOW, string);
break;
}
}
}
if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; }
format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the house.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
LockPickingHouse[playerid] = house;
}
else if(car != -1) //they are picking a car
{
new Float:X, Float:Y, Float:Z;
GetVehiclePos(car, X, Y, Z);
if(gCarLock[car] == 0) return SendClientMessage(playerid,COLOR_GREY," This vehicle is already unlocked.");
foreach (Player, i)
{
if(IsPlayerConnected(i))
{
if(CarInfo[PlayerInfo[playerid][pCar][0]][c_ID] == car)
{
if(CarInfo[PlayerInfo[playerid][pCar][0]][c_Alarm] != 1) break;
format(string, sizeof(string), "SMS: This is an automated message informing you that your vehicle alarm has been activated.",giveplayer);
SendClientMessage(i, COLOR_YELLOW, string);
SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
CP[playerid] = CHECKPOINT_CAR_ALARM;
break;
}
else if(CarInfo[PlayerInfo[playerid][pCar][1]][c_ID] == car)
{
if(CarInfo[PlayerInfo[playerid][pCar][1]][c_Alarm] != 1) break;
format(string, sizeof(string), "SMS: This is an automated message informing you that your vehicle alarm has been activated.",giveplayer);
SendClientMessage(i, COLOR_YELLOW, string);
SetPlayerCheckpoint(playerid, X, Y, Z, 3.0);
CP[playerid] = CHECKPOINT_CAR_ALARM;
break;
}
}
}
if(PlayerInfo[playerid][pMask] == 1){ sendername = "Stranger"; }
format(string, sizeof(string), "* %s pulls out a screwdriver and begins picking at the lock on the vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
LockPickingCar[playerid] = car;
}
PlayerInfo[playerid][pScrew] -= 1;
}
else
{
return SendClientMessage(playerid, COLOR_GREY, " You do not have a screwdriver! You may purchase one from any 24/7.");
}
return 1;
}
CMD:lockpick(playerid, params[])
return cmd_breakin(playerid, params);