Код:
if(strcmp(cmd, "/houseentrance", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] != 1337 && PlayerInfo[playerid][pAdmin] != 1338)
{
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "SYNTAX: /houseentrance [houseid] - Moves a house to you");
return 1;
}
new proplev = strval(tmp);
if(proplev > sizeof(HouseInfo) || proplev < 0)
{
SendClientMessage(playerid,COLOR_WHITE,"House ID must be above 0 and below 886");
return 1;
}
else
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
format(string,sizeof(string),"Entrance of House %d to %f - %f - %f",proplev,X,Y,Z);
ABroadCast(COLOR_YELLOW,string,5);
HouseInfo[proplev][hEntrancex] = X;
HouseInfo[proplev][hEntrancey] = Y;
HouseInfo[proplev][hEntrancez] = Z;
//OnPropUpdate(); //added auto save system
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s has moved house %d !", sendername, proplev);
EditLog(string);
return 1;
}
}
}
if(strcmp(cmd, "/houseexit", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] != 1337 && PlayerInfo[playerid][pAdmin] != 1338)
{
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "SYNTAX: /houseexit [houseid] - Moves a house to you");
return 1;
}
new proplev = strval(tmp);
if(proplev > sizeof(HouseInfo) || proplev < 0)
{
SendClientMessage(playerid,COLOR_WHITE,"House ID must be above 0 and below 33");
return 1;
}
else
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
format(string,sizeof(string),"Exit of House %d to %f - %f - %f",proplev,X,Y,Z);
ABroadCast(COLOR_YELLOW,string,5);
HouseInfo[proplev][hExitx] = X;
HouseInfo[proplev][hExity] = Y;
HouseInfo[proplev][hExitz] = Z;
HouseInfo[proplev][hInt] = GetPlayerInterior(playerid);
//OnPropUpdate(); //added auto save system
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s has moved house %d exit !", sendername, proplev);
EditLog(string);
return 1;
}
}
return 1;
}