[Ajuda] Dб pra comprar casa jб comprada
#6

PHP код:
#define MAX_CASAS 10
new bool:CasaComprada[MAX_CASAS]; 
comprar casa
PHP код:
case 1:
{
    
format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
    new 
nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
    new 
hprice; hprice = dini_Int(hfile, "Price");
    new 
howner[256]; howner = dini_Get(hfile, "Owner");
    new 
hname[256]; hname = dini_Get(hfile, "Name");
    if(
GetPlayerMoney(playerid) < hprice) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Purchase", "You do not have enough money to purchase\nthis house!", "Ok", "");
    if(
strcmp(howner, nigname, true) == 0) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Purchase", "You already own this house!", "Ok", "");
    if(
CasaComprada[GetEntID(playerid)] == true)
    {
        
SendClientMessage(playerid, -1, "Vocк nгo pode comprar uma casa jб comprada!");
        return 
true;
    }
    else
    {
        
dini_Set(hfile, "Owner", pName(playerid));
        
CasaComprada[GetEntID(playerid)] = true;
        
GivePlayerMoney(playerid, -hprice);
        
PlayerPlaySound(playerid, 1058, 0, 0, 0);
        
PlayerPlaySound(playerid, 1149, 0, 0, 0);
        
ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Purchase", "You have successfully purchased this house!", "", "Exit");
        if(
HMESSAGES == 1){
            new 
str[128];
            
format(str, sizeof(str), "%s purchased the House '%s' [ID:%d] for $%d!", pName(playerid), hname, GetEntID(playerid), hprice);
            
SendClientMessageToAll(COLOR_BLUE, str);
        }
    }
    return 
true;
} 
vendercasa
PHP код:
 format(hfile, sizeof(hfile), "/Houses/%d.ini", GetEntID(playerid));
new 
howner[MAX_PLAYER_NAME]; howner = dini_Get(hfile, "Owner");
new 
nigname[MAX_PLAYER_NAME]; nigname = pName(playerid);
if(
strcmp(howner, nigname, true) != 0) return ShowPlayerDialog(playerid, DABOX-1, DIALOG_STYLE_MSGBOX, "House - Options", "You are not the owner of this house!", "Ok", "");
if(
strcmp(inputtext,"Yes", true) == 0)
{
    new 
hprice; hprice = dini_Int(hfile, "Price");
    new 
hname[256]; hname = dini_Get(hfile, "Name");
    
dini_Set(hfile, "Owner", "None");
    
GivePlayerMoney(playerid, hprice);
    
CasaComprada[GetEntID(playerid)] = false;
    if(
HMESSAGES == 1){
        new 
str[128];
        
format(str, sizeof(str), "%s sold the House '%s' [ID:%d] [Price: %d]!", pName(playerid), hname, GetEntID(playerid), hprice);
        
SendClientMessageToAll(COLOR_BLUE, str);
    }
    return 
1;
}
else if(
strcmp(inputtext,"No", true) == 0)
{
    
SendClientMessage(playerid, COLOR_RED, "You decided not to sell your house...");
} 
se continuar o erro posta o GetEntID(playerid)
Reply


Messages In This Thread
Dб pra comprar casa jб comprada - by logan1910 - 23.07.2016, 02:00
Re: Dб pra comprar casa jб comprada - by focaximubh - 23.07.2016, 04:41
Re: Dб pra comprar casa jб comprada - by logan1910 - 23.07.2016, 06:32
Re: Dб pra comprar casa jб comprada - by MBJ - 23.07.2016, 18:06
Re: Dб pra comprar casa jб comprada - by logan1910 - 23.07.2016, 20:16
Re: Dб pra comprar casa jб comprada - by MBJ - 23.07.2016, 21:09
Re: Dб pra comprar casa jб comprada - by logan1910 - 23.07.2016, 21:22
Re: Dб pra comprar casa jб comprada - by MBJ - 23.07.2016, 21:41
Re: Dб pra comprar casa jб comprada - by logan1910 - 23.07.2016, 21:52
Re: Dб pra comprar casa jб comprada - by MBJ - 23.07.2016, 22:01

Forum Jump:


Users browsing this thread: 1 Guest(s)