pawn Код:
new Text:HouseLightsText;
public OnGameModeInit()
{
HouseLightsText = TextDrawCreate(0.0,00.0,"D");
TextDrawAlignment(HouseLightsText,0);
TextDrawBackgroundColor(HouseLightsText,0x00000000);
TextDrawFont(HouseLightsText,1);
TextDrawLetterSize(HouseLightsText,200.0,400.0);
TextDrawColor(HouseLightsText,0x000000A9);
TextDrawSetOutline(HouseLightsText,false);
TextDrawSetProportional(HouseLightsText,false);
TextDrawSetShadow(HouseLightsText,false);
TextDrawUseBox(HouseLightsText, true);
TextDrawBoxColor(HouseLightsText, 0x000000A9);
};
public OnPlayerLogin(playerid,password[])
{
TextDrawHideForPlayer(playerid, HouseLightsText);
for(new h; h<MAX_HOUSES; h++)
{
if(HouseInfo[h][ID] > 0)
{
if(strcmp(HouseInfo[h][Owner], sendername) == 0)
{
PlayerInfo[playerid][pHouses] ++;
}
}
}
return 1;
}
//add this where your house enter command is
if(HouseInfo[h][Lights] != 1)//If they are off
{
TextDrawShowForPlayer(playerid, HouseLightsText);
}
CMD:lights(playerid)
{
if(PlayerInfo[playerid][pLocal]-1000 >= 0)
{
new house = PlayerInfo[playerid][pLocal]-1000;
if(!IsPlayerInRangeOfPoint(playerid, 4.0, HouseInfo[house][ExitX], HouseInfo[house][ExitY], HouseInfo[house][ExitZ]))
{
SendClientMessage(playerid, COLOR_LIGHTRED, "You must be next to the light switch (at the front door).");
return 1;
}
if(HouseInfo[house][Lights] == 0)// off
{
HouseInfo[house][Lights] = 1;
foreach(Player,i)
{
if(PlayerInfo[i][pLocal] == house+1000)
{
TextDrawHideForPlayer(i, HouseLightsText);
}
}
TextDrawHideForPlayer(playerid, HouseLightsText);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Lights ON");
return 1;
}
else if(HouseInfo[house][Lights] == 1)// on
{
HouseInfo[house][Lights] = 0;
foreach(Player,i)
{
if(PlayerInfo[i][pLocal] == house+1000)
{
TextDrawShowForPlayer(i, HouseLightsText);
}
}
TextDrawShowForPlayer(playerid, HouseLightsText);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "* Lights OFF");
return 1;
}
I created this a while back, from an old script I had, so some things will need changing.