24.03.2009, 11:13
pawn Код:
dcmd_house(playerid, params[])
{
if(Account[playerid][pAdminLvl] <= 20)
return AdministratorError(playerid,20);
new string[128];
if (params[0]=='\0')
return SendClientMessage(playerid, COLOR_WHITE, "SERVER: /house [add | delete]");
else if(!strcmp(params, "add", true, 3))
{
new Float:X,Float:Y,Float:Z,Interior,World,Float:Angle,houseid;
GetPlayerPos(playerid,X,Y,Z);
World=GetPlayerVirtualWorld(playerid);
Interior=GetPlayerInterior(playerid);
GetPlayerFacingAngle(playerid,Angle);
houseid=AddHouse("None",X,Y,Z,World,Interior,Angle,0.0,0.0,0.0,0,0.0,0,0,0,99999999,1);
format(string,sizeof(string),"INFO: House id %d successfully created, there are now %d houses in the server.",houseid,HOUSE_COUNT);
return SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
}
else if(!strcmp(params, "delete", true, 6 ))
{
new houseid;
if (params[6]=='\0' || sscanf(params[7], "d", houseid))
return SendClientMessage(playerid, COLOR_WHITE, "SERVER: /house [delete] [houseid]");
format(string,sizeof(string),"INFO: House ID %d.",houseid);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
if(dini_Exists(GetHouse(houseid)))
{
DeleteHouse(houseid);
format(string,sizeof(string),"INFO: House id %d successfully deleted, there are now %d houses in the server.",houseid,HOUSE_COUNT);
return SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
}
else
{
format(string,sizeof(string),"INFO: House id %d does not exist!.",houseid);
return SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
}
}
return 0;
}