[Ajuda] comando /criarcasa
#1

Bom eu tenho um comando q й /criarcasa , ele funciona da seguinte forma ,
/criarcasa <preзo> <LV Max 1-10>


sу que eu quero q ele funcione assim
/criarcasa <LV Max 1-10>

tipo pra quem digitar o comando so colocar o level da casa e nao o preзo , o preзo fica pre-definido
entenderгo ? podem me ajudar ?

Comando Completo :
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;
}

Preзos :
pawn Код:
1 : 100 mil
2 : 200 mil
3 : 350 mil
4 : 450 mil
5 : 600 mil
6 : 750 mil
7 : 850 mil
8 : 950 mil
9 : 1 milhao
10 : 1 milhao e meio
Reply
#2

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, "i", MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/criarcasa <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] = "VALORRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR";
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;
}
Reply
#3

Quote:
Originally Posted by davi54723
Посмотреть сообщение
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, "i", MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/criarcasa <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] = "VALORRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR";
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;
}
Deixa de ser ignorante , nao quer ajudar n ajuda, n й bem isso q eu quero , eu quero os preзos em 1 sу comando , nao 1 comando pra cada level
Reply
#4

Up...
Reply
#5

pawn Код:
// Lets the player add new houses
COMMAND:criarcasa(playerid, params[])
{
// Setup local variables
new HPrice, MaxLevel, HouseID, valor;

// 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", valor, MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Digite: \"/criarcasa <Preзo (1-10)> <LevelMax (1-10)>\"");
else
{
if ((valor>= 1) && (valor<= 10))
{
switch(valor)
{
case 1: HPrice=100000;
case 2: HPrice=200000;
case 3: HPrice=350000;
case 4: HPrice=100000;//altere os valor de acordo com o que vocк desejar
case 5: HPrice=100000;
case 6: HPrice=100000;
case 7: HPrice=100000;
case 8: HPrice=100000;
case 9: HPrice=100000;
case 10: HPrice=100000;
}
// 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 Valor de 1 a 10");
}
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;
}
acho que seja dessa forma que vocк quer, de uma conferida pois fiz as alteraзхes aqui mesmo na resposta entгo nгo tenho certeza do fechamento das chaves
Reply
#6

@Matheus
Deu esses Seguintes erros
pawn Код:
C:\Documents and Settings\admin\Desktop\Rodovia Brasil 0.3z\pawno\include\PPC_PlayerCommands.inc(133) : error 029: invalid expression, assumed zero
C:\Documents and Settings\admin\Desktop\Rodovia Brasil 0.3z\pawno\include\PPC_PlayerCommands.inc(141) : error 010: invalid function or declaration
C:\Documents and Settings\admin\Desktop\Rodovia Brasil 0.3z\pawno\include\PPC_PlayerCommands.inc(142) : error 010: invalid function or declaration
C:\Documents and Settings\admin\Desktop\Rodovia Brasil 0.3z\pawno\include\PPC_PlayerCommands.inc(145) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

Linhas :
pawn Код:
Linha :
else // 133
SendClientMessage(playerid, 0xFF0000FF, "Digite um Level de 1 a 10");
}
}
else
SendClientMessage(playerid, 0xFF0000FF, "Voce nao pode Criar uma Casa dentro do Veiculo");
}
}
else // 141
return 0; //142

// Let the server know that this was a valid command
return 1; // 145
}
Obrigado por ajudar
Reply
#7

UpІ...
Reply
#8

