/house selltomarket "confirm" how to?
#4

PHP код:
new sellOwnedHouseID[MAX_PLAYERS]={-1,...};
findOwnedHouse(playerid){
    for(new 
iMAX_HOUSESi++)
    {
        if(
IsPlayerInRangeOfPoint(playerid2.0HouseInfo[i][ExteriorPos][0], HouseInfo[i][ExteriorPos][1], HouseInfo[i][ExteriorPos][2]) && 
            
HouseInfo[i][server_ID] == PlayerInfo[playerid][HouseID])
            return 
i;
    }
    return -
1;
}
updateHouseInfo(i){
    
DestroyDynamicPickup(HouseInfo[i][Pickup]);
    
DestroyDynamic3DTextLabel(HouseInfo[i][Label]);
    new 
s[100];
    
HouseInfo[i][Pickup] = CreateDynamicPickup(127323HouseInfo[i][ExteriorPos][0], HouseInfo[i][ExteriorPos][1], HouseInfo[i][ExteriorPos][2], HouseInfo[i][ExteriorWorld]);
    
format(s100"{70ff83}This house is for sell!\nPrice: %d\nType /buyhouse to buy it\nType /enter to go inside"HouseInfo[i][Price]);
    
HouseInfo[i][Label] = CreateDynamic3DTextLabel(COLOR_ORANGEHouseInfo[i][ExteriorPos][0], HouseInfo[i][ExteriorPos][1], HouseInfo[i][ExteriorPos][2],30.0
    
INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1, -17.0);
}
CMD:house(pid,p[]){
    new 
opt1[32],
        
opt2[32],
        
s[100],
        
i;
    if(
sscanf(params,"s[32]s[32]",opt1,opt2))return SendClientMessage(pid,-1,"/house [selltomarket / selltomarket confirm]");
    if(!
strcmp(opt1,"selltomarket")){
        if(
strlen(opt2) && !strcmp(opt2,"confirm")){
            if((
i=sellOwnedHouseID[pid])==-1)return SendClientMessage(pid,-1,"you haven't seleted any house to sell!");
            new 
houseprice floatround(HouseInfo[i][Price]*0.5);
            
updateHouseInfo(i);
            
HouseInfo[i][ForSell] = 1;
            
HouseInfo[i][Locked] = 0;
            
GiveMoney(playeridhouseprice);
            
sellOwnedHouseID[pid]=-1;
            
format(s100"You've sold your house for $%d!"houseprice);
            
SendClientMessage(playeridCOLOR_GREYstr);
        }else{
            if(
sellOwnedHouseID[pid]!=-1)return SendClientMessage(pid,-1,"you are already selling some house type (/house selltomarket confirm)!");
            if((
i=findOwnedHouse(pid))==-1)return SendClientMessage(pid,-1,"you arent near to any of your houses!");
            
sellOwnedHouseID[pid]=i;
            
SendClientMessage(pid,-1,"you are selling your house, type (/house selltomarket confirm)");
        }
    }
    return 
1;

Reply


Messages In This Thread
/house selltomarket "confirm" how to? - by ShadowMortar - 27.01.2019, 06:06
Re: /house selltomarket "confirm" how to? - by TheToretto - 27.01.2019, 12:25
Re: /house selltomarket "confirm" how to? - by ShadowMortar - 27.01.2019, 14:41
Re: /house selltomarket "confirm" how to? - by codExpert - 27.01.2019, 15:07
Re: /house selltomarket "confirm" how to? - by Pottus - 27.01.2019, 15:43
Re: /house selltomarket "confirm" how to? - by TheToretto - 28.01.2019, 10:52

Forum Jump:


Users browsing this thread: 1 Guest(s)