Problem: Need cmd which moves house objects (btw in sript is /houseentrance but it doesent work)
Код:
if(strcmp(cmd, "/houseentrance", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] != 6)
{
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 33");
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();
return 1;
}
}
}
if(strcmp(cmd, "/houseexit", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] != 6)
{
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();
return 1;
}
}
return 1;
}