TENTA USAR ESSE LUUCAS
pawn Код:
COMMAND:criarcasa(playerid, params[])
{
    new HPrice, MaxLevel, HouseID;
    SendAdminText(playerid, "/criarcasa", params);
    if (APlayerData[playerid][LoggedIn] == true)
    {
        if (APlayerData[playerid][PlayerLevel] >= 4)
        {
            if (GetPlayerVehicleSeat(playerid) == -1)
            {
                if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Use: /criarcasa [Max Level]");
                else
                {
                    if ((MaxLevel >= 1) && (MaxLevel <= 10))
                    {                      
                            for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
                                if (AHouseData[HouseID][PickupID] == 0)
                                    break;
                            if (HouseID < MAX_HOUSES)
                            {
                                new Float:x, Float:y, Float:z, Msg[128];
                                GetPlayerPos(playerid, x, y, z);
                                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;
                                House_CreateEntrance(HouseID);
                                HouseFile_Save(HouseID);
                                format(Msg, 128, "{00FF00}Vocк criou a casa de ID {FF00FF}%i{00FF00} com sucesso!", HouseID);
                                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                            }
                            else
                            SendClientMessage(playerid, 0xFF0000FF, "A quantidade mбxima de casas criadas, foi atingida!");          
                    }
                    else
                    SendClientMessage(playerid, 0xFF0000FF, "Vocк deve escolher o Level entre 0 e 10.");
                }
            }
            else
                SendClientMessage(playerid, 0xFF0000FF, "Vocк nгo pode estar dentro de um veнculo para criar uma casa!");
        }
    }
    else
        return 0;
    return 1;
}
Reply
#9

[OffTopic]

Eu tbm havia pensado nisso, inclusive o meu GM й todo montado em cima do PPC_Truck com GrandLarceny, mas optei por deixar como estб, apenas setei o valor inicial (fixo) como 200Mil.

Pq depois cada level aumentarб 100%, uma casa Level 2 custaria 400Mil, uma level 4 = 800 Mil, enfim, preferi alterar os valore atravйs do calculo da porcentagem, d modo que TODAS as casas custarгo inicialmente 200Mil. Caso contrario o cara paga 1Milhгo pra uma casa level 10, depois mais 1Milhгo pra cada upgrade atй atingir o Level 10...
Reply
#10

Quote:
Originally Posted by DiegoCosta
Посмотреть сообщение
[OffTopic]

Eu tbm havia pensado nisso, inclusive o meu GM й todo montado em cima do PPC_Truck com GrandLarceny, mas optei por deixar como estб, apenas setei o valor inicial (fixo) como 200Mil.

Pq depois cada level aumentarб 100%, uma casa Level 2 custaria 400Mil, uma level 4 = 800 Mil, enfim, preferi alterar os valore atravйs do calculo da porcentagem, d modo que TODAS as casas custarгo inicialmente 200Mil. Caso contrario o cara paga 1Milhгo pra uma casa level 10, depois mais 1Milhгo pra cada upgrade atй atingir o Level 10...
Pode me mandar o comando ?


Quote:
Originally Posted by ANNIHILATION
Посмотреть сообщение
TENTA USAR ESSE LUUCAS
pawn Код:
COMMAND:criarcasa(playerid, params[])
{
    new HPrice, MaxLevel, HouseID;
    SendAdminText(playerid, "/criarcasa", params);
    if (APlayerData[playerid][LoggedIn] == true)
    {
        if (APlayerData[playerid][PlayerLevel] >= 4)
        {
            if (GetPlayerVehicleSeat(playerid) == -1)
            {
                if (sscanf(params, "ii", HPrice, MaxLevel)) SendClientMessage(playerid, 0xFF0000AA, "Use: /criarcasa [Max Level]");
                else
                {
                    if ((MaxLevel >= 1) && (MaxLevel <= 10))
                    {                      
                            for (HouseID = 1; HouseID < MAX_HOUSES; HouseID++)
                                if (AHouseData[HouseID][PickupID] == 0)
                                    break;
                            if (HouseID < MAX_HOUSES)
                            {
                                new Float:x, Float:y, Float:z, Msg[128];
                                GetPlayerPos(playerid, x, y, z);
                                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;
                                House_CreateEntrance(HouseID);
                                HouseFile_Save(HouseID);
                                format(Msg, 128, "{00FF00}Vocк criou a casa de ID {FF00FF}%i{00FF00} com sucesso!", HouseID);
                                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                            }
                            else
                            SendClientMessage(playerid, 0xFF0000FF, "A quantidade mбxima de casas criadas, foi atingida!");          
                    }
                    else
                    SendClientMessage(playerid, 0xFF0000FF, "Vocк deve escolher o Level entre 0 e 10.");
                }
            }
            else
                SendClientMessage(playerid, 0xFF0000FF, "Vocк nгo pode estar dentro de um veнculo para criar uma casa!");
        }
    }
    else
        return 0;
    return 1;
}
Nгo mudou em nada, sу a mensagem que mando quando o comando esta incompleto
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)