06.09.2014, 20:32
pawn Код:
CMD:enter(playerid, params[])
{
if(GetPVarInt(playerid, "PBM") > 0) {
SendClientMessage(playerid, COLOR_WHITE, "You can't do this while being in a arena!");
return 1;
}
if(PlayerCuffed[playerid] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You can't do this right now.");
return 1;
}
if(PlayerInfo[playerid][pJailed] > 0)
{
SendClientMessage(playerid, COLOR_WHITE, "You can't do this right now.");
return 1;
}
new string[128];
for(new i = 0; i < sizeof(DDoorsInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid,3.0,DDoorsInfo[i][ddExteriorX], DDoorsInfo[i][ddExteriorY], DDoorsInfo[i][ddExteriorZ]) && PlayerInfo[playerid][pVW] == DDoorsInfo[i][ddExteriorVW])
{
if(DDoorsInfo[i][ddVIP] > 0 && PlayerInfo[playerid][pDonator] < DDoorsInfo[i][ddVIP]) {
SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, you're not a high enough Donator level.");
return 1;
}
if(DDoorsInfo[i][ddGang] > 0) {
if(PlayerInfo[playerid][pGang] != DDoorsInfo[i][ddGang]) {
SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door is gang restricted.");
return 1;
}
}
if(DDoorsInfo[i][ddFaction] > 0) {
if(PlayerInfo[playerid][pFaction] != DDoorsInfo[i][ddFaction])
{
SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door is faction restricted.");
return 1;
}
}
if(DDoorsInfo[i][ddAdmin] > 0 && PlayerInfo[playerid][pAdmin] < DDoorsInfo[i][ddAdmin]) {
SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, you're not a high enough admin level.");
return 1;
}
if(DDoorsInfo[i][ddWanted] > 0 && PlayerInfo[playerid][pWantedLevel] != 0) {
SendClientMessage(playerid, COLOR_GRAD2, "You can't enter, this door restricts those with wanted levels.");
return 1;
}
if(DDoorsInfo[i][ddLocked] == 1) {
return SendClientMessage(playerid, COLOR_GRAD2, "This door is currently locked.");
}
if(PlayerInfo[playerid][pMask] == 1) { format(string, sizeof(string), "* Stranger has entered %s.",DDoorsInfo[i][ddDescription]); }
else { format(string, sizeof(string), "* %s has entered %s.", GetPlayerNameEx(playerid), DDoorsInfo[i][ddDescription]); }
ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPlayerInterior(playerid,DDoorsInfo[i][ddInteriorInt]);
PlayerInfo[playerid][pInt] = DDoorsInfo[i][ddInteriorInt];
PlayerInfo[playerid][pVW] = DDoorsInfo[i][ddInteriorVW];
SetPlayerVirtualWorld(playerid, DDoorsInfo[i][ddInteriorVW]);
if(DDoorsInfo[i][ddCustomInterior]) {
LoadObjectsForPlayer(playerid);
}
if(DDoorsInfo[i][ddVehicleAble] > 0 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
SetVehiclePos(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorA]);
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorVW]);
LinkVehicleToInterior(GetPlayerVehicleID(playerid), DDoorsInfo[i][ddInteriorInt]);
}
else {
SetPlayerPos(playerid,DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
SetPlayerFacingAngle(playerid,DDoorsInfo[i][ddInteriorA]);
SetCameraBehindPlayer(playerid);
}
return Streamer_UpdateEx(playerid, DDoorsInfo[i][ddInteriorX],DDoorsInfo[i][ddInteriorY],DDoorsInfo[i][ddInteriorZ]);
}
}
for(new i = 0; i < sizeof(HouseInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid,3,HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ]))
{
if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i || HouseInfo[i][hLock] == 0 || PlayerInfo[playerid][pRenting] == i)
{
if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i)
{
if(PlayerInfo[playerid][pMask] == 1) { format(string,sizeof(string), "* Stranger entered their house."); }
else { format(string, sizeof(string), "* %s has entered their house.", GetPlayerNameEx(playerid)); }
ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
if(PlayerInfo[playerid][pMask] == 1) { format(string,sizeof(string), "* Stranger has entered %s's house.", HouseInfo[i][hOwner]); }
else { format(string, sizeof(string), "* %s has entered %s's house.", GetPlayerNameEx(playerid), HouseInfo[i][hOwner]); }
ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
SetPlayerInterior(playerid,HouseInfo[i][hHInteriorWorld]);
PlayerInfo[playerid][pInt] = HouseInfo[i][hHInteriorWorld];
PlayerInfo[playerid][pVW] = i+6000;
SetPlayerVirtualWorld(playerid, i+6000);
if(HouseInfo[i][hCustomInterior] == 1)
{
LoadObjectsForPlayer(playerid);
}
SetPlayerPos(playerid,HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
SetPlayerFacingAngle(playerid,HouseInfo[i][hInteriorA]);
SetCameraBehindPlayer(playerid);
if(PlayerInfo[playerid][pHouse] == i || PlayerInfo[playerid][pHouse2] == i)
{
GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
}
Streamer_UpdateEx(playerid, HouseInfo[i][hInteriorX],HouseInfo[i][hInteriorY],HouseInfo[i][hInteriorZ]);
}
else
{
GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
}
return 1;
}
}
for(new i=1; i<MAX_BUSINESS; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[i][bX], BizInfo[i][bY], BizInfo[i][bZ]))
{
if(PlayerInfo[playerid][pBusiness] == i || BizInfo[i][bStatus] == 1)
{
if(GetPlayerCash(playerid) >= BizInfo[i][bBizFee])
{
GivePlayerCash(playerid, - BizInfo[i][bBizFee]);
BizInfo[i][bMoney] += BizInfo[i][bBizFee];
if(PlayerInfo[playerid][pBusiness] == i)
{
if(PlayerInfo[playerid][pMask] == 1) { format(string,sizeof(string), "* Stranger entered their business."); }
else { format(string, sizeof(string), "* %s has entered their business.", GetPlayerNameEx(playerid)); }
ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
if(PlayerInfo[playerid][pMask] == 1) { format(string,sizeof(string), "* Stranger entered %s's business.", BizInfo[i][bOwner]); }
else { format(string, sizeof(string), "* %s has entered their business.", GetPlayerNameEx(playerid), BizInfo[i][bOwner]); }
ProxDetector(25.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
SetPlayerInterior(playerid,BizInfo[i][bBInteriorWorld]);
PlayerInfo[playerid][pInt] = BizInfo[i][bBInteriorWorld];
PlayerInfo[playerid][pVW] = i+100;
SetPlayerVirtualWorld(playerid, i+100);
PlayerInfo[playerid][InBusiness] = i;
if(BizInfo[i][bCustomInterior] == 1)
{
LoadObjectsForPlayer(playerid);
}
SetPlayerPos(playerid,BizInfo[i][bInteriorX],BizInfo[i][bInteriorY],BizInfo[i][bInteriorZ]);
SetPlayerFacingAngle(playerid,BizInfo[i][bInteriorA]);
SetCameraBehindPlayer(playerid);
if(PlayerInfo[playerid][pBusiness] == i)
{
GameTextForPlayer(playerid, "~w~Welcome Home", 5000, 1);
}
if(BizInfo[i][bType] > 2 && BizInfo[i][bType] != 5)
{
SendClientMessage(playerid,COLOR_WHITE," Use /buy to purchase something from this business !");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You don't have cash for that Business Entrance Fee");
}
Streamer_UpdateEx(playerid, BizInfo[i][bInteriorX],BizInfo[i][bInteriorY],BizInfo[i][bInteriorZ]);
}
else
{
GameTextForPlayer(playerid, "~r~Locked", 5000, 1);
}
return 1;
}
}
new i = IsPlayerNearGarage(playerid);
if(IsPlayerInRangeOfPoint(playerid, 5.5, GarageInfo[i][GarageEnterX], GarageInfo[i][GarageEnterY], GarageInfo[i][GarageEnterZ]))
{
new Seat[MAX_PLAYERS], InCar[MAX_PLAYERS];
new intoset, vehicleid;
if(i == -1) return SendClientMessage(playerid, COLOR_GREY, " You are not near a garage.");
if(GarageInfo[i][GarageSize] == 1) { intoset = 2; }
if(GarageInfo[i][GarageSize] == 2) { intoset = 3; }
if(GarageInfo[i][GarageSize] == 3) { intoset = 1; }
if(GarageInfo[i][GarageLocked]) return SendClientMessage(playerid, COLOR_GREY, "This garage is locked.");
if(GetPlayerState(playerid) == 2)
{
vehicleid = GetPlayerVehicleID(playerid);
SetVehiclePos(vehicleid, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ] + 0.4);
SetVehicleZAngle(vehicleid, GarageInfo[i][GarageInsideA]);
SetVehicleWorld(vehicleid, i);
SetVehicleInterior(vehicleid, intoset);
foreach(Player, j)
{
if(IsPlayerInVehicle(j, vehicleid))
{
InCar[j] = vehicleid;
Seat[j] = GetPlayerVehicleSeat(j);
SetPlayerInterior(j, intoset);
SetPlayerVirtualWorld(j, i);
SetPVarInt(j, "InGarage", 1);
}
}
}
SetPlayerPosEx(playerid, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ]);
SetPlayerFacingAngle(playerid, GarageInfo[i][GarageInsideA]);
SetPlayerInterior(playerid, intoset);
SetPlayerVirtualWorld(playerid, i);
if (vehicleid != 0)
{
foreach(Player, j)
{
if (InCar[j] == 0) continue;
if (InCar[j] == vehicleid)
{
PutPlayerInVehicle(j, vehicleid, Seat[j]);
}
}
}
SetPVarInt(playerid, "InGarage", 1);
return Streamer_UpdateEx(playerid, GarageInfo[i][GarageInsideX], GarageInfo[i][GarageInsideY], GarageInfo[i][GarageInsideZ]);
}