06.10.2010, 19:27
(
Последний раз редактировалось [MKD]Max; 07.10.2010 в 05:20.
)
Hello Guys I Have Give You The Script I Make It All Done It No Errors No Wraning But I Need To Make rent for exampel player enter pickup showplayerdialog what room to buy so please tell mehow to make this rent and please when he click what room he want from the rent dialog tele him in room thanks and i hope you understand me
Код:
#include <a_samp> #include <dini> #define MAX_HOUSES 200 public OnGameModeInit() { CreateHouse("House1", 500000, 2242.5498046875, -1160.0283203125, 1028.9913330078, 2244.4995117188, -1159.9997558594, 1029.796875, 15, 0); CreateHouse("House2", 500000, 2239.779296875, -1159.9140625, 1028.9913330078, 2238.3647460938, -1159.2828369141, 1029.796875, 15, 0); CreateHouse("House3", 500000, 2242.638671875, -1170.609375, 1028.9913330078, 2244.22, -1170.84, 1029.796875, 15, 0); CreateHouse("House4", 500000, 2239.97265625, -1170.65234375, 1028.9913330078, 2237.8874511719, 1170.6646728516, 1029.796875, 15, 0); CreateObject(2987, 2243.02, -1159.74, 1030.00, 0.00, 0.00, 90.00); CreateObject(2987, 2239.44, -1159.76, 1030.00, 0.00, 0.00, 90.00); CreateObject(2987, 2239.52, -1170.78, 1030.00, 0.00, 0.00, 90.00); CreateObject(14512, 2262.28, -1162.00, 1030.55, 0.00, 0.00, -90.00); CreateObject(14499, 2217.08, -1187.09, 1030.45, 0.00, 0.00, 0.00); CreateObject(14510, 2248.86, -1172.85, 1030.53, 0.00, 0.00, 0.00); return 1; } enum houseinfo { HouseNames[60], //To save into the file Renter[24], Rentable, Rentcost, HouseCost, //The house cost HouseOwner[24], // The house owners Name HouseIsBought, //If the house is brought or not Float:PickupX, // PickupX Float:PickupY, //PickupY Float:PickupZ, //PickupZ Float:TeleX, //The house location Float:TeleY, //The house location Float:TeleZ, //The house location Interior, //The house Interior HouseSell, //House sell price Owned, Virtual } new HouseInfo[MAX_HOUSES][houseinfo]; //It saves all the info in this variable. new HouseCount = -1; //House count new PickupID[MAX_HOUSES]; new InHouse[MAX_PLAYERS] = -1; stock CreateHouse(Filename[], Cost, Float:Pickupx, Float:Pickupy, Float:Pickupz, Float:Telex, Float:Teley, Float:Telez, interior, sell) { if(!dini_Exists("Owners.ini")) { dini_Create("Owners.ini"); } HouseCount ++; new ID = HouseCount; //HouseID format(HouseInfo[ID][HouseNames], 60, "%s", Filename); //Saves the HouseName into a variable HouseInfo[ID][HouseCost] = Cost; HouseInfo[ID][HouseIsBought] = 500000; HouseInfo[ID][PickupX] = Pickupx; HouseInfo[ID][Virtual] = ID; HouseInfo[ID][PickupY] = Pickupy; HouseInfo[ID][PickupZ] = Pickupz; HouseInfo[ID][TeleX] = Telex; HouseInfo[ID][TeleY] = Teley; HouseInfo[ID][TeleZ] = Telez; HouseInfo[ID][Interior] = interior; HouseInfo[ID][HouseSell] = sell; if(strlen(dini_Get("Owners.ini", Filename))) //This is to see if there is any owner. { format(HouseInfo[ID][HouseOwner], 24, "%s", dini_Get("Owners.ini", Filename)); HouseInfo[ID][Owned] = 1; } PickupID[ID] = CreatePickup(1273, 23, 2242.5498046875, -1160.0283203125, 1028.9913330078, -1); //Creates the pickup :). PickupID[ID] = CreatePickup(1273, 23, 2239.779296875, -1159.9140625, 1028.9913330078, -1); //Creates the pickup :). PickupID[ID] = CreatePickup(1273, 23, 2242.638671875, -1170.609375, 1028.9913330078, -1); //Creates the pickup :). PickupID[ID] = CreatePickup(1273, 23, 2239.97265625, -1170.65234375, 1028.9913330078, -1); //Creates the pickup :). Create3DTextLabel("Room1", 0x00A0F6AA, 2242.5498046875, -1160.0283203125, 1028.9913330078 + 0.75, 15.0, 0, 1); Create3DTextLabel("Room2", 0x00A0F6AA, 2239.779296875, -1159.9140625, 1028.9913330078 + 0.75, 15.0, 0, 1); Create3DTextLabel("Room3", 0x00A0F6AA, 2242.638671875, -1170.609375, 1028.9913330078 + 0.75, 15.0, 0, 1); Create3DTextLabel("Room4", 0x00A0F6AA, 2239.97265625, -1170.65234375, 1028.9913330078 + 0.75, 15.0, 0, 1); } public OnFilterScriptExit() { return 1; } public OnPlayerPickUpPickup(playerid, pickupid) //Pickup callback { for(new J; J<MAX_HOUSES; J++) //Loops through all houses { if(pickupid == PickupID[J]) //If the pickupid is one of our house ones { new str[75]; if(HouseInfo[J][Owned] == 1) { format(str, sizeof(str), "~r~House Info~n~~g~Owner: ~w~%s", HouseInfo[J][HouseOwner]); } if(HouseInfo[J][Owned] == 0) { format(str, sizeof(str), "~r~House Info~n~~g~Owner: ~w~Nobody"); SendClientMessage(playerid, 0x67F6F6AA, "This house is up for sale! Type /buy to buy it"); } new str2[75]; format(str2, sizeof(str2), "~g~Cost price:%d ~w~%d~n~~g~Sell Price:~w~ %d", 500000, 0); new str3[150]; format(str3, sizeof(str3), "%s~n~%s", str, str2); GameTextForPlayer(playerid, str3, 3500, 3); } } return 1; } Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/buy", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2242.5498046875, -1160.0283203125, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strlen(dini_Get("Owned.ini", Pname))) if(GetPlayerMoney(playerid) < 490000) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house"); if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!"); GivePlayerMoney(playerid, - 500000); GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3); HouseInfo[i][Owned] = 1; format(HouseInfo[i][HouseOwner], 24, "%s", Pname); dini_Set("Owners.ini", Pname, HouseInfo[i][HouseNames]); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/sell", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2242.5498046875, -1160.0283203125, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); GivePlayerMoney(playerid, 0); GameTextForPlayer(playerid, "~r~House Sold!", 2000, 3); if(HouseInfo[i][Owned] == 0) return SendClientMessage(playerid, 0xF60000AA, "you cant sell again thats not your"); dini_Unset("Owners.ini", Pname); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/buy1", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2239.779296875, -1159.9140625, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strlen(dini_Get("Owned.ini", Pname))) if(GetPlayerMoney(playerid) < 490000) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house"); if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!"); GivePlayerMoney(playerid, - 500000); GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3); HouseInfo[i][Owned] = 1; format(HouseInfo[i][HouseOwner], 24, "%s", Pname); dini_Set("Owners.ini", Pname, HouseInfo[i][HouseNames]); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/sell1", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2239.779296875, -1159.9140625, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); GivePlayerMoney(playerid, 0); GameTextForPlayer(playerid, "~r~House Sold!", 2000, 3); if(HouseInfo[i][Owned] == 0) return SendClientMessage(playerid, 0xF60000AA, "you cant sell again thats not your"); dini_Unset("Owners.ini", Pname); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/buy2", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2242.638671875, -1170.609375, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strlen(dini_Get("Owned.ini", Pname))) if(GetPlayerMoney(playerid) < 490000) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house"); if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!"); GivePlayerMoney(playerid, - 500000); GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3); HouseInfo[i][Owned] = 1; format(HouseInfo[i][HouseOwner], 24, "%s", Pname); dini_Set("Owners.ini", Pname, HouseInfo[i][HouseNames]); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/sell2", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2242.638671875, -1170.609375, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); GivePlayerMoney(playerid, 0); GameTextForPlayer(playerid, "~r~House Sold!", 2000, 3); if(HouseInfo[i][Owned] == 0) return SendClientMessage(playerid, 0xF60000AA, "you cant sell again thats not your"); dini_Unset("Owners.ini", Pname); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/buy3", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2239.97265625, -1170.65234375, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strlen(dini_Get("Owned.ini", Pname))) if(GetPlayerMoney(playerid) < 490000) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this house"); if(HouseInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This house is already owned!"); GivePlayerMoney(playerid, - 500000); GameTextForPlayer(playerid, "~r~House Purchased!", 2000, 3); HouseInfo[i][Owned] = 1; format(HouseInfo[i][HouseOwner], 24, "%s", Pname); dini_Set("Owners.ini", Pname, HouseInfo[i][HouseNames]); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/sell3", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2239.97265625, -1170.65234375, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); GivePlayerMoney(playerid, 0); GameTextForPlayer(playerid, "~r~House Sold!", 2000, 3); if(HouseInfo[i][Owned] == 0) return SendClientMessage(playerid, 0xF60000AA, "you cant sell again thats not your"); dini_Unset("Owners.ini", Pname); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/enter", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2242.5498046875, -1160.0283203125, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); SetPlayerPos(playerid, 2244.4995117188, -1159.9997558594, 1029.796875); SendClientMessage(playerid, 0x00C4F6AA, "You have entered your house"); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/exit", cmdtext) == 0) { if(InHouse[playerid] == -1) return SendClientMessage(playerid, 0xF60000AA, "You are not in a house"); SetPlayerPos(playerid, 2242.5498046875, -1160.0283203125, 1028.9913330078); SendClientMessage(playerid, 0x00C4F6AA, "You have exited your house"); InHouse[playerid] = -1; return 1; } if (strcmp("/enter1", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2239.779296875, -1159.9140625, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); SetPlayerPos(playerid, 2238.3647460938, -1159.2828369141, 1029.796875); SendClientMessage(playerid, 0x00C4F6AA, "You have entered your house"); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/exit1", cmdtext) == 0) { if(InHouse[playerid] == -1) return SendClientMessage(playerid, 0xF60000AA, "You are not in a house"); SetPlayerPos(playerid, 2239.779296875, -1159.9140625, 1028.9913330078); SendClientMessage(playerid, 0x00C4F6AA, "You have exited your house"); InHouse[playerid] = -1; return 1; } if (strcmp("/enter2", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2242.638671875, -1170.609375, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); SetPlayerPos(playerid, 2244.22, -1170.84, 1029.796875); SendClientMessage(playerid, 0x00C4F6AA, "You have entered your house"); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/exit2", cmdtext) == 0) { if(InHouse[playerid] == -1) return SendClientMessage(playerid, 0xF60000AA, "You are not in a house"); SetPlayerPos(playerid, 2242.638671875, -1170.609375, 1028.9913330078); SendClientMessage(playerid, 0x00C4F6AA, "You have exited your house"); InHouse[playerid] = -1; return 1; } if (strcmp("/enter3", cmdtext) == 0) { for(new i; i<MAX_HOUSES; i++) { if(IsPlayerInRangeOfPoint(playerid, 1, 2239.97265625, -1170.65234375, 1028.9913330078)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, HouseInfo[i][HouseOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this house!"); SetPlayerPos(playerid, 2237.8874511719, 1170.6646728516, 1029.796875); SendClientMessage(playerid, 0x00C4F6AA, "You have entered your house"); return 1; } SendClientMessage(playerid, 0xF60000AA, "You are not close enough to a house"); return 1; } return 1; } if (strcmp("/exit3", cmdtext) == 0) { if(InHouse[playerid] == -1) return SendClientMessage(playerid, 0xF60000AA, "You are not in a house"); SetPlayerPos(playerid, 2239.97265625, -1170.65234375, 1028.9913330078); SendClientMessage(playerid, 0x00C4F6AA, "You have exited your house"); InHouse[playerid] = -1; return 1; } return 0; } |