16.01.2015, 22:39
Intйntalo asн:
pawn Код:
CMD:crear(playerid, params[])
{
new choice[32];
if(sscanf(params, "s[32]", choice))
return SendClientMessage(playerid, COLOR_WHITE, "Uso correcto: /crear casa");
if(strcmp(choice, "casa", true) == 0)
{
new tipo, string[128];
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "Usted necesita a la conexiуn primero antes de la utilizaciуn de cualquier comando.");
if(PlayerInfo[playerid][pAdmin] < 18) return SendClientMessage(playerid, -1, "No estas autorizado para usar este comando.");
if(sscanf(params, "i", tipo))
{
SendClientMessage(playerid, COLOR_WHITE, "USA: /crear casa [tipo de espacio]");
SendClientMessage(playerid, -1, "Tipos: 1) Espacio Pequeсo | 2) Espacio Mediano | 3) Espacio Grande | 4) Espacio Extra Grande");
if(tipo < 1 || tipo > 4)
return SendClientMessage(playerid, -1, "Las Casas estan entre 1 y 4 espacios.");
new Float:X, Float:Y, Float:Z, Float:Angle;
for(new i=0; i<MAX_CASAS; i++)
{
if(!CasaInfo[i][cTipo])
{
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid,Angle);
GetPlayerPos(playerid, CasaInfo[i][cExteriorX], CasaInfo[i][cExteriorY], CasaInfo[i][cExteriorZ]);
GetPlayerFacingAngle(playerid, CasaInfo[i][cExteriorA]);
CasaInfo[i][cTipo] = tipo;
CasaInfo[i][cStatus] = 0;
CasaInfo[i][cCInteriorWorld] = 1;
if(tipo == 1) // Pequeсa
{
CasaInfo[i][cInteriorX] = 1353.93726;
CasaInfo[i][cInteriorY] = -812.82880;
CasaInfo[i][cInteriorZ] = -15.95016;
CasaInfo[i][cInteriorA] = 89.82002;
CasaInfo[i][cLevel] = 3;
CasaInfo[i][cPrice] = 85000;
}
if(tipo == 2) // Mediana
{
CasaInfo[i][cInteriorX] = 2735.72852;
CasaInfo[i][;cInteriorY] = 1058.76013;
CasaInfo[i][cInteriorZ] = -24.43267;
CasaInfo[i][cInteriorA] = 93.59999
CasaInfo[i][cLevel] = 5;
CasaInfo[i][cPrice] = 150000;
}
if(tipo == 3) // Grande
{
CasaInfo[i][cInteriorX] = 2647.25708;
CasaInfo[i][cInteriorY] = 1072.10291;
CasaInfo[i][cInteriorZ] = -25.62230;
CasaInfo[i][cInteriorA] = 93.06004;
CasaInfo[i][cLevel] = 7;
CasaInfo[i][cPrice] = 250000;
}
if(tipo == 4) // Extra Grande
{
CasaInfo[i][cInteriorX] = 2831.57690;
CasaInfo[i][cInteriorY] = 1048.83337;
CasaInfo[i][cInteriorZ] = -37.95240;
CasaInfo[i][cInteriorA] = 90.72000;
CasaInfo[i][cLevel] = 10;
CasaInfo[i][cPrice] = 500000;
}
CasasTextdrawUpdate(i);
format(string, sizeof(string), "Administraciуn: %s ha creado la casa ID %d.", RPN(playerid), i);
Log_Facha("Registros/Casas.log", string);
SaveCasas(i);
return 1;
}
}
}
return 1;
}