04.05.2014, 22:22
gem me ajuda aki pf tem dois comando q nao pega o /calar e /deletarcasa alguem pode me ajudar coloquei todos o comando de criarcasa e deletarcasa mais so o de deletarcasa q nao pega mais ver se tem algo de errado GM de Truck..
pawn Код:
// Lets the player add new houses
COMMAND:criarcasa(playerid, params[])
{
// Setup local variables
new HPrice, MaxLevel, HouseID;
// Send the command to all admins so they can see it
SendAdminText(playerid, "/criarcasa", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 5
if (APlayerData[playerid][PlayerLevel] >= 4)
{
// Check if the player isn't inside a vehicle
if (GetPlayerVehicleSeat(playerid) == -1)
{
if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/criarcasa <preco> >LevelMax (1-10)>\"");
else
{
// Check if the player entered a proper maxlevel
if ((MaxLevel >= 1) && (MaxLevel <= 10))
{
// Find the first free HouseID
for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
if (AHouseData[HouseID][PickupID] == 0) // Check if an empty house-index has been found (PickupID is 0)
break; // Stop searching, the first free HouseID has been found now
// Check if the house-limit hasn't been reached yet
if (HouseID < MAX_HOUSES)
{
// Setup some local variables
new Float:x, Float:y, Float:z, Msg[128];
// Get the player's position
GetPlayerPos(playerid, x, y, z);
// Set some default data
AHouseData[HouseID][HouseX] = x;
AHouseData[HouseID][HouseY] = y;
AHouseData[HouseID][HouseZ] = z;
AHouseData[HouseID][HouseLevel] = 1;
AHouseData[HouseID][HouseMaxLevel] = MaxLevel;
AHouseData[HouseID][HousePrice] = HPrice;
AHouseData[HouseID][Owned] = false;
// Add the pickup and 3DText at the location of the house-entrance (where the player is standing when he creates the house)
House_CreateEntrance(HouseID);
// Save the house
HouseFile_Save(HouseID);
// Inform the player that he created a new house
format(Msg, 128, "{808080}Voce Criou a Casa de Numero {FFFFFF}%i{808080}", HouseID);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
}
else
SendClientMessage(playerid, 0xFF0000FF, "O Maximo de Casas ja Foram Atingidas");
}
else
SendClientMessage(playerid, 0xFF0000FF, "Digite um Level de 1 a 10");
}
}
else
SendClientMessage(playerid, 0xFF0000FF, "Voce nao pode Criar uma Casa dentro do Veiculo");
}
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
// This command lets the player delete a house
COMMAND:deletarcasa(playerid, params[])
{
// Setup local variables
new file[100], Msg[128];
// Send the command to all admins so they can see it
SendAdminText(playerid, "/deletarcasa", params);
// Check if the player has logged in
if (APlayerData[playerid][LoggedIn] == true)
{
// Check if the player's admin-level is at least 5
if (APlayerData[playerid][PlayerLevel] >= 4)
{
// Make sure the player isn't inside a vehicle
if (GetPlayerVehicleID(playerid) == 0)
{
// Loop through all player-owned houses
for (new HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
{
// Check if the house exists
if (AHouseData[HouseID][PickupID] != 0)
{
// Check if the house has no owner
if (AHouseData[HouseID][Owned] == false)
{
// Check if the player is in range of the house-pickup
if (IsPlayerInRangeOfPoint(playerid, 2.5, AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
{
// Clear all data of the house
AHouseData[HouseID][HouseName] = 0;
AHouseData[HouseID][Insurance] = 0;
AHouseData[HouseID][HouseX] = 0.0;
AHouseData[HouseID][HouseY] = 0.0;
AHouseData[HouseID][HouseZ] = 0.0;
AHouseData[HouseID][HouseLevel] = 0;
AHouseData[HouseID][HouseMaxLevel] = 0;
AHouseData[HouseID][HousePrice] = 0;
AHouseData[HouseID][Owned] = false;
AHouseData[HouseID][Owner] = 0;
AHouseData[HouseID][HouseName] = 0;
AHouseData[HouseID][HouseName] = 0;
AHouseData[HouseID][HouseName] = 0;
// Destroy the mapicon, 3DText and pickup for the house
DestroyDynamicPickup(AHouseData[HouseID][PickupID]);
DestroyDynamicMapIcon(AHouseData[HouseID][MapIconID]);
DestroyDynamic3DTextLabel(AHouseData[HouseID][DoorText]);
AHouseData[HouseID][PickupID] = 0;
AHouseData[HouseID][MapIconID] = 0;
// Delete the House-file
format(file, sizeof(file), HouseFile, HouseID); // Construct the complete filename for this house-file
if (fexist(file)) // Make sure the file exists
fremove(file); // Delete the file
// Also let the player know he deleted the house
format(Msg, 128, "{808080}Voce Deletou a Casa de Numero: {FFFFFF}%i", HouseID);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
// Exit the function
return 1;
}
}
}
}
// There was no house in range, so let the player know about it
SendClientMessage(playerid, 0xFFFFFFFF, "{FFFFFF}Sem Casa par deletar");
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{808080}Voce nao Pode Deletar uma Casa dentro do Veiculo");
}
else
return 0;
}
else
return 0;
// Let the server know that this was a valid command
return 1;
}
pawn Код:
COMMAND:calar(playerid, params[])
{
new Msg[128], Name[24], AdminName[24], Reason[128], OtherPlayer;
SendAdminText(playerid, "/calar", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 1)
{
if (sscanf(params, "us[128]", OtherPlayer, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Use: /calar [id] [motivo]");
else
{
if (IsPlayerConnected(OtherPlayer))
{
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(OtherPlayer, Name, sizeof(Name));
APlayerData[OtherPlayer][Muted] = true;
format(Msg, 128, "{FF0000}-| %s foi calado por %s. Motivo: %s |-", Name, AdminName, Reason);
SendClientMessageToAll(0xFFFFFFFF, Msg);
PlayerFile_Save(OtherPlayer);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}O jogador nгo estб online.");
}
}
else
return 0;
}
else
return 0;
return 1;
}
COMMAND:descalar(playerid, params[])
{
new Msg[128], Name[24], AdminName[24], OtherPlayer;
SendAdminText(playerid, "/descalar", params);
if (APlayerData[playerid][LoggedIn] == true)
{
if (APlayerData[playerid][PlayerLevel] >= 1)
{
if (sscanf(params, "u", OtherPlayer)) SendClientMessage(playerid, 0xFF0000AA, "Use: /descalar [id]");
else
{
if (IsPlayerConnected(OtherPlayer))
{
GetPlayerName(playerid, AdminName, sizeof(AdminName));
GetPlayerName(OtherPlayer, Name, sizeof(Name));
APlayerData[OtherPlayer][Muted] = false;
format(Msg, 128, "{FF0000}-| O Administrador %s permitiu que %s volte a falar |-", AdminName, Name);
SendClientMessageToAll(0xFFFFFFFF, Msg);
PlayerFile_Save(OtherPlayer);
}
else
SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}O jogador nao esta online.");
}
}
else
return 0;
}
else
return 0;
return 1;
}