23.12.2010, 16:28
Код:
if(strcmp(cmd, "/buyhouse", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pLevel] < 5) { SendClientMessage(playerid, COLOR_GREY, " You must be atleast level 5 to buy a house !"); return 1; } if(PlayerInfo[playerid][pHouseAccepted] == 0) { if(PlayerInfo[playerid][pHouseRequested] == 0) { new AdminsOnline; for(new i; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pAdmin] >= 3) { AdminsOnline++; } } } if(AdminsOnline < 1) { SendClientMessage(playerid, COLOR_GREY, " There are currently no admins online"); return 1; } if(BuyHouseInfoDialog[playerid] == 0) { DisplayDialogForPlayer(playerid, 49); //buyhouse info } else { DisplayDialogForPlayer(playerid, 50); //buyhouse main } } else { SendClientMessage(playerid, COLOR_GREY, " Your house request has already been sent to the admins !"); } } else { SendClientMessage(playerid, COLOR_GREY, " Your house has been accept / you already own a house !"); } } return 1; } if(strcmp(cmd, "/confirm", true) == 0) { if(IsPlayerConnected(playerid)) { if(GetPlayerInterior(playerid) != 0) { SendClientMessage(playerid, COLOR_GREY, " That can't use that while inside !"); return 1; } if(HouseSetup[playerid] != 0) { if(HouseSetup[playerid] == 1) //Interior { GetPlayerPos(playerid,PlayerInfo[playerid][pHouseX],PlayerInfo[playerid][pHouseY],PlayerInfo[playerid][pHouseZ]); if(HousePickupIDTemp[playerid] == 0) //Has Not Placed a House Pickup Yet { GetPlayerName(playerid, sendername, sizeof(sendername)); //Name Tag format(string, sizeof(string),"House"); House3dTextID[playerid] = Create3DTextLabel(string,COLOR_WHITE,PlayerInfo[playerid][pHouseX],PlayerInfo[playerid][pHouseY],PlayerInfo[playerid][pHouseZ]+0.88,20.0,0,1); strmid(PlayerInfo[playerid][pHouseTag], string, 0, strlen(string), 255); //Owner format(string, sizeof(string),"Owner: %s", sendername); HouseTextOwnerID[playerid] = Create3DTextLabel(string,COLOR_WHITE,PlayerInfo[playerid][pHouseX],PlayerInfo[playerid][pHouseY],PlayerInfo[playerid][pHouseZ]+0.74,20.0,0,1); strmid(PlayerInfo[playerid][pHouseOwnerTag], sendername, 0, strlen(sendername), 255); //Pickup HousePickupIDTemp[playerid] = CreatePickup(1273,1,PlayerInfo[playerid][pHouseX],PlayerInfo[playerid][pHouseY],PlayerInfo[playerid][pHouseZ]); SendClientMessage(playerid, COLOR_YELLOW, "You have sucessfully placed your house entrance, type /buyhouse to continue."); } else { DestroyPickup(HousePickupIDTemp[playerid]); HousePickupIDTemp[playerid] = CreatePickup(1273,1,PlayerInfo[playerid][pHouseX],PlayerInfo[playerid][pHouseY],PlayerInfo[playerid][pHouseZ]); } } return 1; } if(dialogid == 49) //buyhouse text main { if(response) { BuyHouseInfoDialog[playerid] = 1; DisplayDialogForPlayer(playerid, 50); //buyhouse main menu } return 1; } if(dialogid == 50) //buyhouse main menu { if(response) { switch(listitem) { case 0: { if(HousePickupIDTemp[playerid] == 0) { DisplayDialogForPlayer(playerid, 51); //buyhouse entrance confirm menu } else { DisplayDialogForPlayer(playerid, 50); //buyhouse main menu } } case 1: { DisplayDialogForPlayer(playerid, 55); //interior menu } case 2: { DisplayDialogForPlayer(playerid, 52); //name setup } case 3: { DisplayDialogForPlayer(playerid, 57); //complete confirm menu } } return 1; } } if(dialogid == 51) //entrance confirm { if(response) { HouseSetup[playerid] = 1; } else { DisplayDialogForPlayer(playerid, 50); //buyhouse main menu } } if(dialogid == 52) //name setup { if(response) { if(!strlen(inputtext)) { DisplayDialogForPlayer(playerid, 52); //name setup SendClientMessage(playerid, COLOR_GREY, " You must enter a nametag !"); return 1; } if(strlen(inputtext) >= 10) { DisplayDialogForPlayer(playerid, 52); //name setup SendClientMessage(playerid, COLOR_WHITE, " Nametag can not be above 10 characters long !"); return 0; } new string[128]; new hnametag[64]; strmid(hnametag, inputtext, 0, strlen(inputtext), 255); Update3DTextLabelText(Text3D:House3dTextID[playerid], COLOR_WHITE, hnametag); strmid(PlayerInfo[playerid][pHouseTag], hnametag, 0, strlen(hnametag), 255); //update temp housetag format(string, sizeof(string), "Your house nametag has been set to %s.", hnametag); SendClientMessage(playerid, COLOR_YELLOW, string); } else { DisplayDialogForPlayer(playerid, 50); //buyhouse main menu } } if(dialogid == 55) //Interior List { if(response) { new string[128]; new InteriorName[20]; switch(listitem) { case 0: { if(PlayerInfo[playerid][pCash] >= 10000 || PlayerInfo[playerid][hTicket] == 1) { InteriorName = "Small Room 1"; PlayerInfo[playerid][pHouseLevel] = 1; HousePriceTemp[playerid] = 10000; } else { SendClientMessage(playerid, COLOR_GREY, " you do not have enough money !"); return 1; } } case 1: { if(PlayerInfo[playerid][pCash] >= 20000 || PlayerInfo[playerid][hTicket] == 1) { InteriorName = "Small Room 2"; PlayerInfo[playerid][pHouseLevel] = 2; HousePriceTemp[playerid] = 20000; } else { SendClientMessage(playerid, COLOR_GREY, " you do not have enough money !"); return 1; } } case 2: { if(PlayerInfo[playerid][pCash] >= 30000 || PlayerInfo[playerid][hTicket] == 1) { InteriorName = "Motel Room"; PlayerInfo[playerid][pHouseLevel] = 3; HousePriceTemp[playerid] = 30000; } else { SendClientMessage(playerid, COLOR_GREY, " you do not have enough money !"); return 1;} } } if(PlayerInfo[playerid][hTicket] == 1) { format(string, sizeof(string), "You have set your House Interior to %s.", InteriorName); } else { format(string, sizeof(string), "You have set your House Interior to %s, this will Cost you $%d.", InteriorName, HousePriceTemp[playerid]); } SendClientMessage(playerid, COLOR_YELLOW, string); } else { DisplayDialogForPlayer(playerid, 50); //BuyHouse Main Menu } } if(dialogid == 57) //house confirm menu { new string[128]; if(response) { if(HousePickupIDTemp[playerid] == 0) { SendClientMessage(playerid, COLOR_GREY, " You have not chosen a house entrance yet !"); DisplayDialogForPlayer(playerid, 50); return 1; } if(PlayerInfo[playerid][pHouseLevel] == 0) { SendClientMessage(playerid, COLOR_GREY, " You have not chosen an interior yet !"); DisplayDialogForPlayer(playerid, 50); return 1; } new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "Request: [%d]%s is currently awaiting approval for their house, use /accepthouse or /annuller", playerid, sendername); ABroadCast(COLOR_YELLOW, string, 1); PlayerInfo[playerid][pHouseRequested] = 1; SendClientMessage(playerid, COLOR_YELLOW, "Your house request has been sent to the admins."); } else { DisplayDialogForPlayer(playerid, 50); //buyhouse main menu } }