[AJUDA]Comando de pegar id da casa
#1

Alguem me ajude ne um comando para pegar id da casa, o meu game mode й dividido em includes tem uma include so para os comandos, o comando que eu fiz para pegar id da casa ta assim:

pawn Код:
COMMAND:idcasa(playerid, params[])
{
 
 new Msg[128], HouseID;
 SendAdminText(playerid, "/idcasa", params);
 if (APlayerData[playerid][LoggedIn] == true)
 {

  if (APlayerData[playerid][PlayerLevel] >= 5)
  {

   if (GetPlayerVehicleSeat(playerid) == -1)
   {

    format(Msg, 128, "{00FF00}id da casa? {FF00FF}%i{00FF00}", HouseID);
    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
   }

  }

 }else
     return 0;

  return 1;

}
so que esta com um bug, ele da sempre o mesmo id por favor me ajude!

outra coisa, como fasso para colocar um comando para adm logado na RCON, nas include esta assim para setar o level:
pawn Код:
if (APlayerData[playerid][PlayerLevel] >= 5)
ali no 5 determina o level de adm, como coloca para RCON?
Reply
#2

Olб hugo103,

o primeiro problema й que vocк vocк estб criando new HouseID e usando-o na mensagem sem dar um valor а ele. entгo sempre darб o mesmo valor " 0 ", para solucionar й necessбrio saber qual o sistema de casas e/ou o funcionamento do mesmo.

Em relaзгo ao segundo basta trocar o seu cуdigo atual para este:

pawn Код:
if(IsPlayerAdmin(playerid))

Atenciosamente,
Falcon.
Reply
#3

Tб, mas qual funзгo pra pegar o ID da casa? Porque pelo que vi, tu sу criou uma variбvel.
@edit
Quando eu respondi ao tуpico o Falcon tambйm responde. UHEUEHUHE
Reply
#4

EU peguei esse gm https://sampforum.blast.hk/showthread.php?tid=196493 que esta em ingles e traduzi estava querendo um comando para pegar id da casa, no gm tem um comando de criar casa assim que voce cria a casa ele da o id dela ai esta o comando

pawn Код:
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] >= 5)
        {
            // Check if the player isn't inside a vehicle
            if (GetPlayerVehicleSeat(playerid) == -1)
            {
                if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/criarcasa <valor> <level (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, "{00FF00}Vocк criou com sucesso casa {FF00FF}%i{00FF00}", HouseID);
                            SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                        }
                        else
                            SendClientMessage(playerid, 0xFF0000FF, "A quantidade mбxima de casas foi atingida");
                    }
                    else
                        SendClientMessage(playerid, 0xFF0000FF, "Vocк tem que usar um mбximo nнvel de 1-10");
                }
            }
            else
                SendClientMessage(playerid, 0xFF0000FF, "Vocк nгo pode estar dentro de um veнculo para criar uma casa");
        }
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 1;
}
eu tomei como base esse comando sei que й possivel criar esse comando pois ja vi ele em outro servidor!!se puderem me ajuda agradeзo
Reply
#5

Obrigado eu ja consegui!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)